Last Comment Bug 1064737 - support WOFF2 fonts via @font-face
: support WOFF2 fonts via @font-face
Status: RESOLVED FIXED
: dev-doc-complete
Product: Core
Classification: Components
Component: Layout: Text (show other bugs)
: unspecified
: All All
-- enhancement with 5 votes (vote)
: mozilla35
Assigned To: Jonathan Kew (:jfkthame)
:
:
Mentors:
Depends on: 1066160
Blocks: 1084026
  Show dependency treegraph
 
Reported: 2014-09-09 01:34 PDT by Jonathan Kew (:jfkthame)
Modified: 2015-05-17 15:24 PDT (History)
16 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
35+


Attachments
pt 1 - enable WOFF2 support in OTS. (2.07 KB, patch)
2014-09-11 11:26 PDT, Jonathan Kew (:jfkthame)
jd.bugzilla: review+
Details | Diff | Splinter Review
pt 2 - support for WOFF2 as a webfont format. (14.67 KB, patch)
2014-09-11 11:27 PDT, Jonathan Kew (:jfkthame)
jd.bugzilla: review+
Details | Diff | Splinter Review
pt 3 - read metadata from a WOFF2 font if present. (12.81 KB, patch)
2014-09-11 11:28 PDT, Jonathan Kew (:jfkthame)
jd.bugzilla: review+
Details | Diff | Splinter Review
pt 4 - simple reftest for a WOFF2 font. (135.36 KB, patch)
2014-09-11 11:28 PDT, Jonathan Kew (:jfkthame)
jd.bugzilla: review+
Details | Diff | Splinter Review

Description User image Jonathan Kew (:jfkthame) 2014-09-09 01:34:29 PDT
See http://dev.w3.org/webfonts/WOFF2/spec/ for current Editor's Draft of the spec.

WOFF2 offers tighter compression than WOFF 1.0, leading to faster load times for pages that use webfonts.

To use this, we'll need to build OTS with WOFF2 enabled in gfx/ots/src/moz.build, and support the WOFF2 format hint in nsUserFontSet. And in order to build OTS with WOFF2 support, we'll need to add the Brotli decoder to our build.

See https://code.google.com/p/font-compression-reference/source/browse/#git%2Fbrotli for Brotli source; also present in https://github.com/khaledhosny/ots/tree/master/third_party/brotli.
Comment 1 User image Jonathan Kew (:jfkthame) 2014-09-09 02:31:43 PDT
Hmm -- looks like as of now, at least, the Brotli source in https://github.com/khaledhosny/ots/tree/master/third_party/brotli is not fully up-to-date with the upstream code.

We should import Brotli directly from Google's reference repository, separately from importing OTS from Khaled's github repo.
Comment 2 User image Jonathan Kew (:jfkthame) 2014-09-11 11:26:06 PDT
Created attachment 8488093 [details] [diff] [review]
pt 1 - enable WOFF2 support in OTS.

This includes WOFF2 support in our build of OTS. (I'll approach Khaled about upstreaming the added OTS_API annotation and a better way to handle the #include path, so we don't have to maintain long-term local patches for these issues.)
Comment 3 User image Jonathan Kew (:jfkthame) 2014-09-11 11:27:50 PDT
Created attachment 8488096 [details] [diff] [review]
pt 2 - support for WOFF2 as a webfont format.

WOFF2 support in gfx, under the control of a new pref "gfx.downloadable_fonts.woff2.enabled". Initially this defaults to false for release builds, true for nightlies.
Comment 4 User image Jonathan Kew (:jfkthame) 2014-09-11 11:28:17 PDT
Created attachment 8488097 [details] [diff] [review]
pt 3 - read metadata from a WOFF2 font if present.
Comment 5 User image Jonathan Kew (:jfkthame) 2014-09-11 11:28:32 PDT
Created attachment 8488098 [details] [diff] [review]
pt 4 - simple reftest for a WOFF2 font.
Comment 6 User image Jonathan Kew (:jfkthame) 2014-09-11 13:03:56 PDT
Tryserver build with bug 1066160 and the patches here:
https://tbpl.mozilla.org/?tree=Try&rev=a5d2a853c4af
Comment 9 User image Jean-Yves Perrier [:teoli] 2014-10-15 04:17:30 PDT
Added information (mostly compat info) to:
https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face
and
https://developer.mozilla.org/en-US/docs/Web/Guide/WOFF

Updated:
https://developer.mozilla.org/en-US/Firefox/Releases/35


Release Note Request (optional, but appreciated)
[Why is this notable]: New font format supported, Web compat (Chromium support it)
[Suggested wording]: WOFF2 fonts are now supported.
[Links (documentation, blog post, etc)]: https://developer.mozilla.org/en-US/docs/Web/Guide/WOFF
Comment 10 User image Jonathan Kew (:jfkthame) 2014-10-15 04:29:36 PDT
Note that woff2 support is behind a runtime pref; it's currently enabled for prerelease (nightly/aurora) builds, but will default to disabled on release channels.

The intention is, of course, to enable this by default, but we may wish to do further security review and testing before that happens. So it's unclear to me at this point what Firefox version will ship with WOFF2 enabled by default on Release.

ni? :teoli (to consider how this status should be reflected in the documentation mentioned above).
Comment 11 User image Jean-Yves Perrier [:teoli] 2014-10-15 10:43:57 PDT
Oh, thanks Jonathan I missed that point. Fixed.

By the way, when a bug about activating WOFF2 in release is created, please add dev-doc-needed to it so that we know to update the doc about it when it lands (we de-emphasize the versions where it is supported behind a pref only) :-)
Comment 12 User image Lukas Blakk [:lsblakk] use ?needinfo 2014-12-02 14:21:27 PST
Have added this to Aurora notes for 35/36 while it's awaiting a move to release.

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