Page MenuHomePhabricator

Provide a way to enable/disable web fonts for other languages
Closed, DeclinedPublic

Description

Currently there are 2 configuration settings in ULS for web fonts:

  • You can select the font (including your default font) for navigation etc.
  • You can select the font (including your default font) for content (if that's in a different language from the navigation)

You currently can't set the fonts for <span lang="xy">..</span> (both in navigation and content), ULS loads a web font and forces you to use it. There should be a third option to control whether a web font should be loaded and embeded, or whether the default font should be used.


Version: unspecified
Severity: enhancement
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=46306

Details

Reference
bz51102

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:08 AM
bzimport set Reference to bz51102.
bzimport added a subscriber: Unknown Object (MLST).
Schnark created this task.Jul 10 2013, 9:35 AM

Actually it is possible to configure the fonts for other languages, too. You just have to switch the interface language, configure the fonts, and switch back. The settings will be remembered and applied to this language in the text. So there is "just" the need for a proper UI to do so. I suggest to make it look and work like the interface to configure the input methods for different languages.

The option you mention was considered, and finally discarded from the ULS designs for the following reasons:

  • Added unnecessary complexity for the general usecase: Adjusting fonts for content and UI languages is the main usecase for web fonts. We allow the user to "select a font for language X".

On the one hand, if we add an option to "Disable web fonts", that requires the user to have some understanding of what web font technology is (which is harder than input methods, since web fonts is more invisible for the user). On the other hand, if we add something along the lines of "Use system fonts for other languages", users need to understand the context of this option (i.e., that mixed-language content is possible and the user is deciding to not get help for displaying it). This also introduces a problem about whether to invalidate the previous web font selections for other languages or not.

  • Users were likely to have expressed their preference before. Users that need to disable the provided web font for a language (because they installed a font for it) or those who know the script with enough detail to have a different preferred font, are likely to also participate in contexts where these languages are either the main content or UI languages. Thus, font issues are more likely to appear (and be fixed) in such contexts. Since font preferences are persisted, they are applied the next time a language appears, making the need to change language of mixed-language content a less common case.

We acknowledge that there is an edge case which is not covered, but the decision was not to cover it in order to avoid adding complexity to the general usecase. Having said that, there are many different languages, projects and contexts, so feel free to provide a more specific description of the context where the lack of the requested feature becomes problematic for users, so that we can better understand the specific problem.

Well, the main reason why I opened this bug, was because I want to disable web fonts for the languages where I have a font installed, as otherwise the characters from other languages are invisible for a short time (time between the font is set and downloaded). On long pages like [[de:Deutschland]] this may take some seconds (look at the interlanguage links, some of them will disappear and re-appear). But I agree with you that adding more complex options for all users isn't a good solution, too.

IMHO this bug can be closed if you provide a documentation for advanced users about how to use the JavaScript methods, either to write a user script/gadget or to set fonts via a JavaScript console. I just used

mw.loader.using('ext.uls.webfonts', function () {

mw.webfonts.preferences.load();
mw.webfonts.preferences.setFont('bpy', 'system');
mw.webfonts.preferences.save();

});

but I'm not sure whether this is the right way to do it.

You can use something like this in your common.js:

$.webfonts.repository.languages.en = ["Comic Sans MS", "OpenDyslexic"];

To use your system default, use:

$.webfonts.repository.languages.en = ["system", "Comic Sans MS", "OpenDyslexic"];

Actually I think this should be reopened.

If the option is considerately designed, it will add only very little complexity to the UI (in fact, if you ask me, the ULS itself is complex, and should be designed differently; a single new option won't do any harm).

Loading of webfonts can be needless and very annoying (bug 51703). The performance issues in regard to the list of autonyms (foreign languages list) even made the development of a specialized webfont necessary (bug 40874), which will be a hacky solution at best.

Fixing this bug would be the cleanest solution for many people!

Sorry, wrong bug number, correct one for the needless loading of webfonts is bug 51073.

(In reply to comment #4)

You can use something like this in your common.js:
$.webfonts.repository.languages.en = ["Comic Sans MS", "OpenDyslexic"];
To use your system default, use:
$.webfonts.repository.languages.en = ["system", "Comic Sans MS",
"OpenDyslexic"];

Is there a possibility to set all webfont repositories to, e.g. "system" to effectively disable web-font loading through JavaScript?
If yes, will such JavaScript be executed early enough, e.g. before ULS tries to load any webfonts?

(In reply to comment #4)

You can use something like this in your common.js:
$.webfonts.repository.languages.en = ["Comic Sans MS", "OpenDyslexic"];
To use your system default, use:
$.webfonts.repository.languages.en = ["system", "Comic Sans MS",
"OpenDyslexic"];

For the records, this is now (since a while ago) documented at https://www.mediawiki.org/wiki/Extension:UniversalLanguageSelector#Overriding_default_fonts.