Skip to main content

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


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.5.tar.gz (11.0 kB view details)

Uploaded Source

Built Distributions

tensorfont-0.0.5-py3.7.egg (23.5 kB view details)

Uploaded Source

tensorfont-0.0.5-py2.py3-none-any.whl (11.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tensorfont-0.0.5.tar.gz.

File metadata

  • Download URL: tensorfont-0.0.5.tar.gz
  • Upload date:
  • Size: 11.0 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.10

File hashes

Hashes for tensorfont-0.0.5.tar.gz
Algorithm Hash digest
SHA256 643e9d7d1113c722ec945eb2094d1bfef5d97a6b0817e6963278ae62565b7794
MD5 b4120a75cb37758a21db36dc82de3464
BLAKE2b-256 6669f49fc03f6faae1ec099297e319e621a7d78734e2b58431c2cfc0478f18ec

See more details on using hashes here.

File details

Details for the file tensorfont-0.0.5-py3.7.egg.

File metadata

  • Download URL: tensorfont-0.0.5-py3.7.egg
  • Upload date:
  • Size: 23.5 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.10

File hashes

Hashes for tensorfont-0.0.5-py3.7.egg
Algorithm Hash digest
SHA256 fa63294a558a0946e0765da2e518eb26cac0a0172a496baa936c19124f99b4d0
MD5 a52724dd221d613f18737574761a5d66
BLAKE2b-256 2a2b871544995868f676d8fd11dfc4c193ae8777fc94fbb28fe48312224a3d11

See more details on using hashes here.

File details

Details for the file tensorfont-0.0.5-py2.py3-none-any.whl.

File metadata

  • Download URL: tensorfont-0.0.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.2 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.10

File hashes

Hashes for tensorfont-0.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e20e454ccfd1d721651445e14b8e3f77dc8f523956afc5781aee38da6342d739
MD5 5e3daa95538335c4366038b30f0e472a
BLAKE2b-256 54db5a78be202e46cf8b579fdf3a8588ab9038afa8aef914412e2fe505ff43f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page