Skip to main content

fontsplitta is a command-line tool that splits web fonts and generates CSS.

Project description

fontsplitta

fontsplitta is a command-line tool that splits web fonts and generates CSS.

It creates web fonts that are divided into specific Unicode ranges, similar to Google Fonts.

By properly splitting large fonts such as Japanese fonts, it aims to reduce transfer size and improve user experience.

Requirements

  • Python 3

Getting Started

Install from PyPI:

pip install fontsplitta

Generate unicode_ranges.txt using Google Fonts' CSS:

fontsplitta get-unicode-ranges-from-google-fonts

Split fonts and generate CSS:

fontsplitta split FONT_FILE

Using a custom CSS template file

If you want to modify the output CSS, you can create a new font-face.css.template file:

@font-face {
  font-family: "${font_family}";
  font-style: ${font_style};
  font-weight: ${font_weight};
  src: url(http://localhost:8080/output/${font_filename}) format("${font_format}");
  unicode-range: ${unicode_range};
}

Basically, you should use your environment's hostname in the src section.

And then,

fontsplitta split FONT_FILE --css_template=YOUR_CSS_TEMPLATE

Using custom unicode ranges

If you want to use custom unicode ranges, you can use the --unicode_ranges_file option:

fontsplitta split FONT_FILE --unicode_ranges_file=YOUR_UNICODE_RANGES_FILE

You can generate the unicode ranges using your web page contents.

Test with local web server

fontsplitta test-server

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

fontsplitta-0.1.4.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fontsplitta-0.1.4-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file fontsplitta-0.1.4.tar.gz.

File metadata

  • Download URL: fontsplitta-0.1.4.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.9 Linux/6.8.0-1021-azure

File hashes

Hashes for fontsplitta-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2ae8fb5b41eae0df9b5e0a5f49c23656329e846d10a82d494efbee145b0cdf29
MD5 5b216c1f21b1e0a954f2632fd6c0f4cb
BLAKE2b-256 ad571113587d9080121f93ea74a21a3fcc52a4a96b909ad875de0dc58b2101b9

See more details on using hashes here.

File details

Details for the file fontsplitta-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: fontsplitta-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.11.9 Linux/6.8.0-1021-azure

File hashes

Hashes for fontsplitta-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 94f77ea1ceb64ecd497fbf427a31b58ddaa6e4b93d2093d1b545e21e6f90436d
MD5 8c1a80644be4bcc40327ca3452b999e8
BLAKE2b-256 b834033f5c56123aabfbd720bb608aa06ebd974de77aed8f8717c7e7b676417f

See more details on using hashes here.

Supported by

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