Self-Hosting Google Web Fonts
ranf.tl
ranf.tl
For browsers that don't support WOFF, just specify a browser-safe font in your CSS. Those browsers will ignore the Woff declaration and use the browser-safe font instead.
EDIT: As far as file size goes, I use two font weights on my site: Source Sans Pro regular and bold. Each font weighs 27kb - so 54kb in total. This is much less than many Javascript libraries and third-party embeds.
Here's my site (hope it's fine to link) - it's admittedly very simple and has no Javascript (although Javascript is needed to load the fonts!). In the end you have to weigh up the balance between page weight and performance for your own site.
EDIT: Done.
If you need to convert a font for which you have the rights, there's Font Squirrel. (http://www.fontsquirrel.com/tools/webfont-generator). That tool can convert a font to all the popular formats. Throw in SVG if you need to support old iPhones.
You don't really need Google Fonts as a service any more. That was a workaround. Just host on your own site in WOFF.
Why do you feel the need to use JS for font-loading?
You can, for example, use Google with a local fallback, for better reliability. (their CDN will fail at some time)
It also removes a dependency on a 3rd party source.
If you're using anything outside of the, say, top 20 most popular fonts - users aren't going to get any benefit from the caching.
In general keeping the number of dependencies down is a good thing to do.
Web performance is complicated though and all the pros and cons interact in non-intuitive ways. A comparison of self-hosted, inexpensive CDN hosted, and original Google hosted may provide some performance surprises.
I guess you would lose these optimizations by hosting them yourself.
As all files are the exact same ones Google is hosting in the wild, I don't feel like you'll lose any optimizations (which might be the case when using font generation services like FontSquirrel).
I'll look into that and maybe provide some additional fonts on a per OS/Browser basis to download. The main problem is that it's impossible to have a static CSS snippet AND provide different files per User-Agent (a javascript solution might help). So until I've found a solution to this, you are absolutely right, these optimizations will get lost on local use!
For reference: I'm currently using the following User-Agents for fetching the font file urls from Google's CSS: http://pastebin.com/5SZ1Q6kj
Anyway, thanks for your service, bookmarked... (I've been thinking of doing something similar). Good luck with finding a solution to this problem...
There are examples of Brick v GF, Brick does indeed look better (to me), but at the expense of file size. The same fonts in the examples are twice the size of GF.
I always figured they reason they didn't make it easy themselves was cause they didn't allow it, but never actually checked. I would kind of like to serve google fonts with cache-forever headers -- google strangely doesn't. I'd also like to package them up in a web project I'd like to make runnable from local file system without internet.
In general I only specify what I will actually be using, but knowing the difference is helpful... I wish more font packs would do the right thing here.
Former downloads only provided fonts with the default Latin subset, this has been resolved (charsets are selectable). I'm sorry if this causes any inconvenience (please keep in mind, it's still a prototype)...
> d. Data Portability
> Google supports data portability. For as long as you use or store any user data that you obtained through the APIs, you agree to enable your users to export their equivalent data to other services or applications of their choice in a way that's substantially as fast and easy as exporting such data from Google products and services, subject to applicable laws, and you agree that you will not make that data available to third parties who do not also abide by this obligation.
but also
> a. Content Accessible Through our APIs
> Our APIs contain some third party content (such as text, images, videos, audio, or software). This content is the sole responsibility of the person that makes it available. We may sometimes review content to determine whether it is illegal or violates our policies or the Terms, and we may remove or refuse to display content. Finally, content accessible through our APIs may be subject to intellectual property rights, and, if so, you may not use it unless you are licensed to do so by the owner of that content or are otherwise permitted by law. Your access to the content provided by the API may be restricted, limited, or filtered in accordance with applicable law, regulation, and policy.
My reading of 5e says the opposite. That 'unless expressly permitted by content owners' you shouldn't be allowing caching of content provided via Google APIs.
Considering that most (all?) fonts on Google Fonts are open (most I checked use SIL or Apache as license), downloading is most likely allowed.
Think of it like an affirmation from an open source project licensed under an MIT or BSD license. Although they might include GPL code from elsewhere, they'll generally state that they're not relicensing someone else's GPL code under the less restrictive license.
Probably the biggest issue for the service will be to make sure that licensing is ensured. (see https://news.ycombinator.com/item?id=8802833)
This may result in a higher latency, but might be more safe in regards to their ToS.
Your temporary caching, to me, seems fine. I read the ToS as saying that permitting your end user to obtain permanent copies might be disallowed ... at the discretion of the font designers. To be absolutely certain, you should check each font's license. Considering the fonts aren't Google's to license, I doubt you'll hear from them.
Interestingly, Google's own Fonts API which I'm using with my service, doesn't provide any information about the underlying license of each font (I previously wanted to include that info in the UI as well).
The only thing that bothers me is the generation of the zip file, but streaming these files without any caching on the server would be very expensive (especially on a single free heroku dynamo).
1. Add fonts to your collection.
2. Click the download button in the upper right corner.
that it does not offer all formats in one convenient package.