Repository navigation
fonts: bundle the typewriter metrics and outlines \texttt needs - #183
Conversation
`apps/mac/Fonts` carried no typewriter design at all: no ectt/ecst/ecit/ectc
under jknappen/ec, no ec-lmtt* under public/lm, no lmmono*.otf. The tables in
crates/render-pipeline/src/fonts.rs ask for exactly those files
(`ec_tfm_file` -> ectt/ecst/ecit/ectc, `latin_modern_outline` -> lmmono*,
`latin_modern_tfm` -> ec-lmtt*), so every \texttt/\ttfamily/verbatim run
against the bundle fell back to roman: `ec_metrics_unavailable` (roman ec-lmr*
widths, which move the line breaks) plus `font_outline_substituted`. The
fallback was reported but easy to miss, and typewriter geometry had already
been measured on it.
64 files added, all out of the two upstream packages this tree already
vendors, so no new licence applies and no new licence file is needed:
* jknappen/ec: {ectt,ecst,ecit,ectc}{0800..3583}.tfm -- 44 files, the four
shapes t1cmtt.fd declares at its 11 distinct sizes. It writes
<5><6><7><8>#50800, so 5/6/7 pt load the 8 pt file, and bx/n and bx/it are
ssub*cmtt/m/n and m/it -- there is no bold EC typewriter file to add.
Covered by doc/fonts/ec/copyrite.txt, already here.
* public/lm: ec-lm{tt8,tt9,tt10,tt12,tti10,tto10,tcsc10,tcso10,tk10,tko10}.tfm
-- 10 files, the metrics t1lmtt.fd loads. GUST Font License, already here.
* Fonts/: lmmono{8,9,10,12}-regular, lmmono10-italic, lmmonoslant10-regular,
lmmonocaps10-{regular,oblique}, lmmonolt10-{bold,boldoblique} -- 10
outlines, 669 KB, every file latin_modern_outline returns for
FamilyKind::Tt. Same Latin Modern release as the 21 lmroman* faces here.
Provenance: the earlier tiers were copied from MacTeX 2026 on mac-m1max-a.
This host is linux-primary, which has TeX Live 2025 r78234 and no MacTeX, so
release identity was measured rather than asserted -- every file already
vendored from these two packages is byte-identical (cmp) between the two
distributions: all 70 jknappen/ec TFMs, all 28 public/lm TFMs, all 21 Latin
Modern OTFs, all 6 amsfonts/symbols TFMs. The typewriter members were copied
from the same two directories in the same run and hashed before and after the
copy. No CTAN archive is present here, so no archive hash is claimed; the
sidecars' `limitation` fields say so.
Both in-repo pins were extended the same way the roman tiers are pinned --
SUPPLEMENTARY-METRICS.json 101 -> 155 entries with a `tt_provenance` block,
SUPPLEMENTARY-FACES.json 20 -> 30 with a `mono_provenance` block -- so
`bundle-texmf.py check` and `make-app.sh` verify them and refuse drift.
`bundle-texmf.py check Fonts/texmf Fonts`: 194 entries, all verified, none
unpinned.
crates/render-pipeline/tests/bundled_typewriter.rs is the guard. It walks
every \ttfamily shape through nfss::select/nfss::terminal in all four schemes
(OT1/T1 x cm/lm) -- so an undeclared shape such as bold small-caps typewriter,
which LaTeX substitutes before loading a font, is not mistaken for a bundle
gap -- asserts every file the tables can then name is on disk and pinned, and
renders four \texttt documents asserting zero font_unavailable /
required_metrics_unavailable / ec_metrics_unavailable /
font_outline_substituted diagnostics. It reads no FLASHTEX_* variable, so it
behaves the same with and without the packaging environment.
Measured on this checkout (flashtex-render + flashtex-compiler, release):
* real-world corpus (10 fixtures, tools/real-world-corpus/run.py, bundled
font dirs passed explicitly): font-substitution diagnostics 6 -> 0
(article-twocolumn 4 -> 0, input-bibliography 2 -> 0); total diagnostics
210 -> 204; every fixture's status and page count unchanged.
* amsmath oracle corpus: 59/59 within 0.5 bp, before and after.
* crates/render-pipeline `cargo test --release` with no FLASHTEX_* exports:
174 passed, 0 failed, 1 ignored (was 170/0/1; the four new ones are this
file).
Still not vendored, and still silently substituting: sans
(ecss/ecsi/ecsx/ecso, lmsans*, lmsansdemicond*) and the roman
caps/slanted/demi/unslanted designs (eccc/ecui/ecsc/ecrb/ecxc/ecoc,
lmromanslant*, lmromancaps*, lmromandemi*, lmromanunsl*). Same shape of
problem, not fixed here; recorded in apps/mac/Fonts/README.md.
The Swift counts in BundledMetricsTests/BundledFacesTests were updated to
match (155 metric entries, 30 supplementary faces, 33 requestable faces) but
could not be run here -- XCTest needs macOS.
Implementation-Agent: engine-engineer (linux-primary, NixOS PC)
Commit-Executor: engine-engineer via git (Cursor usage limit fallback)
Co-authored-by: GoKubar <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
Adding the files is only half of it: they also have to be reachable by the
reader that demands them. This adds the missing case to the guard, and
records what was actually measured, because the claim going round -- that
FLASHTEX_TFM_DIRS does not feed the rooted required-metrics reader -- is not
what the code does.
`FontSet::texmf_roots` (fonts.rs) derives a texmf root from any
FLASHTEX_TFM_DIRS entry by stripping the `fonts/tfm/public/lm` suffix, and
`required_metrics` tries those roots first and then every TFM directory as a
flat root. So the environment route does reach the rooted reader -- but only
when the entry is spelled `<root>/fonts/tfm/public/lm` (or is a flat
directory holding the four required TFMs next to GUST-FONT-LICENSE.TXT).
Pointing the variable at `apps/mac/Fonts` itself yields no derivable root and
no flat root, and everything falls back. That spelling, not a missing code
path, is the whole 0/59-vs-59/59 difference on the amsmath corpus.
Measured here with this checkout's flashtex-render, one \texttt + math
document, counting font_unavailable / required_metrics_unavailable /
ec_metrics_unavailable / font_outline_substituted / tfm_missing /
math_font_unavailable:
PASS FLASHTEX_TFM_DIRS = the three rooted metric directories
FAIL FLASHTEX_TFM_DIRS = apps/mac/Fonts (5 diagnostics; the trap)
PASS <exe>/../Resources/{texmf,Fonts}, no FLASHTEX_* (app bundle)
PASS <exe>/texmf + <exe>/Fonts, no FLASHTEX_* (tarball)
And on the rooted route specifically, before vs after this branch's font
files, `<exe>/texmf + <exe>/Fonts` with no FLASHTEX_* at all:
FAIL HEAD: 2 diagnostics (lmmono12-regular.otf not found;
ectt1200.tfm not found, ec-lmr12.tfm used)
PASS this branch: 0 diagnostics
So the packaging layout was already correct for the required 12 pt metrics on
both rooted paths; what it could not do was answer a \texttt request, because
no typewriter file existed to answer it with. No packaging change is needed.
`the_bundled_typewriter_files_are_reachable_by_every_discovery_route` stages
both bundle layouts in a temp directory, builds the FontSet through
`FontSet::from_discovery` with `exe_dir` pointed at the staged binary
directory (no FLASHTEX_* read), renders the four probe documents through each
and asserts zero substitution diagnostics -- and asserts that the
apps/mac/Fonts-as-TFM-dir spelling still FAILS `required_metrics`, so the
trap cannot quietly start passing.
crates/render-pipeline `cargo test --release --test bundled_typewriter`:
5 passed, 0 failed.
Implementation-Agent: engine-engineer (linux-primary, NixOS PC)
Commit-Executor: engine-engineer via git (Cursor usage limit fallback)
Co-authored-by: GoKubar <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
Follow-up: the rooted discovery path, and a control-compared test matrixTwo points were raised against this PR. Both are now measured rather than argued. 1. " Measured with this checkout's
And on the rooted route specifically, before vs after this branch's font files (
So the packaging layout was already correct for the required 12 pt metrics on both rooted paths. What it could not do was answer a 2. "
The failing sets are byte-identical across all three ( They are also not product bugs. They are tests that deliberately build a partial-font control and are contaminated by a global font environment, because
Neither font mode is "the" number on its own, and the durable fix is for those 8 to construct their |
Fixes the three pre-existing fidelity failures (font_family_fixtures, footnotes_against_pdflatex, page_frame_against_pdflatex) by bundling the tier the renderer already maps to. Provenance by byte-comparison against pinned files (#183 method). Commander-approved for the v0.1.2 release sequence.
Based on main
89e49fed, not stacked.apps/mac/Fonts+ one new render-pipeline test; no vendor edits, no compiler changes.The problem
apps/mac/Fontscarried no typewriter design at all — noectt/ecst/ecit/ectcunderjknappen/ec, noec-lmtt*underpublic/lm, nolmmono*.otf.crates/render-pipeline/src/fonts.rsasks for exactly those files (ec_tfm_file→ectt/ecst/ecit/ectc,latin_modern_outline→lmmono*,latin_modern_tfm→ec-lmtt*), so every\texttt/\ttfamily/verbatimrun against the bundle fell back to roman:ec_metrics_unavailable(romanec-lmr*widths, which move the line breaks) plusfont_outline_substituted. It was reported, but quietly enough that\textttgeometry had already been measured on the substitution.What is added — 64 files, no new licence
Both sets come out of upstream packages this tree already vendors, so the licence files already here cover them and none were added.
texmf/fonts/tfm/jknappen/ec/{ectt,ecst,ecit,ectc}{0800…3583}.tfmdoc/fonts/ec/copyrite.txttexmf/fonts/tfm/public/lm/ec-lm{tt8,tt9,tt10,tt12,tti10,tto10,tcsc10,tcso10,tk10,tko10}.tfmdoc/fonts/lm/GUST-FONT-LICENSE.TXTFonts/lmmono{8,9,10,12}-regular,lmmono10-italic,lmmonoslant10-regular,lmmonocaps10-{regular,oblique},lmmonolt10-{bold,boldoblique}(669 KB)GUST-FONT-LICENSE.TXT44 and not 56:
t1cmtt.fddeclares four shapes (m/nectt,m/slecst,m/itecit,m/scectc) and writes<5><6><7><8>#50800, so 5/6/7 pt load the 8 pt file — 11 distinct sizes — andbx/n/bx/itaressub*cmtt/m/n/m/it, so there is no bold EC typewriter file to add.Digests and provenance
The existing tiers were copied from MacTeX 2026 on
mac-m1max-a. This host islinux-primary: TeX Live 2025 r78234, no MacTeX. Rather than assert the releases match, it was measured — every file already vendored from these two packages is byte-identical (cmp) between the two distributions: all 70jknappen/ecTFMs, all 28public/lmTFMs, all 21 Latin Modern OTFs, all 6amsfonts/symbolsTFMs. The typewriter members were then copied out of the same two directories in the same run, hashed before and after the copy. No CTAN archive is present on this host, so no archive hash is claimed; the sidecars'limitationfields say so.Both in-repo pins were extended exactly as the roman tiers are pinned —
SUPPLEMENTARY-METRICS.json101 → 155 entries with att_provenanceblock,SUPPLEMENTARY-FACES.json20 → 30 with amono_provenanceblock — sobundle-texmf.py checkandmake-app.shverify them and refuse drift.The guard
crates/render-pipeline/tests/bundled_typewriter.rs(4 tests). It walks every\ttfamilyshape throughnfss::select/nfss::terminalin all four schemes (OT1/T1 × cm/lm), so an undeclared shape such as bold small-caps typewriter — which LaTeX substitutes before loading any font — is not mistaken for a bundle gap. It then asserts every file the tables can name is on disk and pinned, and renders four\textttdocuments asserting zerofont_unavailable/required_metrics_unavailable/ec_metrics_unavailable/font_outline_substituteddiagnostics. It reads noFLASHTEX_*variable, so it behaves identically with and without the packaging environment.Gates (measured on this checkout, release builds)
article-twocolumn4,input-bibliography2)crates/render-pipelinecargo test --release, noFLASHTEX_*The corpus baseline was taken against a
git archive HEAD apps/mac/Fontscopy of the tree, not against a stale report, and the runner was given the bundled font/TFM directories explicitly (--fonts apps/mac/Fontsalone does not reach the bundledtexmf, whose roots are<exe>/../Resources/texmfand<exe>/texmf).Left out, deliberately
Sans (
ecss/ecsi/ecsx/ecso,lmsans*,lmsansdemicond*) and the roman caps/slanted/demi/unslanted designs (eccc/ecui/ecsc/ecrb/ecxc/ecoc,lmromanslant*,lmromancaps*,lmromandemi*,lmromanunsl*) are still absent, so\textsf/\textsc/\textslon this bundle still substitute and warn. Same shape of problem, out of this lane's scope; recorded inapps/mac/Fonts/README.mdas a known gap rather than left implicit.Resume notes
BundledMetricsTests/BundledFacesTestscounts were updated to match (155 metric entries, 30 supplementary faces, 33 requestable faces, 10 mono faces) andPreviewFonts.latinModernFaceFileswas extended with a separatelatinModernMonoFaceFileslist, but XCTest needs macOS — a Mac lane should run them before merge.FamilyKind::Ttrestriction.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu