-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support for providing multiple webfont formats as fallbacks #4
Comments
I'm not sure. Can we find a good use case for this? Maybe the solution is something else eventually. |
I suppose aside from legacy fallbacks pre widespread woff support, the case would be someone providing woff2 for browsers that support it, but woff to those that don't. Not entirely sure how to approach this in my wordpress plugin neither - so far I am offering woff and woff2 as default suggested formats, but also allow uploading eot, ttf and svg and generate the @font-face rule according to what's supplied, should someone want to include older font formats as well. There might be a case for simply insisting on woff only, and woff2 eventually. I'm not familiar with the FontFace API, but it would seem one can also provide several urls to a FontFaceSet just like with @font-face |
I don't think we need to cover this. woff/woff2 is essentially to save some bandwidth via compression. We're downloading an OpenType format anyways and use that download in the @font-face rule directly. I'd suggest to use
If there is a |
I'll have a go at this, because I haven't found a proper way to supply "the most suitable" of several available files without browser sniffing - so the @font-face or FontFace API would be a good way to let the browser choose. I found out that FontFace API actually lets you supply a "@font-face" rule as the second argument, as a fallback. |
Yeah, I guess you can give it a shot. For EOT, I'd expect that it's not supported by Opentype.js, but maybe it is (It's OpentType after all "Embedded OpenType"). A desirable order is rather |
I don't think the @font-face declaration excludes any of the Opentype.js features per se, why would it - it's just a different method of getting the same file to the browser? The problem I am facing is that all font files are loaded via XHR, so the normal progression of letting the browser load the most appropriate file doesn't really apply, even if I can write the makeWebFont function that way. The way the WebfontProvider works means it already requires the files to be loaded, which defeats this fallback effort by load overhead. Really not sure how to go about this, again. |
So that's how it works at the moment, load the font via XHR, then look inside with opentype.js to get all the data provided by fontinfo.js. And because it's loaded already, use it with WebfontProvider. |
I said two weeks ago:
I still think that's needed. Maybe we could try to make our current |
Ah I see now, I must have misunderstood why you suggested switching away from Opentype.js for that matter. |
Wondering if it makes sense to have a implementation in tune with the @font-face declaration that supports passing in several formats.
The text was updated successfully, but these errors were encountered: