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.1.tar.gz (5.0 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.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fontsplitta-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.3.0

File hashes

Hashes for fontsplitta-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d78d73f0381ea7f0c8c0778462a7b1ab266a2bdaa59d9a2f3049f5b57b4d9ec
MD5 adffa3d62a567708f4026330c324d16c
BLAKE2b-256 8fa06dc57a29b75a98049e393b2942b00db27e649d1ecf36b8b47cbacafbd082

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fontsplitta-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.3.0

File hashes

Hashes for fontsplitta-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 774c13c2ac4c86f7244c5b0518236a47cec3322d72ffe6de99d6b19180ef76b4
MD5 073f4683558ad6b070db5002ef3eb067
BLAKE2b-256 335d40bad9c0a92a8f583949e1e1ba39168a21e04e9cae0e19c8f91edce0f942

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