How to make sure Chinese text is rendered in webpage?
If the specified font doesn’t contain a glyph for a character, browsers typically use a fallback font to render this character.
(Browsers don’t have do this, of course, and how it exactly works might also depend on the operating system. But it would be really suprising if there were browsers that don’t use fallback fonts. Not to mention that there are many user-agents that don’t even support CSS, e.g., text browser, feed readers, etc.; for them you couldn’t even specify a font to begin with.)
If no suitable font is found, a "replacement glyph" (aka. "tofu"; often, but not necessarily, something like "□") will be displayed for this character.
The algorithms defined by CSS:
- CSS 2.1 (REC from 2011):
Font matching algorithm - CSS Fonts Module Level 3 (CR from 2013):
Font Matching Algorithm - CSS 2.2 (WD from 2016):
Font matching algorithm - CSS Fonts Module Level 4 (WD from 2017):
Font Matching Algorithm
So unless you know of a user-agent that doesn’t handle it, I wouldn’t worry about it. But, ideally, always use the lang
attribute (in this context, it could help browsers "to select language-appropriate fonts" as fallbacks).
If you care about visual harmony, you might be interested in font families like Noto or Ubuntu. They try to cover all languages/scripts, rendering them in a visually compatible way (e.g., same height etc.).