Repository navigation
Conversation
…ts glyph Since 7.21.0 a font whose metrics declare EncodingScheme FontSpecific decodes every code that /Differences and /ToUnicode leave open through its curated map, even when the font dictionary declares a base encoding. That also covers the standard Symbol font: declared as WinAnsi, code 0xD7 paints `multiply`, but decoded as Symbol's own `dotmath`. The curated map now applies only to codes whose declared glyph the font does not have, which keeps it for a legacy font that declares WinAnsi falsely. Where the font has the declared glyph, the declared encoding governs, the order freetype_font_cache::resolve_glyph_indices already uses for the glyph it draws. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Boyukkhan <beyukxan12@gmail.com>
Contributor
|
✅ DCO Check Passed Thanks @Boyukkhan, all your commits are properly signed off. 🎉 |
Contributor
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
This branch has not been deployed
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.
Problem
Since 7.21.0 (#351), a font whose metrics file declares
EncodingScheme FontSpecificdecodes every codethat
/Differencesand/ToUnicodeleave open through its curated map, even when the font dictionarydeclares a base encoding. The rule was added for legacy symbol fonts that declare WinAnsi while using
their own codes (AdvPSSym, AdvPSMP10), but
FontSpecificalso covers the standard Symbol font and themetrics under
fonts/custom/Microsoft/(Arial, Times New Roman, Georgia, Trebuchet, ...). Their declaredencodings are then ignored where they are right:
A renderer draws
α×β: WinAnsi names 0xD7multiply, which Symbol has; it names 0x61 and 0x62aandb, which Symbol lacks, so the font's own codes apply. 7.20 decodeda×b; 7.21 and later decodeα⋅β(Symbol's own 0xD7 is
dotmath). The same happens to TrueType Arial, Times New Roman, Georgia andSymbolMT fonts declared
/MacRomanEncoding: German text in Georgia readsTŠnzerforTänzer, adegree sign reads
¡(macroman_encoding_bug_demo.pdf), bullets read¥or∞.Change
In
get_correct_character, the curated map now applies to the codes whose declared glyph the font doesnot have. For a code whose declared glyph it has, the declared encoding governs -- the order
freetype_font_cache::resolve_glyph_indicesalready uses to pick the glyph it draws (the declaredglyph name, then the font's own code).
base_font::has_glyph_nameanswers the lookup from the metricsfile. A legacy font that declares WinAnsi falsely keeps its curated mapping, because the WinAnsi names
are not glyphs it has (
test_adv_ps_mp10_uses_font_specific_mapping_over_winansiis unchanged). Thecheck is against the metrics file's glyph set, not an embedded subset's.
Tests
test_symbol_follows_declared_winansi_where_it_has_the_glyph(intests/test_unit_gid_glyph_names.py)decodes the example above and expects
α×β. It fails on 7.22.1 (α⋅β) and on 7.20.0 (a×b).Verification
tests/test_unit_*.py: 202 passed, 4 skipped.reference PDFs:
11939885835628903831_004.pdf(pages 1, 3, 5, 6, 12),5236588965309071374-1.pdf(2),6480366468566741514.pdf(1),921843749409059316-11.pdf(3, 5, 10, 11),macroman_encoding_bug_demo.pdf(1) andmulti_page.pdf(1-4). 98 glyphs change, every one in aTrueType font declared
/MacRomanEncodingwith the Nonsymbolic flag, now decoded as MacRoman:Georgia
Š š Ÿ § Ž Ý->ä ö ü ß é ›, SymbolMTϒ/∞->°/•, ArialMT¥/¡->•/°,TimesNewRomanPSMT
Ð->-. Each was checked against the rendered page (n°15, bullets,Tänzer,100°F,– Gale,María,›), and 96 of the 98 equal 7.20.0's reading (the other two differ only bythe double-quote folding added in 7.21). The references recorded the regression; could you regenerate
those pages in the dataset?
⋅become×, nothing elsechanges, and the
×/⋅counts per document return to those of 7.16; changed glyphs were checked onrendered pages.
🤖 Generated with Claude Code