autobase

Crates.ioautobase
lib.rsautobase
version0.1.0
created_at2025-09-23 09:48:56.413997+00
updated_at2025-09-23 09:48:56.413997+00
descriptionAutomatically generate BASE tables for OpenType fonts
homepage
repositoryhttps://github.com/simoncozens/autobase
max_upload_size
id1851244
size185,854
Simon Cozens (simoncozens)

documentation

README

Autobase

This is a utility for generating BASE tables for OpenType fonts.

It has two modes:

  1. If the font contains CJK glyphs, it generates a BASE table as per the CJK Vertical Metrics requirements of Google Fonts.

  2. Otherwise, it uses the fontheight library to analyze the highest and lowest coordinates of shaped strings in the various scripts supported by the font, and generates script specific MinMax tables to allow user agents to alter text vertical metrics based on the script in use.

Configuring the MinMax tables

autobase can be configured by passing a TOML configuration file to the -c argument. This TOML file can have the following keys:

  • languages is a list of script-language combinations to be split out of the main calculation and handled separately.
  • overrides is a dictionary of min and/or max values to be manually set for a particular script-language combination.

In both cases, script-language combinations are specified as yyy_Xxxx where yyy is a valid ISO639-1 or ISO639-3 language code and Xxxx is a valid ISO 15924 four-letter script code.

An example will make this clear. The following config file:

languages=["vi_Latn"]
[override]
fi_Latn = { max = 1234 }

with a font which supports Latin and Cyrillic will create:

  • A default language system MinMax table for Cyrl based on values measured when shaping the Cyrillic word lists.
  • A language system entry for Finnish with the max value set to 1234 and the min value automatically computed from the Finnish word list.
  • A language system entry for Vietnamese with max and min values automatically computed.
  • A default MinMax table for Latn based on shaping all Latin wordlists except Finnish and Vietnamese words.
Commit count: 33

cargo fmt