I accidentally a Font Degooglifier:
https://git.occrp.org/libre/fonts-degooglifier
I was sick and tired of having to manually degooglify fonts, so I made this. Seems to work. Handles both local files and URLs.
Perhaps somebody finds it useful.
Humm... Currently Fonts Degooglifier works by creating a copy of the CSS file and working on that copy.
I am starting to think it should instead create a backup and work on the original.
I wanted to go slow and not break things, but it does seem more intuitive.
Phew! Fonts in 3 @OCCRP projects ungooglified! Easy, since now I have the right tool for the job. ;)
1. Sandcastle property map:
https://cdn.occrp.org/projects/sandcastle/en/index.html
Related investigation:
https://www.occrp.org/en/goldensands/
2. Libre code if anyone wants to make a similar map (also ungooglified now):
https://git.occrp.org/libre/property-map
3. Putin's Circle:
https://cdn.occrp.org/projects/putinandtheproxies/en/
Related investigation:
https://www.occrp.org/en/putinandtheproxies/
(this one does not have a libre code thingy... sorry)
@rysiek Yes, when I put together a privacy-friendly website recently I made sure to embed all the (very nice!) google fonts rather than expose the end-users to google directly ...
@rysiek Something that could be useful:
use hueristics upon the filenames to fix the @font-face rules so they declare the same font family but different font weights, styles, etc.
It always annoys me that Google fonts doesn't declare their @font-face rules properly, in the way that works best for designers and browsers. That they confuse the concepts of font files and font families.
@alcinnz patches welcome!
@giocomai yeah, same here. Happy you find it useful. Suggestions and patches welcome!
@rysiek Very nice! if I understand correctly, I could use it by only passing google's font URLs directly (e.g. If I don't have CSS files because I use some form of CSS preprocessor). Is that right?
@lastfuture well, not really. Currently it only supports CSS files. I am not sure if I get the point of providing the font URL directly -- as in, if it's a *.ttf or *.woff or whatever, then just wget/curl it?
What would be the use-case here?
@rysiek I'm sorry, I worded my question poorly. Will I be able to pass Google's CDN URLs of their CSS directly? e.g. https://fonts.googleapis.com/css?family=Major+Mono+Display&subset=latin-ext
@rysiek I would test this myself but on macOS 10.14.2 for now it aborts with
./degooglify.sh: line 258: ${SOURCE_OF_CSS,,}: bad substitution
with GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
@lastfuture thanks for reporting. Pushed a potential fix, can you test?
For the record, here's the issue:
https://git.occrp.org/libre/fonts-degooglifier/issues/4
@rysiek thank you. It passed the missing bash 4.x feature but failed at the -r option for sed:
@rysiek I checked what -r would do, it seems sed that ships with macOS uses a different syntax. From the man page:
-E Interpret regular expressions as extended (modern) regular expressions rather than basic regular expressions (BRE's). The re_format(7) manual page fully describes both formats.
@rysiek after a quick test I can confirm that if I replace all occurrences of the sed parameter -r with -E in the script, it seems to complete correctly. Does this output look plausible?
@rysiek it did name the CSS file `Major-Mono-Display__subset-latin-ext\n.css` for some reason but other than that the result looks good.
@lastfuture fixed I hope: https://git.occrp.org/libre/fonts-degooglifier/issues/7 :)
Please let me know if all is well now.
And thank you so much for testing and bug reporting!
@rysiek works like a charm now. Thank you for making this helpful tool
@lastfuture yes, yes it does. sed here does support both -E and -r, changed to -E everywhere:
https://git.occrp.org/libre/fonts-degooglifier/issues/6
Please test. It might also fix the `\n` issue.
@rysiek beautiful. It still adds the newline to the file name but that's easy to fix by hand
@lastfuture yes, correct. That's the idea. :)
@rysiek Excuse my ignorance on this but what do you mean by "degooglify fonts" and why is it a good idea to do it?
A pretty popular thing these days is to:
1. go to fonts.google.com
2. select fonts
3. include the generated CSS in a site's CSS (the fonts are then served from Google's servers)
This script makes it easy to automagically download the font files locally onto your server, and modify the CSS files to refer to them, instead of to Google's infrastructure.
@rysiek @fox Ah: That answers a question for me which was "how does this differ from Decentraleyes". Your tool is for actually modifying the server's code to remove Google (Yes x 1000!), Decentraleyes is for Clients to dynamically reroute requests away from Google's CDNs.
I'm glad to see Google's "side channel attacks" getting more attention. Next we need to kill their goddamned DNS..
@rysiek I love to GitHub star, I'll have to find my selfhosted bookmark solution and use it :) thanks for sharing!
@rysiek Good tool. Thanks.
Some fonts convertor/font-face generator:
- https://transfonter.org/
- https://everythingfonts.com/
- https://www.fontsquirrel.com/tools/webfont-generator
@rysiek Good to know: all fonts of Google Fonts are available on one repository on GitHub: https://github.com/google/fonts
@PifyZ yup. But a lot of webdevs will just grab the CSS from fonts.googleapis.com, because it's easier to see and test different scripts etc.
My script is there to simplify moving to self-hosting of fonts that are already being used.
Obviously I would recommend everyone to instead just not embed the fonts from Google Fonts in the first place. So that my script would be useless.
@rysiek Your message have inspire me to make a pull request on Plume project: https://github.com/Plume-org/joinplu.me/pull/16
@PifyZ whoa cool! Happy to inspire people!
I think I need to look into supporting multiple url() stanzas.