Skip to main content

mongfontbuilder

The Python library that helps font designers and developers produce a standard-compatible Mongolian script font, as clarified by the documentation of UTN #57, Encoding and Shaping of the Mongolian Script (the Mongolian UTN). It also acts as the reference implementation of that document.

The library is maintained in this project and published to PyPI. To install it in terminal:

pip install mongfontbuilder

The library includes various utilities, including:

  • Python API for the data files.
  • Dynamic generation of OpenType Layout rules.
  • Construction of a complete font from a minimal glyph set.

A CLI is also available — it reads a source UFO font and writes a complete font with the generated OTL rules. Run from the repository root:

uv run python -m mongfontbuilder input.ufo output.ufo --locales MNG

The CLI writes the constructed font as a UFO; compile it to a binary font with ufo2ft if that is what you need. See --help for available locales.

The documentation, the specification data, and the Glyphs templates are maintained in the repository this project belongs to, Kushim-Jiang/mongolian.

Development

The project is developed with uv. It is a member of the uv workspace the repository root declares, so the environment and the lockfile it is developed with are the ones of the repository root, and the commands below are run from there. Set up the environment and install the development tools (pytest, ruff, pyright, uharfbuzz, glyphsLib) with:

uv sync

Tests

The test suite is run with:

uv run pytest

The harness builds each test font on the fly using the package API, shapes the test strings with HarfBuzz, and compares the resulting glyph sequence with the expected output. The tests are organized per writing system, each with its own UFO test font under tests/fonts/ and test cases under src/mongfontbuilder/testSuites/:

  • Hudum (MNG), from tests/fonts/hudum.ufo, is validated against the EAC and core suites (eac-hudum, core-hudum);
  • Manchu (MCH), from tests/fonts/manchu.ufo, is validated against the core suite (core-manchu);
  • Sibe (SIB), from tests/fonts/sibe.ufo, is validated against the core suite (core-sibe).

A font that writes with every writing system at once, from tests/fonts/unified.ufo, is validated against the same cases by tests/test_unified.py; the font it composes and the cases it runs are in tests/unified.py.

tests/corpora/ holds real-world text, which no run reads, for checking the font by eye:

  • nmg-2026-10.md — 500 articles from the Mongolian portal of the Inner Mongolia Autonomous Region Government (mgl.nmg.gov.cn) and its prefectural and departmental sub-sites;
  • mgyxw-2026-10.md — 500 articles from the China Mongolian News Network (mgyxw.cn).

Neither collection contains a private-use character: the articles that carry any are left out.

Test suites

  • core-*.tsv — the core test suite of the Chinese national standard, one file per writing system: core-hudum and core-hudum-ali-gali (Hudum and its Ali Gali), core-todo and core-todo-ali-gali (Todo and its Ali Gali), core-sibe (Sibe), and core-manchu and core-manchu-ali-gali (Manchu and its Ali Gali);
  • eac-hudum.tsv — the EAC test suite, which is settled by the Hudum standard alone, in the form the suite reads it.

Cases the EAC expects differently

The EAC suite is settled by the Hudum standard alone. Where the UTN model disagrees with it, the case is marked as an expected failure — it is kept in the suite, and the reason is kept in tests/fixtures.py — so that the run stays green and the disagreement stays visible.

A font that writes with every writing system at once (test_unified.py) is the one that has to be marked for the cases below: the meeting held that the effect of an FVS does not depend on the locale, so the FVS stays valid and selects its variant wherever the character is shared. A font that writes with one writing system answers them as the EAC expects.

  • MND11-2, MNM10-2, MNM11-2, MNS11-26, MNZ11-3, MNZ21-5, XIM11-11, XIM11-675, XIM11-678, XIM11-681, XIM11-684, XIM11-687, XIM11-690, XIM11-694

XIM11-46 (e n fvs3 mvs e) is answered differently by every font as well, but for a reason of its own: the FVS3 follows the n, and the UTN model draws the form it selects rather than the one the EAC expects.

The cases below are marked for every font, because the UTN model answers them differently from the EAC in a way that does not depend on which writing systems a font carries.

  • XIM11-39, XIM11-40, XIM11-41 — the UTN model keeps the old functionality of NNBSP, so the features of NNBSP stay on.
  • XIM11-1012 — a letter before an MVS is in the final position, so the FVS after it selects the final variant.

Previewing the vertical punctuation

No case of the suites writes punctuation, so the vertical forms of the marks are checked by eye rather than by a run. tests/vertical-punctuation.html sets every mark the font draws a vertical form for in a vertical line, once between two written words and once in a single line of them all. Compose the font first, then serve the project directory so that the browser may load the compiled font:

uv run python tests/build.py --only unified
uv run python -m http.server

Then open http://localhost:8000/tests/vertical-punctuation.html.

Glyphs templates

The Glyphs templates in the repository's templates/ directory are generated from the test UFO fonts and the output of the OTL composer, and are updated from the repository root with:

uv run python templates/update.py

This rewrites hudum.glyphs/hudum.fea and manchu.glyphs/manchu.fea. Template generation is macOS-only (it requires the Glyphs app via glyphsLib), and the corresponding tests in tests/test_templates.py are skipped on other platforms.

Metadata

Release files for mongfontbuilder 0.15.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mongfontbuilder 0.15.4
File Size Uploaded Provenance Actions
mongfontbuilder-0.15.4.tar.gz 110.0 kB With provenance Details for mongfontbuilder-0.15.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mongfontbuilder 0.15.4
File Interpreter ABI Platform Actions
mongfontbuilder-0.15.4-py3-none-any.whl Python 3 none any Details for mongfontbuilder-0.15.4-py3-none-any.whl

Total release size: 228.8 kB

Release files / mongfontbuilder-0.15.4.tar.gz

Download URL mongfontbuilder-0.15.4.tar.gz
Size 110.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a5239a226359319bc3f9e003eeb98754570197475498c3fd59bf716ee6e4b1fd
BLAKE2b-256 checksum
How to use checksums
a21a1583cbf64eb4659c502f70d9eb7ebb7bdbf8f403599ada59432eb6196d7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / mongfontbuilder-0.15.4-py3-none-any.whl

Download URL mongfontbuilder-0.15.4-py3-none-any.whl
Size 118.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28736dec72b1b60c8f6d4698f172a34596f23c3545f9da71b23f5751fb8d6834
BLAKE2b-256 checksum
How to use checksums
bcdac58090289a75950ef5b7f776b169c3efe7b5ef41c84f013ae80593375fd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for mongfontbuilder 0.15.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mongfontbuilder-0.15.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page