Last modified: 2011-08-31 10:02:35 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 T31318, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29318 - Pack the list of available fonts
Pack the list of available fonts
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
WebFonts (Other open bugs)
unspecified
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Niklas Laxström
: i18n
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-08 10:41 UTC by Niklas Laxström
Modified: 2011-08-31 10:02 UTC (History)
2 users (show)

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


Attachments
Sample of JSON data for WebFonts as stuffed into every page's HTML (9.55 KB, text/plain)
2011-06-08 17:40 UTC, Brion Vibber
Details

Description Niklas Laxström 2011-06-08 10:41:12 UTC
The list of all fonts is getting quite a large. I don't know if it is worth it, but the data could be made shorter by forcing a predictable name and location for each font file. Then we could just transfer font name and the supported types (eof, ttf...) and construct the path from a pattern path/fontname.type.
Comment 1 Brion Vibber 2011-06-08 17:40:33 UTC
Created attachment 8632 [details]
Sample of JSON data for WebFonts as stuffed into every page's HTML

To illustrate, this entire structure gets pumped out in the body of every page on my test wiki with WebFonts enabled. It's pretty huge!

Every font lists three or four distinct URLs for eot, ttf, woff, and svg files, which are almost entirely identical to each other.

It would be a lot more efficient to combine some data, for instance instead of:

fonts: {
  RufScript: {
    eot: "/trunk/extensions/WebFonts/fonts/en/Rufscript.eot"
    ttf: "/trunk/extensions/WebFonts/fonts/en/Rufscript.ttf"
    woff: "/trunk/extensions/WebFonts/fonts/en/Rufscript.woff"
  },
  Perizia: {
    eot: "/trunk/extensions/WebFonts/fonts/en/Perizia.eot"
    ttf: "/trunk/extensions/WebFonts/fonts/en/Perizia.ttf"
    woff: "/trunk/extensions/WebFonts/fonts/en/Perizia.woff"
  }
}

we could have:

base: "/trunk/extensions/WebFonts/fonts",
fonts: {
  RufScript: {
    file: "RufScript",
    formats: ["eot", "ttf", "woff"],
  },
  Perizia: {
    file: "Perizia",
    formats: ["eot", "ttf", "woff"],
  },
}

or heck, you could eliminate more data for common cases: if the filename's the same as the font name, leave it out! Collapse the format lists to a string:

base: "/trunk/extensions/WebFonts/fonts",
fonts: {
  RufScript: {
    as: ["etw"],
  },
  Perizia: {
    as: ["etw"],
  },
}

Of course if adding other fonts not from the default set, or for those that need additional metrics, more info needs to go in as well.

There may also be a benefit to moving this data to a ResourceLoader module and loading it separately... as it is we have all the downsides of having to wait for core modules to get loaded, plus the downside of putting JavaScript into every page so it balloons up our data size.

Putting the font info into page HTML also means that new fonts won't be picked up on cached page views.
Comment 2 Niklas Laxström 2011-08-31 10:02:35 UTC
Fixed in r95840 and r95842. I didn't pursue optimizing the every last byte out - I think this is good enough.

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


Navigation
Links