Page MenuHomePhabricator

Language-specific webfonts override autonym font
Closed, ResolvedPublic

Description

When an element with a lang attribute set to a language that causes a Webfont to load is located in an element with the class "autonym", the non-autonym font loads anyway and is applied to the element, overriding the autonym font. See for an example the Wikidata Main Page ([[d:]]) language box. The fonts for the various languages are loaded even though the box has the autonym class, and the autonym font is not used.


Version: unspecified
Severity: major

Details

Reference
bz58374

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:15 AM
bzimport set Reference to bz58374.
bzimport added a subscriber: Unknown Object (MLST).

https://www.wikidata.org/wiki/Wikidata:Hoofdpagina only loads the font Autonym for me.

https://www.wikidata.org/wiki/Wikidata:Main_Page only loads the font Autonym for me.

I'm using OSX 10.9 and Firefox 25.0.1.

I've created 3 test pages:

  1. https://www.mediawiki.org/wiki/User:Siebrand/test
  2. https://commons.wikimedia.org/wiki/User:Siebrand/test
  3. https://wikidata.org/wiki/User:Siebrand/test

Test results OSX 10.9/Firefox 25.0.1:

  1. Autonym and Lohit Kannada downloaded (1 too many)
  2. Autonym and Lohit Kannada downloaded (1 too many)
  3. Autonym downloaded (expected)

Test results Windows 7/Chrome 31

  1. Autonym, Lohit Kannada, Lohit Devanagari downloaded (2 too many)
  2. Autonym, Lohit Kannada, Lohit Devanagari downloaded (2 too many)
  3. Autonym downloaded (expected)

I realised I didn't place the text for the test here:

<span class="autonym"><span lang="kn">...</span> | <span lang="sa">...</span></span>

Expected is that only the font Autonym is loaded in this scenario, as happens on wikidata.org.

Change 100971 had a related patch set uploaded by Santhosh:
Update the $wgULSNoWebfontsSelectors defaults

https://gerrit.wikimedia.org/r/100971

Copying commit summary of gerrit 100791:

$wgULSNoWebfontsSelectors had default value as '#p-lang li > a' - the interlanguage links. It does not make sense after the class 'autonym' was added to such links. That 'autonym' CSS class has font family definition as Autonym, sans-serif, i.e. Autonym font is applied to the interlanguage links.

So, now it make sense to have default value as .autonym to exclude from parsing.

This also fixes the problems like Bug 58374 where in random cases the default font for the language get applied even if it has 'autonym' class.

This issue was because the js get executed before the css for .autonym class is ready and applied. The jquery.webfonts parser will miss to detect the explicit font family 'Autonym, sans-serif' and the default font is applied.

(In reply to comment #5)

Copying commit summary of Gerrit change #100791:

#100971 is the correct one.

$wgULSNoWebfontsSelectors had default value as '#p-lang li > a' - the
interlanguage links. It does not make sense after the class 'autonym' was
added
to such links. That 'autonym' CSS class has font family definition as
Autonym,
sans-serif, i.e. Autonym font is applied to the interlanguage links.

Just to be explicit, this has backwards compatibility impact from MLEB perspective. Someone running MLEB on older MediaWiki will now get the behavior of downloading all the fonts in interlanguage list.

Though, assuming that there are very few users doing that, and even if they do they wont have have hundreds of links like in Wikipedia, I would say this is acceptable trade off if mentioned on the release notes.

Change 100971 merged by jenkins-bot:
Update the $wgULSNoWebfontsSelectors defaults

https://gerrit.wikimedia.org/r/100971

Change 100990 had a related patch set uploaded by Siebrand:
Set $wgULSNoWebfontsSelectors

https://gerrit.wikimedia.org/r/100990

Change 100990 merged by jenkins-bot:
Set $wgULSNoWebfontsSelectors

https://gerrit.wikimedia.org/r/100990