Skip to main content

A cli tool to dump the CSS and different formats offonts for Google Fonts

Project description

A command line tool to dump the CSS and different formats of fonts for Google Fonts, so you can serve them on your local servers.

Usage

$ fontdump -h
fontdump heps you dump google web fonts.
  __            _      _
 / _|          | |    | |
| |_ ___  _ __ | |_ __| |_   _ _ __ ___  _ __
|  _/ _ \| '_ \| __/ _` | | | | '_ ` _ \| '_ \
| || (_) | | | | || (_| | |_| | | | | | | |_) |
|_| \___/|_| |_|\__\__,_|\__,_|_| |_| |_| .__/
                                        | |
                                        |_|
Usage:
  fontdump <google-fonts-url> [--font-dir-path=<path>]
  fontdump (-h | --help)

Options:
  -h --help                 Show this screen.
  --font-dir-path=<path>    Path to the font dir(ends with /).
                            e.g('staic/fonts/', 'http://cdn/.../fonts/')
  --output=<dir>            The directory saves the dumped css and font files

FAQs

Question: What’s wrong with Google Fonts? Why do I want to serve the fonts on my own server?

Answer: Google Fonts is Great. You shall use it normally. But for users in some countries, Google Fonts is very slow and sometimes even inaccessible. Serving your own fonts is the only choice for them. Besides, some developers may wish to have more control over web fonts. They might want to embed fonts as base64 strings into the css to bypass crazy firewalls. They might to store the fonts as jsons to the localstorage to speed up page loading.

Question: Why do I need to install a software to download these fonts? Can’t I just open the Chrome developer tools and download the css and fonts manually?

Answer: Making css font rules compatible with different browsers is not easy. Thus Google detects the browser’s User Agent string and serve the css that is only compatible with the given browser.

As a web developer/designer, it is very likely that you are using a modern browser, so the css you get from Google only works in modern browsers. To improve the user experience for old browser users , we need to download the 4 differnet formats of fonts and merge the css rules into a single stylesheet. A tool can simplify the process.

Question: What would the merged css look like?

Answer:

like this:

@font-face {
  font-family: 'WebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: local('WebFont'),
       url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff') format('woff'), /* Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

Reference:

Using @font-face

Bulletproof @font-face Syntax

WEBFONT GENERATOR

Avoiding Faux Weights And Styles With Google Web Fonts

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fontdump-1.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

fontdump-1.2.0-py2.py3-none-any.whl (8.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fontdump-1.2.0.tar.gz.

File metadata

  • Download URL: fontdump-1.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fontdump-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e51c0c21bae995e680f4fe1fd5a3a894d80de74d9e2fbb7b2f7b47a2f9c9b4ea
MD5 c94b3226080dfe664707312a292f8398
BLAKE2b-256 e9a988e4c7c5ed869abd05742e3abe0e190f6526b028ea6a50ed9a498a1f97b3

See more details on using hashes here.

File details

Details for the file fontdump-1.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fontdump-1.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fbe7bfd6de908583583248b39d2318686d10a7c145af207c019707edae49a02b
MD5 66b44583db6cc3ae331f6c3a6423b30f
BLAKE2b-256 342971eb6c3a74bd2e21306a4f8627d6488aba3f16c2a1958f64d87c41d3d700

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page