▲ | rs186 20 hours ago | |
LOL downvoted. The sentence "self hosting fonts is as easy as making the static font files available and then adding a few lines of CSS" is a complete lie and you could tell they have never gone through the process themselves and were just making things up. If you don't believe me, you are welcome to try it out yourself FROM SCRATCH without any references whatsoever, and see how long it takes you to come up a solution that works on all 5 or 6 platforms, desktop or mobile. | ||
▲ | trnglina 18 hours ago | parent | next [-] | |
Please educate me if I'm missing something! From memory, what I would do is simply download the original ttfs or otfs, run them through woff2 (https://github.com/google/woff2), and then write the @font-face declarations for each weight/style variation. Variable fonts make this even easier, since you can get by with just the one declaration. One could further optimise them for size with fonttools, to do stuff like subsetting by unicode ranges (https://github.com/fonttools/fonttools), but that's quite optional. Unless your font includes CJK, it's probably not that big to begin with. | ||
▲ | alwillis 15 hours ago | parent | prev [-] | |
> The sentence "self hosting fonts is as easy as making the static font files available and then adding a few lines of CSS" is a complete lie and you could tell they have never gone through the process themselves and were just making things up. It's not a lie—I've been doing exactly that as long as Google fonts has been a thing. I think people are confusing what was required in the back in the day when browsers were buggy and supported different font formats--15+ years ago. The technique was called the "bullet proof" @font-face syntax because it "solved" getting web fonts to work across operating systems and devices in the 2010's [1]:
If you weren't doing web development back then, you don't understand what a revelation this syntax was for supporting cross-browser web fonts. There were even websites that would generate the syntax for you. BTW, woff2 didn't exist then.It seems that some developers, like the Japanese soldiers who didn't stop fighting WWII until the 1970's because they didn't know the war ended in 1945 [2], still believe dealing with fonts in 2025 is like it was 15 years ago. It's never been easier to self-host fonts… why make an additional HTTPS request if you don't have to? There are plenty of utilities to compress TrueType or OpenType fonts to WOFF2. [1]: https://www.paulirish.com/2009/bulletproof-font-face-impleme... |