Last modified: 2012-11-23 12:27:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T40122, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 38122 - Allow non-inline CSS to use WebFonts fonts
Allow non-inline CSS to use WebFonts fonts
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
WebFonts (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Santhosh Thottingal
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-02 19:46 UTC by Yair Rand
Modified: 2012-11-23 12:27 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
three screenshots demonstrating the issue (8.61 KB, image/png)
2012-07-09 02:00 UTC, Ran Ari-Gur (User:Ruakh on WMF projects)
Details

Description Yair Rand 2012-07-02 19:46:31 UTC
WebFonts does not load fonts correctly when the fonts are specified through Common.css or other CSS pages. Thus, fonts can not be associated with specific CSS classes. 

(See https://en.wiktionary.org/wiki/Wiktionary_talk:Votes/2012-06/Enabling_WebFonts_Extension#Problems.2Flimitations. )
Comment 1 Brion Vibber 2012-07-02 21:39:37 UTC
Afaik specifying the fonts in CSS pages shouldn't be a problem... is something failing to load the fonts in the first place maybe?

Got a specific example page to reproduce the bug with?
Comment 2 Ran Ari-Gur (User:Ruakh on WMF projects) 2012-07-09 02:00:37 UTC
Created attachment 10832 [details]
three screenshots demonstrating the issue

@Brion Vibber: The problem is that the fonts aren't loaded if they're only specified via CSS pages. If something does cause the font to be loaded (an inline style or a lang="..." elsewhere on the page), then it works.

I don't have admin access on any wikis that have this extension installed, so I can't give you a link, but I'm attaching three screenshots that demonstrate the issue (two cases that work fine and one case that does not), and here are steps to reproduce them:

1. Create http://hi.wikipedia.org/wiki/User:Brion_VIBBER/common.css with the
   following:

       .miriam-clm { font-family: 'Miriam CLM'; }

2. Visit a random edit-page, enter this wiki-text, and click "Preview" (or
   "पूर्वावलोकन" if you haven't set your language preferences):

       * <span class="miriam-clm">עִבְרִית</span>
       * <span lang="he">עִבְרִית</span>

   You will notice that the two list-items look identical, because Miriam CLM
   is successfully loaded, and applied to both list-items.

3. Now try this:

       * <span class="miriam-clm">עִבְרִית</span>
       * <span style="font-family: 'Miriam CLM'">עִבְרִית</span>

   Same story.

4. But if you try just this:

       * <span class="miriam-clm">עִבְרִית</span>

   then Miriam CLM does *not* get loaded.

Does that make sense?
Comment 3 Santhosh Thottingal 2012-07-22 08:47:22 UTC
(In reply to comment #2)
> 1. Create http://hi.wikipedia.org/wiki/User:Brion_VIBBER/common.css with the
>    following:
> 
>        .miriam-clm { font-family: 'Miriam CLM'; }
> 
> 2. Visit a random edit-page, enter this wiki-text, and click "Preview" (or
>    "पूर्वावलोकन" if you haven't set your language preferences):
> 
>        * <span class="miriam-clm">עִבְרִית</span>
>        * <span lang="he">עִבְרִית</span>
> 
>    You will notice that the two list-items look identical, because Miriam CLM
>    is successfully loaded, and applied to both list-items.

Explanation: WebFonts extension parse the page and find an element with lang=he, loads the default font for he= Miriam CLM. Since the font is loaded the  .miriam-clm { font-family: 'Miriam CLM'; } works fine and <span class="miriam-clm">עִבְרִית</span> correctly change the font.
 
> 3. Now try this:
> 
>        * <span class="miriam-clm">עִבְרִית</span>
>        * <span style="font-family: 'Miriam CLM'">עִבְרִית</span>
> 
>    Same story.

Explanation: WebFonts extension parse the page and find an element with style with font-family: 'Miriam CLM'. It loads the  font Miriam CLM. Since the font is loaded the  .miriam-clm { font-family: 'Miriam CLM'; } works fine and <span class="miriam-clm">עִבְרִית</span> correctly change the font.


> 4. But if you try just this:
> 
>        * <span class="miriam-clm">עִבְרִית</span>
> 
>    then Miriam CLM does *not* get loaded.

Explanation: In this case , font is defined in a CSS file, and no where in page HTML or in inline CSS. WebFonts extension does not parse the external CSS. It parses the HTML elements and it also identify the inline font-family style attribute(like  <span style="font-family: 'Miriam CLM'">עִבְרִית</span> ) . But since it does not parse common.css and load the font-family defined in that external css, the case #4 does not work.

I am not sure whether we can support this, we did not try so far. In en.wikisource, hebrew fonts are loaded using templates .

A very detailed explanation of this templates and how they use webfonts extension are available here:
http://en.wikisource.org/wiki/Template:Lang
and 
http://en.wikisource.org/wiki/Template:Lang-hbo

Please let us know if your usecase is not achievable in this way. Thanks.
Comment 4 Santhosh Thottingal 2012-07-22 12:17:02 UTC
For supporting font-families in css defined non-inline, we have a patch now https://gerrit.wikimedia.org/r/16250
Comment 5 matanya 2012-08-12 10:13:24 UTC
partly fixed. will there be a wider fix here?
Comment 6 Santhosh Thottingal 2012-08-12 12:05:00 UTC
(In reply to comment #5)
> partly fixed. will there be a wider fix here?

Can you elaborate why is it partly fix and what kind of wider fix are you expecting?
Comment 7 Santhosh Thottingal 2012-11-23 12:27:50 UTC
please reopen or report new issue if the fix is not sufficient

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links