Repository navigation
Draw text - #3
Merged
Merged
Conversation
The other half of a page. The whole text state — face, size, character and word spacing, horizontal stretch, leading, rise and rendering mode — every positioning operator, and every way of showing a string including the array whose numbers move the pen between pieces. Glyphs come from three places, which is what the corpus needs. An embedded TrueType or OpenType program, addressed through the font's own character map for a symbolic font and through an encoding of glyph names otherwise, with the Differences list a file may write over either. A composite font, addressed two bytes at a time by character identifier, with the widths named singly or in runs and a map from identifiers to glyphs. And a Type 3 font, whose glyphs are little content streams — which this package already knows how to run, so they are simply run, in the state that showed them and under the font's own matrix. A font whose program cannot be read draws nothing but still advances the pen by the widths the file states, so everything after the text stays where it belongs. That is the difference between a page missing its letters and a page that has fallen apart. Checked by drawing text and looking at it: a capital H at forty points on a baseline at ten has to put ink above that line and none below it, and none before where the text begins. A Type 3 glyph that fills its own em becomes a square from (10,10) to (30,30) at twenty points, which is exact enough to catch a font matrix applied the wrong way round. Spacing, stretch, rise, the four rendering modes and the widths of a composite font are each pinned by where they leave the last glyph. The measured effect on the corpus: pages that come out blank fall from 31 to 26 of 4 108. The number is small because images already carried most pages; what text changes is what is on the ones that were not blank. Exact 100% statement coverage, go vet clean, nine cross-compilation targets. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This was referenced Nov 22, 2026
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.
The other half of a page. The whole text state — face, size, character and word
spacing, horizontal stretch, leading, rise and rendering mode — every
positioning operator, and every way of showing a string including the array
whose numbers move the pen between pieces.
Glyphs come from three places, which is what the corpus needs. An embedded
TrueType or OpenType program, addressed through the font's own character map
for a symbolic font and through an encoding of glyph names otherwise, with the
Differences list a file may write over either. A composite font, addressed two
bytes at a time by character identifier, with the widths named singly or in
runs and a map from identifiers to glyphs. And a Type 3 font, whose glyphs are
little content streams — which this package already knows how to run, so they
are simply run, in the state that showed them and under the font's own matrix.
A font whose program cannot be read draws nothing but still advances the pen by
the widths the file states, so everything after the text stays where it
belongs. That is the difference between a page missing its letters and a page
that has fallen apart.
Checked by drawing text and looking at it: a capital H at forty points on a
baseline at ten has to put ink above that line and none below it, and none
before where the text begins. A Type 3 glyph that fills its own em becomes a
square from (10,10) to (30,30) at twenty points, which is exact enough to catch
a font matrix applied the wrong way round. Spacing, stretch, rise, the four
rendering modes and the widths of a composite font are each pinned by where
they leave the last glyph.
The measured effect on the corpus: pages that come out blank fall from 31 to 26
of 4 108. The number is small because images already carried most pages; what
text changes is what is on the ones that were not blank.
Exact 100% statement coverage, go vet clean, nine cross-compilation targets.