ttf2json
This Python library allows you to convert .ttf font files into JSON format compatible with Three.js. It can be used via the command line or imported as a module in your Python code.
Installation
You can install the package using pip:
pip install ttf2json
How to use
use via command line
-
Provide the font file path "ttf_file" and the output json file path "json_file".
python3 -m ttf2json --ttf_file ./msyh.ttf --json_file ./msyh.json
-
The "words" parameter can be optionally provided to convert only the necessary text and simplify the output json file.
python3 -m ttf2json --ttf_file ./msyh.ttf --json_file ./msyh.json --words abcdefg
-
The "words_from_file" parameter can be optionally provided to obtain the text to be converted from a file. When both the "words" parameter and the "words_from_file" parameter are provided, the "words_from_file" parameter will be ignored.
python3 -m ttf2json --ttf_file ./msyh.ttf --json_file ./msyh.json --words_from_file ./words.txt
imported as moudle
from ttf2json import TTF2JSON
ttf2json = TTF2JSON("/path/to/ttf/file")
ttf2json.convert2json("words")
ttf2json.dump2json("/path/to/json/file")
Metadata
Release files for ttf2json 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ttf2json-0.0.1.tar.gz | 553.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ttf2json-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 560.4 kB
Release files / ttf2json-0.0.1.tar.gz
| Download URL | ttf2json-0.0.1.tar.gz |
|---|---|
| Size | 553.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a1c3fe5aecea3683c7639e5487bfffd081c50442fd9e34eabcafbb082492684
|
|
BLAKE2b-256 checksum How to use checksums |
2077172a07ed1093016501550a4f8e4c94789af7dc3d80a7b00f818a63eb7aa5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / ttf2json-0.0.1-py3-none-any.whl
| Download URL | ttf2json-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7668691280389de4b472c73c3c7025cde749bf009564723f4f003f75a7a79a3
|
|
BLAKE2b-256 checksum How to use checksums |
32486b5168b4b2d7a9d2b79371a2327ee5937684f6c81411d6a71ae804c831ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|