Project description
A tool to split/segment a TTF file into multiple WOFF2 files based on Unicode character ranges, and generate a CSS file that describes that font face as an aggregate of those WOFF2 files.
Installation
pip install ttf2web
Usage
ttf2web /path/to/font-file.ttf
This will split font-file.ttf based on a set of pre-defined Unicode ranges, and create (in the working directory) font-file.css and a directory named assets containing the WOFF2 files.
Here’s a demo of a more complete example:
$ ls
Raleway-Regular.ttf unicode-ranges
$ cat unicode-ranges
greek U+0370-03FF
greek-ext U+1F00-1FFF
latin U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC
latin-ext U+0100-024F,U+0259,U+1E00-1EFF,U+20A0-20CF,U+2C60-2C7F,U+A720-A7FF
$ ttf2web -v --unicode-ranges unicode-ranges Raleway-Regular.ttf
Processing greek
Generated assets/Raleway-Regular.greek.woff2
Found 1 glyphs for 1 out of 144 unicodes
Processing greek-ext
Found no glyphs for any of 256 unicodes
Processing latin
Generated assets/Raleway-Regular.latin.woff2
Found 202 glyphs for 197 out of 264 unicodes
Processing latin-ext
Generated assets/Raleway-Regular.latin-ext.woff2
Found 157 glyphs for 157 out of 897 unicodes
Generated Raleway-Regular.css
$ ls
assets Raleway-Regular.css Raleway-Regular.ttf unicode-ranges
$ head -n 12 Raleway-Regular.css
@font-face {
font-family: "Raleway";
font-style: normal;
font-weight: 400;
src: local("Raleway"), url(assets/Raleway-Regular.greek.woff2) format("woff2");
unicode-range: U+0370-03FF;
}
@font-face {
font-family: "Raleway";
font-style: normal;
font-weight: 400;
src: local("Raleway"), url(assets/Raleway-Regular.latin.woff2) format("woff2");
LICENSE
MIT
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.
File details
Details for the file ttf2web-0.9.3.tar.gz.
File metadata
- Download URL: ttf2web-0.9.3.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
034ed2c00ad663a8f57625e13de6398b9feeafd71e19a03295de431f9ee93748
|
|
| MD5 |
ef47f6d781fbed38780259cb1f2cab10
|
|
| BLAKE2b-256 |
e0ec85ae893c464f829a1dd96b14ecfa07a4fe5a7c3d55df5f2f5f2b66d832fd
|
File details
Details for the file ttf2web-0.9.3-py3-none-any.whl.
File metadata
- Download URL: ttf2web-0.9.3-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9627871131c94c738c0ca59c82db2d81cb3a0fbcb1bffc8c6e85c35a3b252eb4
|
|
| MD5 |
1c283eb8bff3ef177e3e1ead641cb261
|
|
| BLAKE2b-256 |
d4cfd3484d9714076d7903b28ff70a2164c87184cb74d2901a7fb50e1e80a149
|