demo · v135

Same characters, three locales

The motivating example from the spec: U+9AA8 (the "bone" character) renders with subtly different glyph shapes in Japanese, Simplified Chinese, and Traditional Chinese. Until Chrome 135, <canvas> ignored the parent's lang attribute and the new ctx.lang property — everyone got the OS default. Now the same text drawn three times produces three correct glyphs.

ctx.lang: ?

lang = ja

lang = zh-Hans

lang = zh-Hant

If you don't have the relevant CJK fallback fonts installed, the three may render identically — the spec change is upstream of font fallback.

the code

const ctx = canvas.getContext("2d");
ctx.font = "48px serif";
ctx.lang = "ja";           // NEW in Chrome 135
ctx.fillText("骨", 20, 60);
ctx.lang = "zh-Hans";
ctx.fillText("骨", 90, 60);
ctx.lang = "zh-Hant";
ctx.fillText("骨", 160, 60);

see also