我可以在同一段落中对亚洲字符(韩语)使用两种不同的字体,对罗马字符使用另一种字体吗?
Can I use two different typefaces for Asian characters (korean) and another for roman characters in the same paragraph?
问题是我们是否有一个段落同时包含韩语(韩文)字符和罗马字符。 CSS 有没有办法让韩文字符使用某种字体,而罗马字符使用另一种字体?
例如,我想对韩文使用 Noto Sans KR,对罗马字符使用 Helvetica。这个 CSS 看起来怎么样?
中文和日文有类似的功能吗?
编辑:文本由罗马 letters/words 和韩文(韩文)交织而成。所以把它们分开是行不通的。
最简单的方法可能是在段落的不同部分周围添加 <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;
}
与任何其他内容相同:使用具有逻辑回退顺序的 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>
如您所见,带有回退字体的段落使用罗马字体呈现英文部分,使用韩文字体呈现韩文部分。
(为了说明这一点,第二段只用了Times——你可以看到韩文不匹配混合家庭段。第二段只用Jeju Myeongjo,那段英文不匹配混合家庭款)。
问题是我们是否有一个段落同时包含韩语(韩文)字符和罗马字符。 CSS 有没有办法让韩文字符使用某种字体,而罗马字符使用另一种字体?
例如,我想对韩文使用 Noto Sans KR,对罗马字符使用 Helvetica。这个 CSS 看起来怎么样?
中文和日文有类似的功能吗?
编辑:文本由罗马 letters/words 和韩文(韩文)交织而成。所以把它们分开是行不通的。
最简单的方法可能是在段落的不同部分周围添加 <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;
}
与任何其他内容相同:使用具有逻辑回退顺序的 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>
如您所见,带有回退字体的段落使用罗马字体呈现英文部分,使用韩文字体呈现韩文部分。
(为了说明这一点,第二段只用了Times——你可以看到韩文不匹配混合家庭段。第二段只用Jeju Myeongjo,那段英文不匹配混合家庭款)。