Skip to content

Strip TrueType hinting from Khmer OS, Ayar and MPH 2B Damase (v6) - #854

Merged
jakejackson1 merged 1 commit into
gravitypdf-v6from
chore/dehint-more-fonts-v6
Nov 5, 2026
Merged

jakejackson1 merged 1 commit into
gravitypdf-v6from
chore/dehint-more-fonts-v6

Conversation

@gravitypdf-bot

Copy link
Copy Markdown

Summary

Follows #850. Khmer OS, Ayar and MPH 2B Damase were left hinted because their licences looked unclear on this branch, but the licence files on gravitypdf allow the change. This strips them, taking 514,372 bytes (35.5%) off those three files, and the files now match #853 byte for byte.

  • Removes the hinting tables and glyph instructions from KhmerOS.ttf, ayar.ttf and damase_v.2.ttf.
  • Adds them to utils/dehint_fonts.py and drops Khmer OS from its Reserved Font Name list.
  • Updates the size in their three ranges files.

Check before merging: the licence reading for Khmer OS below. ttfonts/KhmerOFL.txt is still in the repo and reserves the name "Khmer".

Try it

Rebuilds the fonts and ranges from the script. The tree should stay clean.

V=$(mktemp -d)
python3 -m venv "$V/fonttools" && "$V/fonttools/bin/pip" install fonttools==4.68.0
"$V/fonttools/bin/python" -I utils/dehint_fonts.py
composer ranges:update
git status --short

Test plan

  • CI is green
  • The licence reading for Khmer OS and Ayar is acceptable
  • Khmer text looks right in Acrobat and a browser viewer, which haven't been tested
More info

Licences

Font Evidence Reading
Khmer OS The font's name table and the LICENSE.txt in gravitypdf's package say LGPL 2.1, with a trademark notice. ttfonts/KhmerOFL.txt here is an OFL text dated 2010 reserving the name "Khmer". This file is version 3.01 from 2005 and states LGPL itself, so I read the OFL text as belonging to a different font. That's an inference, and it's why #850 excluded this font.
Ayar gravitypdf's package has an OFL 1.1 licence for it with no Reserved Font Name. Its name table says "All rights reserved", and this branch has no licence text for it. Modification is allowed, relying on that licence file. The font file is byte-identical on both branches.
MPH 2B Damase The name table and gravitypdf's licence file both say public domain. Modification is allowed.

Sizes

Font Before After
KhmerOS.ttf 265,988 129,088
ayar.ttf 282,664 176,456
damase_v.2.ttf 900,260 628,996

Verification

fontTools 4.68.0, poppler pdftoppm, PHP 8.5.12 on macOS.

Check Result
Outlines, glyph order, advance widths, character maps Identical in all 3
Other tables Byte-identical apart from the removed tables, glyf, loca, head and maxp
Hinting left None
Files compared with #853's Byte-identical
Poppler at 72, 150 and 300 dpi, 300 sampled glyphs with useOTL off Pixel-identical on all 3
vendor/bin/phpunit --no-coverage 1189 tests, 1 skipped
Each snapshot test file on its own All 22 pass

Complex-script shaping isn't covered by the pixel comparison, though GSUB and GPOS are unchanged.

mpdf-core-fonts

v1.1.0 still has these three files hinted, with the old sizes. A site downloading them from there while using this branch's ranges files can log the ranges size warning when one is used as a backup font. The ranges are the same, so the warning would be noise. Matching them needs a new mpdf-core-fonts tag, which this PR doesn't do.

The existing CHANGELOG.md entry from #850 already describes this, so it's unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jakejackson1
jakejackson1 merged commit 0c6322c into gravitypdf-v6 Nov 5, 2026
29 checks passed
@jakejackson1
jakejackson1 deleted the chore/dehint-more-fonts-v6 branch November 5, 2026 02:51
jakejackson1 pushed a commit to GravityPDF/mpdf-core-fonts that referenced this pull request Nov 5, 2026
Copies the 3 fonts dehinted in GravityPDF/mpdf#854 byte for byte from commit
5ff0751c, so each git blob and size matches the fork's ttfonts/. Outlines,
metrics and character maps are unchanged; this removes 514,372 bytes (35.5%)
from those files.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants