Skip to content
/ gfont Public

Browse and install google fonts using terminal

License

Notifications You must be signed in to change notification settings

nureon22/gfont

Repository files navigation

Browse and install google fonts using terminal

⚠️ Warning: this project is still in development and doesn't support the Windows yet

Note: If you encounter some errors, clean cache files described at the end of the page.

Google Fonts API

By default, gfont doesn't need google font API key, instead it uses generated data/webfonts.json. This generated file won't be refreshed very often and contains older fonts. If you want more up-to-date fonts, add 'GOOGLE_FONTS_API_KEY' environment variable inside ~/.bashrc or ~/.profile.

See Google Fonts Developer API to generate your API key.

Installation

Note: For linux, pipx is recommended instead of pip

Using pip

pip install "git+https://github.com/nureon22/gfont.git"

Using pipx

pipx install "git+https://github.com/nureon22/gfont.git"

Requirements

  • python 3.8 or newer
  • python-venv
  • git

Runtime Dependencies

  • requests

Development Dependencies

  • hatch (development)

Usages

All commands support case-insensitive family names.
You can also use underscore (_) or dash (-) or plus (+) instead of space character in family name.

Search

Search available families

gfont search noto sans

Install

Install one or more families

gfont install noto-sans

Remove

Remove one or more families

gfont remove noto-sans

Info

View overview information of the family

gfont info noto-sans

List

List installed families

gfont list

Update

Update installed families to latest version

gfont update

Webfont

Pack woff2 fonts and it's css to be used as self-hosted fonts in websites.
Don't forget to use single or double quotes for safety.

gfont webfont "noto-sans" --dir <dir>
gfont webfont "noto-sans:ital,wght@0,400;0,700" --dir <dir>
gfont webfont "open-sans:ital,wght@0,300..700" --dir <dir>

Tricks

Install search results

gfont install $(gfont search noto sans | sed 's/ /_/g')

For mor information

gfont <command> --help

Related directories

Directory for cached metadata of families

Linux: ~/.cache/gfont
Mac: ~/Library/Caches/gfont

Directory for installed fonts

Linux: ~/.local/share/fonts/gfont
Mac: ~/Library/Fonts/gfont

About

Browse and install google fonts using terminal

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages