Skip to content

fonts: bundle the Latin Modern sans, slanted and small-caps designs every running head needs - #205

Merged
GoKubar merged 1 commit into
mainfrom
agent/linux-primary/latin-modern-sans-slant-caps
Sep 13, 2026
Merged

GoKubar merged 1 commit into
mainfrom
agent/linux-primary/latin-modern-sans-slant-caps

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Draft while main is frozen for the v0.1.2 release run. Independent of #202/#203 — it touches no test those PRs touch, and its three tests are the three they both name as the remaining pre-existing gap.

The defect

The bundle shipped 33 outline faces — LMRoman, LMMono, math — and zero Latin Modern sans, slanted or small-caps designs. article.cls and book.cls set every headings/myheadings running head in \slshape (article.cls:134-135,152,163-164), so this was not a corner case: every running head in the bundle was drawn from a substituted roman outline, and \textsf/\textsl/\textsc substituted roman throughout the body.

The renderer already mapped these shapes — latin_modern_outline returns lmsans*/lmromanslant*/lmromancaps*, latin_modern_tfm maps them to ec-lmss/ec-lmro/ec-lmcsc, and ec_tfm_file names the jknappen EC metrics for [T1]{fontenc} without lmodern. The files were simply absent.

What is bundled — 192 files, no new package

All from lm and jknappen, both already vendored, so no new licence file:

group count what
outlines 25 lmromanslant{8,9,10,12,17}-regular, lmromanslant10-bold, lmromancaps10-{regular,oblique}, lmromanunsl10-regular, lmromandemi10-{regular,oblique}, lmsans{8,9,10,12,17}-{regular,oblique}, lmsans10-{bold,boldoblique}, lmsansdemicond10-{regular,oblique} — exactly what latin_modern_outline can return for FamilyKind::Sf and the roman shapes outside m/n, bx/n, m/it, bx/it
public/lm TFMs 25 exactly what latin_modern_tfm maps those outlines to, so each face lays out on its own TeX metrics
jknappen/ec TFMs 142 every remaining file ec_tfm_file can name: eccc/ecsc/ecoc/ecui/ecbl/ecrb/ecxc × 14 t1cmr.fd sizes, ecss/ecsi/ecsx/ecso × the 11 distinct sizes t1cmss.fd reaches

