openzim / mwoffliner

Mediawiki scraper: all your wiki articles in one highly compressed ZIM file
https://www.npmjs.com/package/mwoffliner
GNU General Public License v3.0
275 stars 72 forks source link

Integrate Mediawiki web-fonts #19

Open kelson42 opened 8 years ago

kelson42 commented 8 years ago

This important to have web font for certain languages like Burmese or Parsi. The reason is that we do not have the control about default operating system/browser ones and they are often of a bad quality.

That is why we need custom web fonts. The good point is that Mediawiki already defines it correctly on these Wikipedia. We just need to scrappe them and reload them correctly.

This should work out-of-the-box if resourceLoader works offline... but to be checked. See #18

First reported at https://sourceforge.net/p/kiwix/feature-requests/333/

kelson42 commented 7 years ago

See this thread which bring a few information https://lists.wikimedia.org/pipermail/mediawiki-l/2017-April/046504.html

kelson42 commented 7 years ago

Maybe being connected using a user were the fonts would be activated would work!?

ninjastrikers commented 5 years ago

Any update?

kelson42 commented 5 years ago

@ninjastrikers Not really, so far it is not clear how to solve the full problem. Mediawiki/Wikipedia seems to have abandonned the web font solution...

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

amire80 commented 5 years ago

Hi,

I was asked to comment on this.

I am happy to see that there is interest in this, because it makes a lot of sense.

@santhoshtr may have more details, but I'll write what I know.

https://github.com/wikimedia/jquery.webfonts/ isn't abandoned. It's not actively developed, but it does receive maintenance updates. The corresponding MediaWiki extension is UniversalLanguageSelector, and it is regularly maintained, too.

Webfonts are available on all Wikimedia projects, but on most of them they are disabled by default for performance and bandwidth reasons. Every user can enable them, and on some projects they are enabled by default if the editors community requested it. These performance issues are not supposed to be a problem for you, because if I understand correctly, your users download everything once and then work offline, and the fonts files are tiny when compared to the huge Wikipedia dumps that they download.

I don't know how exactly does your project work. You may want to use the standalone jquery library, or the whole UniversalLanguageSelector extension, or maybe just the fonts library that we compiled. Quite a lot of attention was dedicated to making it work well in different browsers—see the documentation files in jquery.webfonts for that.

If there's any more information I can provide, please let me know.

kelson42 commented 5 years ago

@amire80 Thank you for your feedback. Do you know what would be the way through the API to know if there is such a webfont available for a Mediawiki instance? And if "yes" how to get the Javascript machinery to get it loaded properly?

amire80 commented 5 years ago

I'm not sure it's available through the HTTP MediaWiki action API. If the user enabled the option, then the definedness of the JavaScript $.webfonts variable is a sign that the feature is enabled. In any case, if the UniversalLanguageSelector extension is installed, the JavaScript variable $.uls will be defined. As I mentioned earlier, the extension is installed in all Wikimedia projects, even if the webfonts feature is disabled by default. Perhaps @santhoshtr has a better answer.

santhoshtr commented 5 years ago

The webfonts we use in Wikipedia sites is based on this configuration https://github.com/wikimedia/mediawiki-extensions-UniversalLanguageSelector/blob/master/resources/js/ext.uls.webfonts.repository.js You can see per language fonts. The font files are present in the same repo.

Depending on the architecture, you may either use jquery.webfonts with this repository(It takes this repository as a configuration and applies fonts based on lang attribtues) or use a simple css font-face rules. They are very powerful and flexible now a days compared to the days when we wrote jquery.webfonts.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.