3 ms·
Based on your User-Agent, Google's CSS service only responds with a CSS to either a .woff, .woff2 .eot, .svg or .ttf font file. For local hosting you'll need to
by majodev 12y ago
Based on your User-Agent, Google's CSS service only responds with a CSS to either a .woff, .woff2 .eot, .svg or .ttf font file. For local hosting you'll need to order these formats in a compatibility sequence, so every browser gets the one it supports (nice writeup here: http://css-tricks.com/snippets/css/using-font-face/ http://css-tricks.com/snippets/css/using-font-face/).
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).
- vbezhenar 12y agoThat's not correct. I just downloaded the same google font css using different user agents, one for Windows Google Chrome and one for OS X Google Chrome. CSS were different, both specified .woff2 format but actual font URLs were different. And downloaded .woff2 files were different as well. I used Open Sans font for that test. http://pastebin.com/edYbfxzU http://pastebin.com/edYbfxzU here's log, you can try it yourself.
- majodev 12y agoWow, Thanks you for this paste! 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 http://pastebin.com/5SZ1Q6kj
- skwosh 12y agoI was going to mention this also. I'm currently working around it with conditional comments (serving /fonts/ie/9+/index.css, etc). Anyway, thanks for your service, bookmarked... (I've been thinking of doing something similar). Good luck with finding a solution to this problem...