Looking for someone knowledgable about lang= tag

34 views
Skip to first unread message

mark a. foltz

unread,
Nov 11, 2015, 4:31:31 PM11/11/15
to blink-dev
Hey,

I have a few questions about how lang= is implemented in Blink.

(1) Does it affect default font selection for a given element (especially for CJK)?
(2) Will <html lang="ja"> cascade down to all elements in the document?
(3) Will <html lang="ja"> override or otherwise interact with any Content-Language header sent with the HTTP the response serving the document?

Feel free to ping me directly or respond off-list, or send a code pointer.

Thanks,
Mark

Dominic Cooney

unread,
Nov 11, 2015, 8:58:42 PM11/11/15
to mark a. foltz, Matt Falkenhagen, blink-dev
Hi Mark--responses inline.

On Thu, Nov 12, 2015 at 6:31 AM, 'mark a. foltz' via blink-dev <blin...@chromium.org> wrote:
Hey,

I have a few questions about how lang= is implemented in Blink.

(1) Does it affect default font selection for a given element (especially for CJK)?

I'm unfortunately not sure about how CJK font selection works. falken knows a lot about it because he wrote a Chrome extension that lets users configure some aspect of it. I suspect lang influences how the fallback for "missing" glyphs works, with the note that CJK characters are missing from the default fonts.
 
(2) Will <html lang="ja"> cascade down to all elements in the document?

Yes, unless there's an intervening lang attribute. What Element::computeInheritedLanguage does and its callers should be of interest.
 
(3) Will <html lang="ja"> override or otherwise interact with any Content-Language header sent with the HTTP the response serving the document?

You can see in Element::computeInheritedLanguage that the Content-Language header is used as a last resort, if you drill through the toDocument(n)->contentLanguage() part. That's set on the document by the FrameLoader or something processing meta http-equiv stuff.

HTH,

Dominic

Matt Falkenhagen

unread,
Nov 12, 2015, 1:05:15 PM11/12/15
to Dominic Cooney, dr...@chromium.org, js...@chromium.org, mark a. foltz, blink-dev
2015-11-11 17:58 GMT-08:00 Dominic Cooney <domi...@chromium.org>:
Hi Mark--responses inline.

On Thu, Nov 12, 2015 at 6:31 AM, 'mark a. foltz' via blink-dev <blin...@chromium.org> wrote:
Hey,

I have a few questions about how lang= is implemented in Blink.

(1) Does it affect default font selection for a given element (especially for CJK)?

I'm unfortunately not sure about how CJK font selection works. falken knows a lot about it because he wrote a Chrome extension that lets users configure some aspect of it. I suspect lang influences how the fallback for "missing" glyphs works, with the note that CJK characters are missing from the default fonts.

Yes, lang affects font selection. Blink's default font settings are keyed by script, so the default fonts for different CJK scripts can be different. See GenericFontFamilySettings and how CSSFontSelector uses it. However, the default font is only used if there was no font explicitly specified by the page. In cause the specified font is missing the needed characters, we go to fallback mode and I believe this still doesn't use font settings to choose a font, see https://code.google.com/p/chromium/issues/detail?id=239118.

mark a. foltz

unread,
Apr 18, 2016, 4:35:53 PM4/18/16
to Matt Falkenhagen, Dominic Cooney, dr...@chromium.org, js...@chromium.org, blink-dev
A very belated thank you to Dominic and Matt.   The context for my question is to craft some language about how to handle user language preferences in Presentation API (first/second screen) scenarios.  The relevant spec issue is here:


Cheers,
m.

Reply all
Reply to author
Forward
0 new messages