Turn font glyphs into numpy arrays
Project description
Tensorfont is a library to help those performing numerical analysis of font data, particular with reference to letterfitting and spacing.
Here is an example session:
>>> from tensorfont import Font >>> f = Font("../atospace/kern-dump/normal/MrsEavesOT-Bold.otf") >>> f.m_width 828.0 >>> f.baseline_ratio 0.28835063437139563 >>> f.pair_distance("A","V") -149 >>> f.pair_kerning("A","V") -73 >>> f.glyph("G").lsb 71 >>> m = f.glyph("G").as_matrix() .with_sidebearings() .crop_descender() .scale_to_height(50) >>> m.left_contour() array([25, 22, 20, 18, 16, 15, 14, 13, 12, 11, 10, 10, 9, 9, 8, 8, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 9, 10, 10, 11, 12, 13, 13, 15, 16, 17, 19, 21]) >>> plt.imgshow(m) ; plt.show() # The letter "G" is shown
Full documentation is available at https://simoncozens.github.io/tensorfont/index.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tensorfont-0.0.7.tar.gz
(8.2 kB
view details)
Built Distribution
File details
Details for the file tensorfont-0.0.7.tar.gz
.
File metadata
- Download URL: tensorfont-0.0.7.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/18.5 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48461ef18330915971d146ff1ef4d4f94fc86e045754f3591fbeb479f51ff2e8 |
|
MD5 | bd191ab5049001494dcf5026bcacd12f |
|
BLAKE2b-256 | 8efbe761b0c792e9bcf73e650b507ea24b4e14ded7d81c8fbc1d1c41bb25c4cf |
File details
Details for the file tensorfont-0.0.7-py2.py3-none-any.whl
.
File metadata
- Download URL: tensorfont-0.0.7-py2.py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/18.5 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8561bcdd92e30ddb1126a6f569e78dc5fa84eea3543a0620f59ab4873bdcae68 |
|
MD5 | 5aef845e7516fabe89959cb26b5becf8 |
|
BLAKE2b-256 | ff171ffea82a630a7ce55114c759a7a24e832dc181d9c22fbf255685926786ba |