
Malformed HTML lang attributes affect which fonts are displayed
I use Firefox on Windows 7 with the "Allow pages to choose their own fonts" option unchecked.
Since updating to FF v33 I've noticed that my font choices are not respected on some websites, e.g., stackoverflow.com (in fact, all Stack Exchange sites) and duckduckgo.com. Instead the fonts fall back to Times New Roman, MS Sans Serif and Courier New regardless of whether I've specified those fonts as my serif, sans or monospace defaults in the FF options | content menu.
After a lot of digging around I've found that the problem seems to be related to non-standard lang attributes in a pages HTML. For example stackoverflow.com has <body lang=""> and duckduckgo.com has lang="en_US". If I manually change the HTML to lang="en" or lang="en-US" then FF uses my font choices correctly.
I don't know enough about the HTML standard to say whether those sites are sending me bad HTML, but FF has definitely started handling it less gracefully.
NB I can reproduce this behavior on OS X 10.10 (FF v33) and Fedora 20 (FF v32.0.2).
Bewerkt door Deditos op
Gekozen oplossing
Hmm, interesting. So what I see is as follows:
In Options > Content > Advanced, I set these Serif fonts:
- Western character set: Times New Roman
- Other Languages character set: Book Antiqua
On this site and Google, which both are UTF-8 encoded with lang="en" or lang="en-US" the Western serif font is used.
On the two sites you identified, which are UTF-8 encoded with unrecognizable lang attribute values, the Other Languages serif font is used.
So it sounds as though setting the Other Languages fonts to your preferred fonts should work around the issue.
Success?
Dit antwoord in context lezen 👍 1Alle antwoorden (3)
Gekozen oplossing
Hmm, interesting. So what I see is as follows:
In Options > Content > Advanced, I set these Serif fonts:
- Western character set: Times New Roman
- Other Languages character set: Book Antiqua
On this site and Google, which both are UTF-8 encoded with lang="en" or lang="en-US" the Western serif font is used.
On the two sites you identified, which are UTF-8 encoded with unrecognizable lang attribute values, the Other Languages serif font is used.
So it sounds as though setting the Other Languages fonts to your preferred fonts should work around the issue.
Success?
Forgot to mention: you change between character sets such as Western and Other Languages using the control at the top of the Fonts dialog ("Fonts for:").
Aha, I didn't realise you could set the fonts separately for different languages. That's what was happening; FF was (understandably) treating those bad lang attributes as "Other Language" and using the group of fonts for that setting, which were still the default (including Proportional -> Serif).
So I just need to set up my preferred fonts for "Other Languages" in addition to "Western" to get the overall behaviour I want. That's great.
I've only tested this on OS X so far, but I expect it will solve my problem on Windows as well.
Thanks for your help.