The EC tier is not padding: without ecxc1000.tfm the 20-t1-rm-bfsc fixture measured 11.533 bp from pdfLaTeX, which sets it from SFXC1000 (= ecxc1000.tfm). After this tier ec_tfm_file can no longer name a metric the bundle lacks — the same invariant the typewriter tier (#183) established for FamilyKind::Tt.

Provenance — measured, not asserted

linux-primary has TeX Live 2025 r78234 and no MacTeX, so release identity was established by byte-comparison, exactly as #183 did: every file already pinned from these packages was compared (cmp) against this distribution.

already-vendored group compared identical different
Latin Modern OTFs 33 33 0
public/lm TFMs 38 38 0
jknappen/ec TFMs 114 114 0
amsfonts/symbols TFMs 6 6 0
total 191 191 0

The new members were copied from the same directories in the same run and hashed after the copy. No CTAN archive is present on this host, so no archive hash is claimed; the sidecars' limitation fields say so.

Independent corroboration for one of the new faces. crates/font-engine/src/manifest.rs already carried a pin for lm/lmsans10-regular.otf — sha256 d431b786…, 95128 bytes — written by another lane, from another source, for a file that was not in the bundle (apps/mac/Fonts/lmsans10-regular.otf does not exist at the base commit). The copy this PR takes from TeX Live 2025 matches it exactly. All 6 Latin Modern entries in that manifest now match the bundle byte-for-byte (match=6 mismatch=0 absent=0), where one was previously unmatchable.

Pins regenerated to their true values, never relaxed

SUPPLEMENTARY-FACES.json 30 → 55 entries, SUPPLEMENTARY-METRICS.json 155 → 322, each with a new provenance block. bundle-texmf.py check: 386 entries, all verified (9 pinned, 55 supplementary-face, 322 supplementary).

Every hard-pinned Swift count was regenerated, none weakened into a range:

assertion before after
latinModernFaceFiles.count 33 58
latinModernMonoFaceFiles.count 10 10 (unchanged)
latinModernRomanShapeFaceFiles.count — 11 (new)
latinModernSansFaceFiles.count — 14 (new)
faces entries.count 30 55
supplementary-face rows 30 55
metrics entries.count 155 322
reachable text masters (seen.count) 21 21 (unchanged — preview postScriptName only emits LMRoman)

Two things needed care beyond the counts:

  • testPackagingCheckVerifiesFacesAndRefusesDrift used lmsans10-regular.otf as its "unpinned stray" sentinel, which this change makes a legitimately pinned face — the assertion would have silently changed meaning. It now uses lmdunh10-regular.otf, a dunhill design latin_modern_outline has no arm to return, so no tier can ever pin it.
  • MAX_SUPPLEMENTARY in bundle-texmf.py raised 65536 → 262144. It is a sanity bound on parsing an in-repo sidecar, not a trust boundary: every entry is still checked individually (byte_length + sha256) and any vendored file no pin lists is still refused as unpinned. 322 entries do not fit in 64 KB.

Verification

macOS — the platform these tests actually run on

Xcode 26.6 on the owner's Mac, branch at 9a22ae62, apps/mac:

swift build                                                    Build complete
swift test --skip NearbyInterfaceTests --skip NearbyLANInterfaceTests
  Executed 920 tests, with 135 tests skipped and 0 failures (0 unexpected)

(The two skips need a GUI session for macOS local-network permission; they pass there.)

A whole-suite "0 failures" does not by itself prove the regenerated counts were exercised rather than skipped, so the two classes that carry every changed pin were re-run with full per-test output:

BundledFacesTests    Executed  5 tests, 1 skipped, 0 failures
BundledMetricsTests  Executed 11 tests, 2 skipped, 0 failures

Every assertion this PR changed is in a test that positively ran and passed:

test carries
testEveryProducerRequestableFaceIsVendoredAndPinned count == 58, mono 10, roman-shape 11, sans 14, entries.count == 55, and sha256 + byte_length for all 55 faces
testPackagingCheckVerifiesFacesAndRefusesDrift supplementary-face rows == 55, and the new lmdunh10-regular.otf stray sentinel
testEveryPreviewMasterResolvesToARealCoreTextFace seen.count == 21 — ran, did not XCTSkip
testSupplementaryMetricsMatchTheirInRepoPin entries.count == 322, sha256 + byte_length for all 322, every-TFM-accounted-for, and the faces_covered / ec_faces_covered / ams_symbols_covered claims

The 3 skips are the FLASHTEX_RENDER-gated real-producer tests. CI does run them (scripts/ci/build-helpers.sh exports FLASHTEX_RENDER into GITHUB_ENV), so they are not free. Their core assertions were reproduced against the real producer on Linux with the same bundle (the macOS versions add sandbox-exec to deny host TeX; no host TeX is on any FLASHTEX_* path here and the producer does not probe for it):

check result
HW1 with only the three bundled metric dirs ec_metrics_unavailable 0, missing-font/metric 0
control — Latin Modern dir alone ec_metrics_unavailable 7 → the assertion is not vacuous
headings document with \textsf, \textsl, \textsc, bold-caps, bold-sans, sans-italic, bold-slanted missing 0, ec_metrics_unavailable 0, font_outline_substituted 1

That one remaining substitution is lmromancaps10-regular.otf: Latin Modern has no bold small-caps design; the medium one is drawn — an upstream Latin Modern gap, not a bundling gap, and the pre-existing NO_BOLD_CAPS note in fonts.rs. pdfLaTeX agrees: the oracle maps SFXC → LMRomanCaps-Regular for exactly this reason, which is why 20-t1-rm-bfsc now passes.

Linux — failing SET vs a control checkout of the same base

Control worktree at the same base (6ea56c8a), same font environment on both sides, --no-fail-fast so the whole crate runs:

control (base) this branch
render-pipeline 181 passed / 8 failed 184 passed / 5 failed

The three that flipped are exactly this PR's targets; the 5 that remain are exactly the environment-contaminated controls #202 fixes, byte-for-byte the list in that PR.

test control this branch
page_frame_against_pdflatex 16 fixtures differ (all chrome; body already 82/82) pass
footnotes_against_pdflatex 21-book-chapter, off 0.512 bp pass
font_family_fixtures_match_pdflatex 32 of 50 differ pass (0 of 50)

The same comparison under the narrow env

Both sides also run with the pre-93fb3219 narrow env (public/lm alone):

control (base) this branch
narrow env 172 passed / 17 failed 174 passed / 15 failed

The set difference is exactly {footnotes_against_pdflatex, page_frame_against_pdflatex} removed — zero new failures. font_family_fixtures_match_pdflatex still fails under narrow on both sides, because the narrow env deliberately omits jknappen/ec, where the ecxc metrics its T1 fixtures need live.

To be precise about what that does and does not show: this is not a claim of whole-suite environment invariance, and #202 never made one either — it claimed invariance for math_symbols + metrics_provenance, which this PR does not touch. The narrow env is an artificial configuration, not one the product ships: BundledMetrics.defaultBundledDirectories advertises all three metric directories (asserted dirs.count == 3), Discovery::bundle_texmf_roots derives them inside a real .app, and CI's env lists them. In every environment the product actually uses, all three tests pass.

Running-head geometry — before/after against pdfLaTeX

Expected to change; that is the fix. page_frame's chrome tolerance is 0.1 pt = 0.0996 bp.

04-article-twoside-headings p2, and the worst case in the set:

word pdfLaTeX before after
"4" (page no.) 428.1329 427.5172 (off 0.616) 428.1370 (off 0.0041)
"DISCUSSION" 443.0768 442.7930 (off 0.284) 443.0810 (off 0.0042)
"Left" (06-…-myheadings p2) 437.8265 440.0201 (off 2.194) 437.8223 (off 0.0042)

Chrome words matched, per fixture:

fixture before after
04-article-twoside-headings 2/4 4/4
05-article-oneside-headings 4/6 6/6
06-article-twoside-myheadings 5/12 12/12
07-article-oneside-myheadings 4/8 8/8

Body text was already exact and stayed exact (lines matched 82/82 x 82/82 y 82/82 on both sides).

Gates

gate result
amsmath corpus 59/59 within 0.5 bp
HW1 3 pages, 0 errors, 0 overfull
HW2 3 pages, 0 errors, 0 overfull
real-world corpus (10 fixtures) identical to the control — same status, pages, errors, overfull and diagnostic counts on every fixture
font diagnostics zero font_unavailable / required_metrics_unavailable / ec_metrics_unavailable / font_outline_substituted / tfm_missing / math_font_unavailable across all 10 fixtures. The 35 math_resource_profile notes are the pre-existing math-face profile notes (lmmi/lmsy/lmex/msbm drawn from the OpenType math faces), identical on the control, and none is the lmr* roman-fallback marker

TeX Live 2025 is an oracle only, never in the product path; no committed oracle expected data was regenerated.


Implementation-Agent: Claude Code engine-engineer (linux-primary / NixOS)

…very running head needs

The bundle shipped 33 outline faces -- LMRoman, LMMono and math -- and
zero Latin Modern sans, slanted or small-caps designs. article.cls and
book.cls set every headings/myheadings running head in \slshape
(article.cls:134-135,152,163-164), so this was not a corner case: every
running head in the bundle was drawn from a substituted roman outline
with a font_outline_substituted warning, and \textsf/\textsl/\textsc
substituted roman throughout the body.

The renderer already mapped these shapes; the files were simply absent.
latin_modern_outline returns lmsans*/lmromanslant*/lmromancaps*/
lmromandemi*/lmromanunsl*, latin_modern_tfm maps them to ec-lmss/ec-lmro/
ec-lmcsc/..., and ec_tfm_file names the jknappen EC metrics for a
[T1]{fontenc} document without lmodern. None of those files were vendored.

192 files added, all from packages this tree already vendors (lm and
jknappen), so no new package and no new licence file:

- 25 outlines: lmromanslant{8,9,10,12,17}-regular, lmromanslant10-bold,
  lmromancaps10-{regular,oblique}, lmromanunsl10-regular,
  lmromandemi10-{regular,oblique}, lmsans{8,9,10,12,17}-{regular,oblique},
  lmsans10-{bold,boldoblique}, lmsansdemicond10-{regular,oblique}.
  Exactly what latin_modern_outline can return for FamilyKind::Sf and for
  the roman shapes outside m/n, bx/n, m/it, bx/it.
- 25 ec-lm* TFMs under public/lm: exactly what latin_modern_tfm maps
  those outlines to, so each new face lays out on its own TeX metrics
  rather than on substituted roman ones.
- 142 jknappen/ec TFMs: every remaining file ec_tfm_file can name --
  eccc/ecsc/ecoc/ecui/ecbl/ecrb/ecxc at the 14 t1cmr.fd sizes and
  ecss/ecsi/ecsx/ecso at the 11 distinct sizes t1cmss.fd reaches. Without
  ecxc1000.tfm the 20-t1-rm-bfsc fixture measured 11.533 bp from pdflatex,
  which sets it from SFXC1000 (= ecxc1000.tfm). After this tier
  ec_tfm_file can no longer name a metric the bundle lacks.

Release identity verified by byte-comparison, the method PR #183 used,
because linux-primary has TeX Live 2025 r78234 and no MacTeX: every file
already pinned from these packages is byte-identical (cmp) between the
two distributions -- 33 Latin Modern OTFs, 38 public/lm TFMs, 114
jknappen/ec TFMs and 6 amsfonts/symbols TFMs. 191 files compared, 0
differences. The new members were copied from the same directories in
the same run and hashed after the copy. No CTAN archive is present on
this host, so no archive hash is claimed.

Both in-repo pins regenerated to their true new values, not relaxed:
SUPPLEMENTARY-FACES.json 30 -> 55 entries, SUPPLEMENTARY-METRICS.json
155 -> 322, each with a provenance block. Every hard-pinned count in the
Swift tests was regenerated: latinModernFaceFiles 33 -> 58, faces
entries 30 -> 55, supplementary-face rows 30 -> 55, metrics entries
155 -> 322. latinModernMonoFaceFiles stays 10 and the 21 reachable text
masters stay 21 (preview postScriptName only emits LMRoman). Two new
counts added for the new arrays. The stray-face test used
lmsans10-regular.otf as its "unpinned" sentinel, which this change makes
a legitimately pinned face; it now uses lmdunh10-regular.otf, a design
latin_modern_outline has no arm to return.

bundle-texmf.py MAX_SUPPLEMENTARY raised 65536 -> 262144. It is a sanity
bound on parsing an in-repo sidecar, not a trust boundary: every entry is
still checked individually (byte_length + sha256) and any vendored file
no pin lists is still refused as unpinned. 322 entries do not fit in 64K.

bundle-texmf.py check: 386 entries, all verified (9 pinned, 55
supplementary-face, 322 supplementary).

Implementation-Agent: Claude Code engine-engineer (linux-primary / NixOS)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar
GoKubar marked this pull request as ready for review September 13, 2026 20:15
@GoKubar
GoKubar merged commit 08f4979 into main Sep 13, 2026
20 checks passed
@GoKubar
GoKubar deleted the agent/linux-primary/latin-modern-sans-slant-caps branch September 16, 2026 04:17
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.

1 participant