Skip to content

Substitute a system font when an embedded CFF is truncated#21320

Merged
timvandermeij merged 1 commit into
mozilla:masterfrom
calixteman:issue7625
May 24, 2026
Merged

Substitute a system font when an embedded CFF is truncated#21320
timvandermeij merged 1 commit into
mozilla:masterfrom
calixteman:issue7625

Conversation

@calixteman
Copy link
Copy Markdown
Contributor

It fixes #7625.

If the Top DICT's Private DICT extends past the end of the font data, the Local Subrs INDEX is unreachable and every CharString that calls a subr ends up as a blank glyph. Throw from parsePrivateDict so the existing catch in translateFont triggers fallbackToSystemFont, then run getFontSubstitution post-construction so we pick a close local match instead of the generic fallbackName.

@calixteman calixteman requested a review from timvandermeij May 23, 2026 21:10
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 23, 2026

Codecov Report

❌ Patch coverage is 58.33333% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.41%. Comparing base (143a724) to head (adcde11).

Files with missing lines Patch % Lines
src/core/evaluator.js 60.00% 4 Missing ⚠️
src/core/cff_parser.js 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21320      +/-   ##
==========================================
- Coverage   81.42%   81.41%   -0.01%     
==========================================
  Files         257      257              
  Lines       65328    65339      +11     
==========================================
+ Hits        53191    53195       +4     
- Misses      12137    12144       +7     
Flag Coverage Δ
fonttest 9.11% <0.00%> (-0.01%) ⬇️
integrationtest 66.99% <58.33%> (-0.01%) ⬇️
unittest 56.86% <33.33%> (-0.01%) ⬇️
unittestcli 56.06% <33.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me, with passing reference tests. Thank you for fixing this!

@calixteman
Copy link
Copy Markdown
Contributor Author

/botio browsertest

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_browsertest from @calixteman received. Current queue size: 1

Live output at: http://54.241.84.105:8877/998f79a8fed7454/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_browsertest from @calixteman received. Current queue size: 1

Live output at: http://54.193.163.58:8877/75ddd573c487e23/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/75ddd573c487e23/output.txt

Total script time: 24.80 mins

  • Regression tests: Passed

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/998f79a8fed7454/output.txt

Total script time: 18.28 mins

  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.241.84.105:8877/998f79a8fed7454/reftest-analyzer.html#web=eq.log

It fixes mozilla#7625.

If the Top DICT's Private DICT extends past the end of the font data,
the Local Subrs INDEX is unreachable and every CharString that calls
a subr ends up as a blank glyph. Throw from parsePrivateDict so the
existing catch in translateFont triggers fallbackToSystemFont, then
run getFontSubstitution post-construction so we pick a close local
match instead of the generic fallbackName.
@timvandermeij timvandermeij merged commit e6cb600 into mozilla:master May 24, 2026
22 checks passed
@timvandermeij
Copy link
Copy Markdown
Contributor

/botio makeref

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

Command cmd_makeref from @timvandermeij received. Current queue size: 0

Live output at: http://54.193.163.58:8877/740ce885f8b095c/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_makeref from @timvandermeij received. Current queue size: 0

Live output at: http://54.241.84.105:8877/4c533d2ef9bd516/output.txt

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/4c533d2ef9bd516/output.txt

Total script time: 18.26 mins

  • Make references: Passed
  • Check references: Passed

@moz-tools-bot
Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/740ce885f8b095c/output.txt

Total script time: 24.88 mins

  • Make references: Passed
  • Check references: Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDF text not correctly rendered

4 participants