CSS

字体语言覆盖 | font-language-override

font-language-override

font-language-overrideCSS属性控制特定语言的字形在字体的使用。

/* Keyword value */ font-language-override: normal; /* <string> values */ font-language-override: "ENG"; /* Use English glyphs */ font-language-override: "TRK"; /* Use Turkish glyphs */ /* Global values */ font-language-override: initial; font-language-override: inherit; font-language-override: unset;

默认情况下,HTML的lang属性会告诉浏览器显示专门为该语言设计的字形。例如,很多字体都有一个特殊字符,用于fi合并“i”和“f”中的点。但是,如果语言设置为土耳其语,则字体可能不知道使用合并的字形; 土耳其语有两个版本的“i”,一个是点(i),一个是没有(ı),使用连字将错误地将一个虚线的“i”变成一个无点的“i”。

font-language-override属性可以让您覆盖特定语言的字体行为。例如,当您使用的字体缺乏对语言的适当支持时,这很有用。例如,如果字体对阿泽里语言没有适当的规则,则可以强制字体使用符合类似规则的土耳其字形。

初始值normal
应用于all elements. It also applies to ::first-letter and ::first-line.
继承与yes
媒体visual
计算值as specified
动画类型discrete
规范顺序the unique non-ambiguous order defined by the formal grammar

语法

该font-language-override属性被指定为关键字normal或<string>。

normal指示浏览器使用适合于该lang属性指定的语言的字体字形。这是默认值。

形式语法

normal | <string>

HTML

<p class="para1">Default language setting.</p> <p class="para2">This is a string with the <code>font-language-override</code> set to Danish.</p>

CSS

p.para1 {   font-language-override: normal; } p.para2 {   font-language-override: "DAN"; }

结果

规范

SpecificationStatusComment
CSS Fonts Module Level 3The definition of 'font-language-override' in that specification.Candidate RecommendationInitial definition.

浏览器兼容性

FeatureFirefox (Gecko)ChromeInternet ExplorerOperaSafari (WebKit)
Basic support4.0 (2.0) -moz 34 (34) 1????

FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support?4.0 (2.0) -moz 34.0 (34)1???