Open r12a opened 5 years ago
The normal way to approach this is to ensure that your content has markup indicating the language of the text. For example, in HTML you would put a span
or some other element around the embedded text and attach the attribute lang=
with a value of either mn
or zh-hans
/zh-hant
/cmn
, etc. You can then describe the preferred font in the CSS using a language selector.
For example, in a Chinese document that contains text in Mongolian, you'd set the lang
attribute on the html
element to zh-hans
, and wrap Mongolian text like this:
<p>国际化活动、<span lang="mn">W3C ᠣᠯᠠᠨ ᠦᠨᠳᠦᠰᠦᠲᠡᠨ ᠦ ᠪᠣᠯᠭᠠᠬᠤ ᠦᠢᠯᠡ ᠠᠵᠢᠯᠯᠠᠭᠠ</span>万维网联盟</p>
Then you'd have a CSS selector something like :lang(mn) { "Noto Sans Mongolian, sans-serif; }
.
Marking up content for language is not only useful for font application – it can also have an effect on line-breaking, hyphenation, spell-checking, and other behaviours. For example, CSS expects the browser to apply certain line-break behaviours to text that is marked up as Chinese.
Is there a reason that the normal approach won't work here?
The suggestions mentions "control texts".
How does on select language-based font behavior for text input fields? The more typical issue is one of relative size, not necessarily font-family as proposed here.
This is an issue originally raised by Nasun-urt and Huqitu in the mlreq draft. Moving the issue here for discussion and elaboration before contacting the CSS WG.