我可以在同一段落中使用两个不同的亚洲字符(韩文)和另一个罗马字符的字体



问我们是否有一个韩语(hangul)角色和罗马角色的段落。在CSS中,在罗马字符使用其他字体时,CSS是否有一种hangul字符为某个字体?

例如,我想将noto sans kr用于hangul和helvetica作为罗马角色。这个CSS看起来如何?

中文和日语是否有类似的功能?

编辑:文本是由罗马字母/单词和hangul(韩文)交织在一起的。因此将它们分开是行不通的。

与任何其他内容相同:使用带有逻辑后备顺序的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>

您可以看到,带有字体后备的段落使用罗马字体和韩国类型的韩国零件呈现英文零件。

(为了清楚这一点,第二段只使用时间 - 您可以看到韩语与混合家庭段落不符。第二段仅使用jeju myeongjo,在那段段落中,英语不符合混合家庭段落)。

实现此操作的最简单方法可能是在段落的不同部分添加<span>标签:

<p>
  <span class="korean-font">...</span>
  <span class="roman-font">...</span>
</p>

然后,CSS需要为每个指定字体 - 及以上。

.korean-font {
  font-family: "Noto Sans", "Noto Sans CJK KR", sans-serif;
}
.roman-font {
  font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif; 
}

最新更新