-
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
Do not preload unused variants in the JavaScript-based polyfill #97
Conversation
Pull Request Test Coverage Report for Build 340
💛 - Coveralls |
Regarding the .ttf format that ends up in the Maybe we should just introduce another copy of the fonts and provide
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(https://fonts.gstatic.com/s/notoserif/v8/ga6Iaw1J5X9T9RW6j9bNfFcWbg.woff) format('woff');
} $ curl 'https://fonts.googleapis.com/css?family=Noto+Serif:400'
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(https://fonts.gstatic.com/s/notoserif/v8/ga6Iaw1J5X9T9RW6j9bNfFcWbQ.ttf) format('truetype');
}
/* cyrillic-ext */
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(https://fonts.gstatic.com/s/notoserif/v8/ga6Iaw1J5X9T9RW6j9bNfFoWaCi_.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(https://fonts.gstatic.com/s/notoserif/v8/ga6Iaw1J5X9T9RW6j9bNfFMWaCi_.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(https://fonts.gstatic.com/s/notoserif/v8/ga6Iaw1J5X9T9RW6j9bNfFsWaCi_.woff2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(https://fonts.gstatic.com/s/notoserif/v8/ga6Iaw1J5X9T9RW6j9bNfFQWaCi_.woff2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(https://fonts.gstatic.com/s/notoserif/v8/ga6Iaw1J5X9T9RW6j9bNfFgWaCi_.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(https://fonts.gstatic.com/s/notoserif/v8/ga6Iaw1J5X9T9RW6j9bNfFkWaCi_.woff2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Noto Serif';
font-style: normal;
font-weight: 400;
src: local('Noto Serif'), local('NotoSerif'), url(https://fonts.gstatic.com/s/notoserif/v8/ga6Iaw1J5X9T9RW6j9bNfFcWaA.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
} |
I think we should merge this as-is. The current state of preload makes me feel we still need it. Firefox doesn't even have preload support unflagged yet (WTF). About the TTF's in out unused fonts declarations, I think the right way forward is to switch behavior to self-host google fonts. I need to find the time to concentrate on that. Maybe it's a hack night opportunity :) |
Fixes #92
Addresses the problem discussed here: https://gitter.im/assetgraph/assetgraph?at=5ece6c29a91f120a6cc72bca
Looks like we only weed out the non-subfont-introduced fonts when adding the
<link rel="preload">
s, not the JavaScript-based polyfill.The
User-Agent
thing I mentioned is a separate problem, since it means that the unused variants copied into the__subset
font families will end up as .ttfs because they're based on the generic CSS from Google Web Fonts. We could fix that by providingwoff
andwoff2
alternatives as well. Let's discuss and try to address it separately.This polyfill keeps biting us, maybe the state of web browsers is so that we can remove it soon?