-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only download truetype files from Google Web Fonts and convert them locally #115
Conversation
Pull Request Test Coverage Report for Build 474
💛 - Coveralls |
I couldn't resist:
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/l/font?kit=mem8YaGs126MiZpBA-U1V48aHa0AbQ&skey=62c1cbfccc78b4b2&v=v17) format('woff2');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans Regular'), local('OpenSans-Regular'), url(https://fonts.gstatic.com/l/font?kit=mem8YaGs126MiZpBA-U1Uo8aHa0AbQ&skey=62c1cbfccc78b4b2&v=v17) format('truetype');
}
... It seems like wawoff2 actually produces a slightly smaller woff2 file than the one we get from Google. The apparent increase in size must be because this upgrades the mock to a newer version of the Open Sans font, then. Also, according to |
As I understand we need woff/woff2 full versions for fallback if it is enabled. |
TIL about ttx tool from fonttools library. |
So what is the difference then? Some meta data? |
It must be more efficient brotli compression settings in |
Yeah, at present the fallback in the Google Web Fonts case consists of us async-loading the original CSS from their servers after the document has loaded: Lines 220 to 245 in 8770e73
There are some good things about this, but we've been meaning to also fully self-host the fallback for a long time: #31 This PR is a step towards that -- I can try looking into it next. |
d8cf34d
to
47a6f27
Compare
* master: (53 commits) Use the conversion tools introduced in #115 when creating a subset font with harfbuzz Update font-snapper to ^1.2.0 Limit the concurrency of wasm operations and lower the heap size Don't break when a @font-face declaration is missing font-family or src Wow, Travis is slow, lower to 2 iterations of the generated HTML test Generated HTML test: Don't generate the same stylesheet each time Improve the property-based tests and run 5 iterations instead of 1 Update font-snapper to ^1.1.0 Include unicode-range in the fallback @font-face declarations Simplify HB_TAG Revert "Revert "Get hb-subset.wasm from harfbuzzjs instead of vendoring it in"" Allocate more memory for the wasm heap so we can subset more fonts concurrently Undo change to testdata/referenceImages/withoutLigatures/index.html Test: Add missing check for truetype format Simplify HB_TAG Remove the ability to shell out to hb-subset again Configure hb-subset.wasm to preserve the GSUB, GPOS, and GDEF tables Update the vendored in vendor/hb-subset.wasm Default to using the wasm build Pass --drop-tables-=GSUB,GPOS,GDEF to the hb-subset binary ...
Fixes #109, local font conversion tools lifted from #56
Avoids the problem where we end up with multiple
@font-face
declarations when downloading the woff2 version given enough characters in the subset: #109 (comment)It causes a small (2%) increase in the size of the woff2 file in one of the test cases: https://github.com/Munter/subfont/pull/115/files#diff-fab359c44278133fd8ef28aafc5b4a2cR479
Not sure if it's significant enough that we should try to track it down.