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

Uploaded Source

Built Distributions

tensorfont-0.0.3-py3.7.egg (19.8 kB view details)

Uploaded Source

tensorfont-0.0.3-py2.py3-none-any.whl (9.6 kB view details)

Uploaded Python 2 Python 3

tensorfont-0.0.3-py2.7.egg (20.2 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: tensorfont-0.0.3.tar.gz
  • Upload date:
  • Size: 9.6 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.3.tar.gz
Algorithm Hash digest
SHA256 fa8b9634aa28a6f397083689a8f3db5ab2ee57a33a70f38e50bfa274645b7df0
MD5 c99682b879892657458bf350ace99882
BLAKE2b-256 473b64f2cad24ad1072fe5fd023b5a21b7924c4924348d2567c4d28635ed6774

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tensorfont-0.0.3-py3.7.egg
  • Upload date:
  • Size: 19.8 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.3-py3.7.egg
Algorithm Hash digest
SHA256 88f71abadc9bf4035925e3dc6f3c25acace5cc639647ddd7e9c988dca1a07204
MD5 f0704a7a64bb1ee51c45ca2aecca1f23
BLAKE2b-256 2f2bf03228f3693cb892d760b75c238efb45348119a1c5ec38edfb88d1099c9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tensorfont-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.6 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.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6fb7cdeb7fcf7b23370696ee8aab8c9eea76922614d721d5035784c0c24c67e8
MD5 5590b451afae863067dcc28f4ac2e88a
BLAKE2b-256 5c68db00b9fb906c0180283ef7d30ff2c55fcc40ff7422284be905bd04c89cfc

See more details on using hashes here.

File details

Details for the file tensorfont-0.0.3-py2.7.egg.

File metadata

  • Download URL: tensorfont-0.0.3-py2.7.egg
  • Upload date:
  • Size: 20.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.10

File hashes

Hashes for tensorfont-0.0.3-py2.7.egg
Algorithm Hash digest
SHA256 628ed20e140ec83cdd21e4d24c6358d87e429271ec57f73c677dd642a096a2b0
MD5 b1edf7e1e68531c0f3647b68659df772
BLAKE2b-256 9992bd054cb7462c03b6d13eff860fe80f4d2165b2b25c11f13fbaae573a28b7

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