w3c / mlreq

Mongolian Layout Requirements
https://www.w3.org/International/mlreq/
25 stars 12 forks source link

Adjusting fonts per language #27

Open r12a opened 5 years ago

r12a commented 5 years ago

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.

When arranged with other languages, Mongolian font should be set as CSS-MONGOLIAN-FONT:MongolianFontName. When the option is designated, Mongolian font in all control texts should be changed into MongolianFontName, while other languages’ font should accord with default font in the system. Because the change of Mongolian font will affect Chinese font when it is arranged with Chinese or other languages and sometimes, Chinese will be displayed in the way of lying down.

r12a commented 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?

asmusf commented 5 years ago

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.