Repository navigation
render-pipeline: NFSS font families, shapes and math alphabets (sans, typewriter, small caps, slanted, \mathsf/\mathfrak) - #134
Merged
Conversation
Implementation-Agent: Claude Opus 5 (subagent kabir-claude font families, mac-m5pro-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]>
…small caps, slanted) Text fonts are selected the way LaTeX's \fontfamily/\fontseries/\fontshape + \selectfont do (new src/nfss.rs): the shape/series change rules of latex.ltx, \wrong@fontshape substitution and the ot1cm*/t1cm*/t1lm*.fd declarations (sub*/ssub*), with pdflatex's font warnings. The adapter applies every text font command and declaration (\textsf, \scshape, \ttfamily, \bf, ...) outermost first; \em follows the loaded font's slant. Faces: EC metrics (ecss, eccc, ectt, ...) or ec-lm* metrics with the Latin Modern designs (lmsans, lmromancaps, lmmono, ...); a missing design keeps its metrics and draws the roman one with a warning. microtype resolves the loaded NFSS font (family, series, shape, encoding). Oracle: 46 fixtures vs MacTeX 2026 pdflatex (OT1, T1, T1+lmodern), 45 within 0.5 bp with the same designs and warnings; 41 pending the \LaTeX logo (#129). HW1/HW2 display lists byte-identical to main 85ec30c. Implementation-Agent: Claude Opus 5 (subagent kabir-claude font families, mac-m5pro-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]>
…d \mathfrak The compiler's Unicode mathematical alphanumerics (companion PR #136) and \mathbf are set in the fonts fontmath.ltx/amsfonts.sty use: runs of a text alphabet through the math text sink in that NFSS shape (TFM kerns and ligatures, last italic correction as delta), a single character as a math character from its TFM (TeX 1186), fraktur from eufm5/7/10 boxes with Latin Modern Math's Euler outlines. eufm TFM directory added to discovery. Oracle fixtures 47-50: \mathbf passes on main's vendor (0.15 bp); the alphabet fixtures are PENDING on the #136 re-pin and match pdflatex within 0.39 bp in a scratch build with #136 vendored. HW1/HW2 byte-identical. Implementation-Agent: Claude Opus 5 (subagent kabir-claude font families, mac-m5pro-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]>
This was referenced Sep 13, 2026
Member
|
Merged to main via integration/2026-09-13k (Commander). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on main
85ec30c7(merged in; no stacking). Novendor/edits, no compiler change needed to build: the adapter already re-reads font commands from the source bytes.What
Text fonts are now selected the way LaTeX does it:
\fontfamily/\fontseries/\fontshape+\selectfont.New
src/nfss.rstranscribes, with line citations:\merge@font@shape@and\merge@font@series@;\wrong@fontshapesubstitution (shapen, then seriesm, then family);.fddeclarations, includingsub*/ssub*:ot1cmr/ot1cmss/ot1cmtt,t1cmr/t1cmss/t1cmtt,t1lmr/t1lmss/t1lmtt.It emits pdflatex's warnings verbatim, for example
Font shape `OT1/cmr/bx/sc' undefined, using `OT1/cmr/bx/n' instead.Adapter. Every text font command and declaration is applied outermost first, so order matters exactly as in LaTeX:
\textrm/sf/tt,\textmd/bf,\textit/sl/sc/up,\textnormal,\emph;\rmfamily…\normalfont,\em;\bf \it \sl \sc \rm \sf \tt.\emand the\maybe@icitalic correction follow the slant of the font actually loaded. For example,\textsc{\emph{x}}gives OT1m/itbut T1/lmodernm/scsl.Faces.
Family::ComputerModern(T1) uses EC metrics:ecss/ecsi/ecsx/ecso,eccc/ecxc/ecsc/ecbl/ecoc/ecrb,ectt/ecst/ecit/ectc. Sans and typewriter follow the<5-8>→0800rule.Family::LatinModernusesec-lm*metrics..fdoptical sizes:lmsans,lmromancaps,lmromanslant,lmromandemi,lmmono*.font_outline_substitutedwarning (no Times fallback). Latin Modern has no bold small caps, soecxcdrawslmromancaps10and says so.\hyphenchar=-1.microtype resolves the loaded NFSS font: family
cmss/lmtt…, series and shape after substitution, and the document's encoding. HW1/HW2 still resolve exactly T1/cmr as before.Verification
fixtures/font-families,make_fixtures.py+oracle.py; pdflatex is test-only, cargo never runs TeX).\emphnesting, declarations, 2.09 forms, sizes, and bold/sans/tt substitutions.41-t1-sans-latex(\textsf{\LaTeX}) isPENDING: main has no logo boxes yet (render-pipeline: set \TeX/\LaTeX logos, \rule and text kerns (stacked; needs vendor re-pin) #129). The test fails if it starts matching, so the entry gets removed.cargo test --release: all green, including 6 newnfssunit tests and a fonts mapping test.85ec30c7(sha256d2cdd486…,0e5d2181…).\textttin LM Mono; the other 7 are byte-identical.Mac bundle: files these shapes need (none are in
apps/mac/Fontstoday)Without them the app draws roman outlines with the requested metrics where the TFM is found, and warns.
fonts/opentype/public/lm, 33):lmsans{8,9,10,12,17}-{regular,oblique},lmsans10-{bold,boldoblique}lmromancaps10-{regular,oblique},lmromanslant{8,9,10,12,17}-regular,lmromanslant10-boldlmromandemi10-{regular,oblique},lmromanunsl10-regularlmmono{8,9,10,12}-regular,lmmono10-italic,lmmonoslant10-regular,lmmonocaps10-{regular,oblique},lmmonolt10-{bold,boldoblique}fonts/tfm/public/lm, 33):ec-lmss{8,9,10,12,17},ec-lmsso{8,9,10,12,17},ec-lmssbx10,ec-lmssbo10ec-lmcsc10,ec-lmcsco10,ec-lmro{8,9,10,12,17},ec-lmbxo10,ec-lmb10,ec-lmbo10,ec-lmu10ec-lmtt{8,9,10,12},ec-lmtti10,ec-lmtto10,ec-lmtcsc10,ec-lmtcso10,ec-lmtk10,ec-lmtko10fonts/tfm/jknappen/ec, 186):{eccc,ecxc,ecbl,ecsc,ecoc,ecrb,ecui}× 14 sizes (0500…3583){ecss,ecsi,ecsx,ecso,ectt,ecst,ecit,ectc}× 11 sizes (0800…3583)Math alphabets (second commit)
fontmath.ltxsets\mathbf,\mathsf,\mathitand\mathttin the text fonts OT1 cmr/bx/n, cmss/m/n, cmr/m/it and cmtt/m/n (lmodern: lmr/lmss/lmtt).amsfonts.stysets\mathfrakin U/euf (ueuf.fd:eufm5below 6 pt,eufm7below 8 pt, elseeufm10).New
src/mathalpha.rsmaps the compiler's Unicode mathematical alphanumerics (#136) back to the alphabet and letter.Runs of two or more characters of a text alphabet go through the math text sink in that NFSS shape:
ec-lm*, equal torm-lm*for letters and digits) at the.fdoptical size.\mathbf{...}(already a compiler nucleus) now uses the bold roman font, so its "set in the regular roman face" limitation is gone.One character is a math character, as in TeX, where §1186 unpacks the one-Ord group:
TexMathMetrics::with_alphabetsloads the alphabets the sources name.Fraktur gets
eufmTFM boxes and Latin Modern Math's (Euler) fraktur outlines.fonts/tfm/public/amsfonts/euleris added to TFM discovery.Oracle fixtures 47-50 (T1, OT1, lmodern):
47-t1-math-bold(\mathbf{v},\mathbf{Ab}_2,\mathbf{F}^2) passes on main's vendor: 0.15 bp.48-50(\mathsf{ABC},\mathtt{T}x,\mathit{diff},\mathfrak{gA},\mathsf{A}^2) arePENDINGon the compiler: \textsc/\scshape/\sc and \mathsf/\mathtt/\mathit/\mathfrak alphabets (companion of #134) #136 re-pin.vendor/compiler(not committed), all three match pdflatex: max |dx| 0.39 bp (T1/OT1) and 0.005 bp (lmodern), same designs. The test then reports "now matches: remove it from PENDING", which is the signal for the integrator.Bundle additions for math alphabets:
eufm5/7/10.tfm(fonts/tfm/public/amsfonts/euler). The sans, typewriter, bold and italic faces and TFMs are already in the list above.Notes and follow-ups
\textsc/\scshape/\scstill get an "is not supported" error diagnostic from the compiler. The text is typeset in small caps anyway. The compiler fix is compiler: \textsc/\scshape/\sc and \mathsf/\mathtt/\mathit/\mathfrak alphabets (companion of #134) #136.agent/kabir-claude/verbatim-fidelity.ec-lm*metrics forcmr/cmss/cmtt. It is still within 0.30 bp on every OT1 fixture.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu