问题是我们是否有一个包含韩文(韩文)字符和罗马字符的段落。在CSS中是否有一种方法可以使韩文字符成为某种字体,而罗马字符使用另一种字体?
例如,我想将Hango和Helvetica的Noto Sans KR用于罗马字符。这个CSS看起来怎么样?
中国人和日本人有类似的功能吗?
编辑:文字交织着罗马字母/单词和韩文(韩文)。因此将它们分开是行不通的。
答案 0 :(得分:3)
与任何其他内容相同:使用具有逻辑后备顺序的CSS字体系列。确保首先列出罗马字体,这对于韩语不起作用,然后列出韩语字样,这样他们就可以在同一个文本块中输入韩语文本:
@import url(//fonts.googleapis.com/earlyaccess/jejumyeongjo.css);
p {/*
Order matters: roman first, which doesn't have hangul support, and
so will kick in for the English text, but will fall through to the
next font when there are "letters" that don't exist in the font.
Then you follow up with a Korean typeface, and now you have a
font stack for styling the two scripts in their respective typefaces.
*/
font-family: Times, 'Jeju Myeongjo', serif;
}
p:nth-child(2) { font-family: Times, serif; }
p:nth-child(3) { font-family: 'Jeju Myeongjo', serif; }

<p>This is a paragraph with 한국어, also known as 조선말.</p>
<p>This is a paragraph with 한국어, also known as 조선말 (purely Times).</p>
<p>This is a paragraph with 한국어, also known as 조선말 (purely Jeju Myeongjo).</p>
&#13;
如您所见,带有字体后备的段落使用罗马字体呈现英语部分,使用韩语字体呈现朝鲜语部分。
(为了使这个更清楚,第二段仅使用Times - 你可以看到韩国人与混合家庭段落不匹配。第二段仅使用济州明城,并且在该段中英语与混合家庭不匹配段)。
答案 1 :(得分:1)
最简单的解决方法可能是在段落的不同部分添加<span>
标记:
<p>
<span class="korean-font">...</span>
<span class="roman-font">...</span>
</p>
然后,CSS需要为每个人指定font-famliy。
.korean-font {
font-family: "Noto Sans", "Noto Sans CJK KR", sans-serif;
}
.roman-font {
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
}