Skip to main content

Converts fonts to TypeScript objects

Project description

TypeScript Font Converter

Converts fonts to TypeScript objects

This library:

  • Imports OpenType and TrueType fonts
  • Extracts metadata from the naming table
  • Extracts a list of glyphs and their unicode character ID
  • Encodes the font file as a base64-encoded DataURI
  • Saves all this in Python objects
  • Serializes the Python Objects in a JSON file
  • Exports TypeScript definitions of the objects

But Why?

This library exists to embed fonts into web pages using SSR-frameworks such as Next.js and to more easily gain information about the font.

It was initially part of the ThorType website where I use the TypeScript definition and the corresponding JSON-data to showcase my fonts and save all of that data as part of a static website.

It's released as a Python lib so that the tooling for the ThorType-website is separated and generalised to be reused in any TypeScript or JavaScript web framework.

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

tsfontconverter-0.35.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

tsfontconverter-0.35-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file tsfontconverter-0.35.tar.gz.

File metadata

  • Download URL: tsfontconverter-0.35.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for tsfontconverter-0.35.tar.gz
Algorithm Hash digest
SHA256 c22a5d3b5052bc9a83d57e7ce3ffd1bc79da6447d2fd821daee66be88a28803c
MD5 c8deb84e5e85d8a11c3a1f041f891d21
BLAKE2b-256 e6e60dc83c1918a8b46e82133caf0add82e7002cf3cb48635fbe59aeef6f1db8

See more details on using hashes here.

File details

Details for the file tsfontconverter-0.35-py3-none-any.whl.

File metadata

File hashes

Hashes for tsfontconverter-0.35-py3-none-any.whl
Algorithm Hash digest
SHA256 f2033325945b820a68e8c869c841e241fd8d2fa4eceedeb23a9ee55e5405bbed
MD5 abd00bbe93f63913e14c6a34f993fd6a
BLAKE2b-256 0302e61fabb0dd9014461fbb38b3b17227d1dc0718ce2ebacbdfffb0da60825f

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