gpt4 book ai didi

html - 我可以在同一段落中对亚洲字符(韩语)使用两种不同的字体,对罗马字符使用另一种字体吗?

转载 作者:太空宇宙 更新时间:2023-11-03 21:15:30 28 4
gpt4 key购买 nike

问题是我们是否有一个段落同时包含韩语(韩语)字符和罗马字符。 CSS 中有没有办法让韩文字符使用某种字体,而罗马字符使用另一种字体?

例如,我想对韩文使用 Noto Sans KR,对罗马字符使用 Helvetica。这个 CSS 看起来如何?

中文和日文有类似的功能吗?

编辑:文本由罗马字母/单词和韩语(韩语)交织而成。所以将它们分开是行不通的。

最佳答案

与任何其他内容相同:使用具有逻辑回退顺序的 CSS 字体系列。确保首先列出罗马字体,这不适用于韩文,然后再列出韩文字体,这样它们就会在同一个文本 block 中显示韩文文本:

@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——你可以看到韩文不匹配mixed family段。第二段只用Jeju Myeongjo,那段英文不匹配mixed family段)。

关于html - 我可以在同一段落中对亚洲字符(韩语)使用两种不同的字体,对罗马字符使用另一种字体吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42703176/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com