Repository navigation
Latin Modern is optically sized, and this engine scaled one file to everything - #764
Merged
Merged
Conversation
…verything
lmroman9 is not lmroman10 made smaller. It is a face drawn for 9pt, with
relatively wider letters and a wider word space, because that is what reads
well at 9pt. XeTeX — which tectonic is — picks among eight such files through
tulmr.fd's \DeclareFontShape ranges. This engine embedded lmroman10 alone and
re-faced it at every size.
MEASURED, \the\wd of \hbox{MM} at each step of an article's ladder
tectonic before after
\tiny 11.890 9.170 11.890 -22.9 % -> exact
\scriptsize 14.392 12.838 14.392 -10.8 %
\footnotesize 15.568 14.672 15.568 -5.8 %
\small 16.956 16.506 16.956 -2.7 %
\normalsize 18.340 18.340 18.340 the one that was right
\large 21.528 22.008 21.528 +2.2 %
\Large 25.834 26.410 25.834 +2.2 %
\LARGE 29.376 31.692 29.376 +7.9 %
\huge 35.258 38.037 35.258 +7.9 %
Nine of nine now agree with the reference. Only the body size was ever right,
which is why a corpus measured mostly on body text never showed it.
⛔ THE RANGES ARE HALF-OPEN, and that is the case that matters most. \check@range
(latex.ltx:8642-8659) tests lower <= f@size < upper, so an 11pt class — whose
\normalsize is \@XIPT = 10.95 — takes lmroman10 and NOT lmroman12. An inclusive
upper bound would get every 11pt document in the corpus wrong while passing a
test written at 10pt.
⛔ AND THE PROVENANCE DID NOT EXIST, WHICH HAD TO BE FIXED FIRST
The five fonts already here arrived in #744/#745 described as "as tectonic's" —
in practice copied out of a bundle cache. What was recorded was a sentence in a
Go comment ("the unmodified OpenType files of the Latin Modern 2.004
distribution") and nothing that could be checked: no source, no checksum, no
version as a value, and not the MANIFEST that the GUST Font License itself
names as the document defining the Work.
A font is not like other vendored bytes: it is redistributed with the program,
so "embedded unchanged" IS the licence argument, and an argument nobody can
verify is not one.
So, before adding anything: both packages were fetched from CTAN and every file
already here was compared byte for byte. All five matched.
fonts/lm Latin Modern 2.004 the four text faces
fonts/lm-math Latin Modern Math 1.959 the maths face
Those are TWO distributions, which the old comment ran together — it described
all five as "the Latin Modern 2.004 distribution" and was wrong about one.
The licence is the GUST Font License, "actually an instance of the LaTeX
Project Public License" in upstream's own README. Its one extra clause is
"requested, but not legally required": rename derived works. These are embedded
unchanged, so it does not arise.
⚠ lm-math ships, in its doc directory, a PRELIMINARY (2006-09-30) text of that
licence where lm ships version 1.0 of 2009. The copy here is the 2009 one and
is byte-identical to lm's. That is correct for all five: every font's own
copyright field points at the canonical URL rather than at the text beside it,
so the stale copy is their packaging and not a licence that would apply to us.
fontprovenance.go records source package, the version each font declares about
ITSELF (read from its name table, not from its filename), and its sha256. Three
tests hold it: the bytes must hash to the record; every .otf under fonts/ must
BE in the record (the first test iterates the record and would miss a sixth
font dropped in beside them); and the licence and both manifests must ship.
⚠ THE COST, STATED
wasm 14.58 MB -> 16.70 MB +2.12 MB (+14.6 %)
wasm, gzip -9 4.21 MB -> 5.29 MB +1.08 MB (+25.6 %)
That is what the playground pays over the wire. If it is too much, the fix is
to fetch optical sizes on demand in the wasm build rather than to keep setting
\tiny 23 % narrow; that is a separate change and this one does not foreclose it.
Mutation: with the table unwired, eight of the nine ladder steps go red with
exactly the "before" column above, and \normalsize alone still passes.
Found by a bibliography pass over XeTeX's font selection.
Co-Authored-By: Claude Opus 5 <[email protected]>
This was referenced Nov 12, 2026
tannevaled
added a commit
that referenced
this pull request
Nov 13, 2026
…, \fontname (#770) All three were assignable and none was readable. \fontdimen2\font=8pt has worked since #365 and \hyphenchar since #767; `\the` of either produced the LITERAL TOKENS, so a document asking its own engine for a metric got "\fontdimen 2\font" where tectonic answers "3.33pt". ⭐ AND IT IS WHAT BLOCKED THE MEASUREMENT THAT MATTERS. #449 and #612 turn on WHICH FACE was selected, and \fontname is the command that says so. Without it, establishing that our default-face space is 3.33pt — exactly the reference's — meant rendering to SVG and subtracting glyph positions. That works, and it is a poor substitute for asking. MEASURED AGAINST tectonic 0.17.0, one document, six questions The first three are the CONTROL — ordinary dimension registers, which always worked — so a failure in the others is about fonts and not about \message: \the\textheight 550.0pt 550.0pt \the\baselineskip 12.0pt 12.0pt \the\parindent 15.0pt 15.0pt \the\fontdimen2\font 3.33pt 3.33pt \the\fontdimen6\font 10.0pt 10.0pt ⭐ AND THE WHOLE LADDER, TEN FOR TEN — an independent confirmation of #764 that no longer needs a renderer: \tiny lmroman5-regular \large lmroman12-regular \scriptsize lmroman7-regular \Large lmroman12-regular \footnotesize lmroman8-regular \LARGE lmroman17-regular \small lmroman9-regular \huge lmroman17-regular \normalsize lmroman10-regular \ttfamily lmmono10-regular ⛔ \fontname IS A CONVERT PRIMITIVE AND CONVERT PRIMITIVES EXPAND. tex.web §468-472 puts it with \string, \number and \jobname — all of which this engine already lists as expandable — and a document asks for it inside \message, \edef or an \ifx, never as a standalone command. Registered as an ordinary primitive it printed its own tokens in exactly the place it was wanted, which is how the first version of this failed its own test. ⚠ THE \fontname STRING DIFFERS FROM THE REFERENCE'S, deliberately. tectonic prints `"[lmroman10-regular]:mapping=tex-text;" at 10.0pt`, where the brackets and the mapping are XeTeX's own file-request syntax (tuenc.def:101,104) rather than anything about the font. This engine resolves no .fd files and has no such request to quote, so it prints the file it opened. The part that carries the information — which optical size — is the same, and that is what the tests assert. The " at <size>pt" suffix follows §472: appended only when the face is used at other than its design size, so lmroman10 at 10pt prints bare and lmroman17 at 20.74pt carries the size. ⚠ \fontdimen1 (the slant per point) REPORTS 0 rather than a guess, because this engine does not model it. 0 is also what TeX returns for a parameter a font does not define (§578 extends the array with zeros), so it is the honest answer and not a placeholder. Closes #762. Co-authored-by: Claude Opus 5 <[email protected]>
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.
Latin Modern is OPTICALLY SIZED, and this engine scaled one file to everything
lmroman9 is not lmroman10 made smaller. It is a face drawn for 9pt, with
relatively wider letters and a wider word space, because that is what reads
well at 9pt. XeTeX — which tectonic is — picks among eight such files through
tulmr.fd's \DeclareFontShape ranges. This engine embedded lmroman10 alone and
re-faced it at every size.
MEASURED, \the\wd of \hbox{MM} at each step of an article's ladder
\tiny 11.890 9.170 11.890 -22.9 % -> exact
\scriptsize 14.392 12.838 14.392 -10.8 %
\footnotesize 15.568 14.672 15.568 -5.8 %
\small 16.956 16.506 16.956 -2.7 %
\normalsize 18.340 18.340 18.340 the one that was right
\large 21.528 22.008 21.528 +2.2 %
\Large 25.834 26.410 25.834 +2.2 %
\LARGE 29.376 31.692 29.376 +7.9 %
\huge 35.258 38.037 35.258 +7.9 %
Nine of nine now agree with the reference. Only the body size was ever right,
which is why a corpus measured mostly on body text never showed it.
⛔ THE RANGES ARE HALF-OPEN, and that is the case that matters most. \check@range
(latex.ltx:8642-8659) tests lower <= f@size < upper, so an 11pt class — whose
\normalsize is @XIPT = 10.95 — takes lmroman10 and NOT lmroman12. An inclusive
upper bound would get every 11pt document in the corpus wrong while passing a
test written at 10pt.
⛔ AND THE PROVENANCE DID NOT EXIST, WHICH HAD TO BE FIXED FIRST
The five fonts already here arrived in #744/#745 described as "as tectonic's" —
in practice copied out of a bundle cache. What was recorded was a sentence in a
Go comment ("the unmodified OpenType files of the Latin Modern 2.004
distribution") and nothing that could be checked: no source, no checksum, no
version as a value, and not the MANIFEST that the GUST Font License itself
names as the document defining the Work.
A font is not like other vendored bytes: it is redistributed with the program,
so "embedded unchanged" IS the licence argument, and an argument nobody can
verify is not one.
So, before adding anything: both packages were fetched from CTAN and every file
already here was compared byte for byte. All five matched.
fonts/lm Latin Modern 2.004 the four text faces
fonts/lm-math Latin Modern Math 1.959 the maths face
Those are TWO distributions, which the old comment ran together — it described
all five as "the Latin Modern 2.004 distribution" and was wrong about one.
The licence is the GUST Font License, "actually an instance of the LaTeX
Project Public License" in upstream's own README. Its one extra clause is
"requested, but not legally required": rename derived works. These are embedded
unchanged, so it does not arise.
⚠ lm-math ships, in its doc directory, a PRELIMINARY (2006-09-30) text of that
licence where lm ships version 1.0 of 2009. The copy here is the 2009 one and
is byte-identical to lm's. That is correct for all five: every font's own
copyright field points at the canonical URL rather than at the text beside it,
so the stale copy is their packaging and not a licence that would apply to us.
fontprovenance.go records source package, the version each font declares about
ITSELF (read from its name table, not from its filename), and its sha256. Three
tests hold it: the bytes must hash to the record; every .otf under fonts/ must
BE in the record (the first test iterates the record and would miss a sixth
font dropped in beside them); and the licence and both manifests must ship.
⚠ THE COST, STATED
wasm 14.58 MB -> 16.70 MB +2.12 MB (+14.6 %)
wasm, gzip -9 4.21 MB -> 5.29 MB +1.08 MB (+25.6 %)
That is what the playground pays over the wire. If it is too much, the fix is
to fetch optical sizes on demand in the wasm build rather than to keep setting
\tiny 23 % narrow; that is a separate change and this one does not foreclose it.
Mutation: with the table unwired, eight of the nine ladder steps go red with
exactly the "before" column above, and \normalsize alone still passes.
Found by a bibliography pass over XeTeX's font selection.
Co-Authored-By: Claude Opus 5 [email protected]