Skip to content

Render glyph 0 in full CFF fonts - #22326

Merged
calixteman merged 1 commit into
mozilla:masterfrom
calixteman:issue5377
Oct 24, 2026
Merged

calixteman merged 1 commit into
mozilla:masterfrom
calixteman:issue5377

Conversation

@calixteman

Copy link
Copy Markdown
Contributor

With 65535 glyphs, CFF cannot append a copy of glyph 0. The old mapping used the last glyph instead.

Reuse an empty slot and copy glyph 0's outline, width and FDSelect entry. Keep the replaced glyph's original characters unmapped.

It fixes #5377.

@codecov-commenter

codecov-commenter commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.46%. Comparing base (a30101a) to head (2982549).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/core/cff_parser.js 92.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #22326      +/-   ##
==========================================
- Coverage   90.47%   90.46%   -0.01%     
==========================================
  Files         277      277              
  Lines       68315    68339      +24     
==========================================
+ Hits        61806    61824      +18     
- Misses       6509     6515       +6     
Flag Coverage Δ
browsertest 66.34% <87.87%> (+0.04%) ⬆️
fonttest 8.99% <0.00%> (-0.02%) ⬇️
integrationtest 69.45% <42.42%> (-0.03%) ⬇️
unittest 60.91% <90.90%> (+<0.01%) ⬆️
unittestcli 58.65% <90.90%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Viewer preview

🗑️ Viewer previews removed.

sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Oct 24, 2026
@codspeed

codspeed Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 8.41%

⚡ 10 improved benchmarks
✅ 78 untouched benchmarks
⏩ 86 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ OperatorList.addOp: text (issue12963.pdf) 554.8 µs 456.3 µs +21.6%
⚡ OperatorList.addOp: image masks (bug1799927.pdf) 2 ms 1.8 ms +10.18%
⚡ FlateStream: content streams from a ChunkedStream (tracemonkey.pdf) 124.2 ms 114.1 ms +8.93%
⚡ MetadataParser: XMP (issue11144_reduced.pdf) 4.7 ms 4.4 ms +8.08%
⚡ getUnicodeRangeFor (bug1473809.pdf) 30.4 ms 28.2 ms +7.77%
⚡ XFAFactory: parse, bind and layout (xfa_issue14315.pdf) 9.8 ms 9.2 ms +6.59%
⚡ OperatorList.addOp: paths and clips (bug1703683_page2_reduced.pdf) 6.2 ms 5.8 ms +5.96%
⚡ EvaluatorPreprocessor.read: paths (bug1743245.pdf) 60.7 ms 57.5 ms +5.62%
⚡ XFAFactory: parse and bind (issue14130.pdf) 5.4 ms 5.1 ms +5.28%
⚡ createImage: signature (samplesignature.png) 161.2 ms 153.6 ms +5.01%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing calixteman:issue5377 (2982549) with master (a30101a)

Open in CodSpeed

Footnotes

  1. 86 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Reference tests

Results for 040a575 (run, references from mozilla/pdf.js.refs@2ef32a7411).

Platform Status Tests Total runtime Errors Different FBF No reference Report
Linux ⚠️ 1407 11m 39s 0 0 0 1
Windows ⚠️ 1407 16m 45s 0 0 0 1

The report is kept for 30 days and replaced by the next run.

sync-pdfs-for-pdf-js Bot pushed a commit to mozilla/pdf.js.refs that referenced this pull request Oct 24, 2026

@Snuffleupagus Snuffleupagus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

r=me, thanks.

Comment thread src/core/fonts.js Resolved
With 65535 glyphs, CFF cannot append a copy of glyph 0. The old mapping
used the last glyph instead.

Reuse an empty slot and copy glyph 0's outline, width and FDSelect entry.
Keep the replaced glyph's original characters unmapped.

It fixes mozilla#5377.
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.

Missing glyphs in Source Han Sans font poster

3 participants