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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fontsplitta-0.1.2.tar.gz.
File metadata
- Download URL: fontsplitta-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b36bb45042e1067e15ece3d4c9404063a486be518e63327a344b9386262bf246
|
|
| MD5 |
dd91d4be850e30a9b796ccfa69a74fcd
|
|
| BLAKE2b-256 |
f7f19fbd35b535a02a1943347b750ce50f93688f26973ba5b5d3de9580520719
|
File details
Details for the file fontsplitta-0.1.2-py3-none-any.whl.
File metadata
- Download URL: fontsplitta-0.1.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8c6e6acdb68e68db77a3319ef551f108ecbd76eca480e302936663b6e817141
|
|
| MD5 |
da669cf3f3e72f18b4ebd13973cec22d
|
|
| BLAKE2b-256 |
fd2013420a4e243f7d448ff4efe4939676766bd9293b3dff2485fc68b911426c
|