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.02k stars 420 forks source link

WOFF2-only CSS option #162

Closed Timmmm closed 1 year ago

Timmmm commented 1 year ago

"Modern browsers" includes WOFF even though global support for WOFF2 is 97%. Given that they're only fonts and it's hardly a disaster if they don't load, I think that option should ditch WOFF and have WOFF2 only.

Timmmm commented 1 year ago

"Modern browsers" also shouldn't include local('') which is apparently for IE6-8 and can break Android: #84

majodev commented 1 year ago

v1.1.0 removeslocal(''). However, for sanity I'll keep .woff in for now.

Timmmm commented 1 year ago

Nice. What do you mean "for sanity"?

thestinger commented 1 year ago

Internet Explorer 11 isn't supported anymore so I really don't think including woff is needed for a modern browser option.

https://caniuse.com/?search=woff

gitressa commented 1 year ago

I would also prefer it, if there were a .woff2-only option. I usually remove .woff-files to reduce complexity and size, and just use .woff2.

Example, with 12 Roboto fonts:

Versions Files Size
.woff + .woff2 24 453,5 kB
.woff2 12 198,6 kB
Rotzbua commented 1 year ago

The support modes should be renamed to reflect the current state of technology:

Old label New label Format
- Modern Browser woff2
Modern Browser Best Support woff2 + woff
Best Support Legacy Support woff2 + woff + ttf + svg + eot
thestinger commented 1 year ago

IE11 is no longer supported and is disabled automatically on up-to-date Windows. IE11 has woff1 support and was the oldest browser nearly anyone was interested in supporting. I don't see much of a reason to have anything but woff2. Sites are meant to work without the web fonts being loaded anyway. There are many reasons for modern sites not working in IE11 and not having the right fonts isn't a major issue.

Rotzbua commented 1 year ago

I have reconsidered my previous suggestion and think the term "best" does not reflect the development status and is very subjective. I think the terms "legacy" and "historic" support are more accurate.

For legacy support, as before suggest, the most obvious format would be woff. Taking the CanIUse's percentages into account, ttf seems a better candidate. ttf supports more browsers and the uncompressed source form of woff(2). If necessary the compression can be applied by http transport compression gzip if a legacy browsers has support.

Adding the percentages of OperaMini (does not support any custom font) current global usage is:

Format % caniuse
woff2 98,15 link
woff 99,62 link
ttf 99,80 link

In summary my updated suggestion would be:

Old label New label Format
- Modern Browser woff2
Modern Browser Legacy Support woff2 + ttf
Best Support Historic Support woff2 + ttf + woff + svg + eot

And the website would look like:

fonts

gitressa commented 1 year ago

Perfect, thanks @Rotzbua and @majodev!