Download Google font and use it in offline html
Steps required
- find your beloved font at google fonts.
- select all font styles that you might want to have.
- find its’ url ex:
https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&display=swap, which will be inTo embed a font, copy the code into the <head> of your html/<link> - open it in the browser and convert it to
example.css - make a directory “fonts” ex:
mkdir fonts - make a
main.pyin same directory. - paste the automate python code in it.
- comfirm that this directory has three object:
-
main.py - empty directory
fonts -
example.css
-
- run the python code
python main.py - embed
example.cssin your html file
main.py
1 | import requests |
credit: duydb, Wytamma Wirth and me who modified it to the better