majodev / google-webfonts-helper

A Hassle-Free Way to Self-Host Google Fonts. Get eot, ttf, svg, woff and woff2 files + CSS snippets
https://gwfh.mranftl.com
MIT License
12.16k stars 430 forks source link

seem woff2 download has no effect #21

Closed noman798 closed 8 years ago

noman798 commented 8 years ago

the woff2 font download has not font effect

majodev commented 8 years ago

? Please provide a clear description for your encountered error + instructions to reproduce it.

TechInterMezzo commented 8 years ago

I've used the tool a couple of days ago, but today there seems to be a problem with some woff2 files. An example is the Oswald font. The file "oswald-v10-latin-300.woff2" is now 5kb smaller (~15kb => ~10kb) and the browser can't render it anymore.

I can't tell, if it's the fault of the tool or Google.

majodev commented 8 years ago

There seems to be an issue with the new UserAgent https://github.com/majodev/google-webfonts-helper/blob/master/server/logic/conf.js#L5

I'm not totally sure what the most compatible way to get the woff2 format currently. I've recently updated it, as the old specified UserAgent no longer returned anything...

For refererence: Old (no longer working): Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/38.0.2125.104 Safari/537.36 New (invalid?): Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36

TechInterMezzo commented 8 years ago

Google seems to deliver latin and latin-ext, even if latin-ext is not requested.

/* latin-ext */
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 300;
  src: local('Oswald Light'), local('Oswald-Light'), url(https://fonts.gstatic.com/s/oswald/v10/l1cOQ90roY9yC7voEhngDBJtnKITppOI_IvcXXDNrsc.woff2) format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 300;
  src: local('Oswald Light'), local('Oswald-Light'), url(https://fonts.gstatic.com/s/oswald/v10/HqHm7BVC_nzzTui2lzQTDVtXRa8TVwTICgirnJhmVJw.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
}

Maybe your tool only fetches the first (and wrong) entry, because it expects only latin?

majodev commented 8 years ago

@TechInterMezzo perfect - big THX for the heads up!

unicode-range parsing (and splitting up woff2 files) is not yet supported by the utility. This must have been the problem. I've exchanged the UserAgent that fetches these woff2 css files from google to an older Firefox Browser (which supports woff2, but not unicode-range).

Please redownload the font files if you have used this tool in the last 2 days.