Skip to content

Remove the unused bbox setter in the FontFaceObject class (PR 20427 follow-up)#20869

Merged
Snuffleupagus merged 1 commit intomozilla:masterfrom
Snuffleupagus:FontFaceObject-rm-bbox-setter
Mar 15, 2026
Merged

Remove the unused bbox setter in the FontFaceObject class (PR 20427 follow-up)#20869
Snuffleupagus merged 1 commit intomozilla:masterfrom
Snuffleupagus:FontFaceObject-rm-bbox-setter

Conversation

@Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Mar 14, 2026

The commit message for the patch in PR #20427 is pretty non-descriptive, being only a single line, however there's a bit more context in #20427 (comment) but unfortunately the details there don't really make sense.
Note that the PR only changed main-thread code, but all the links are to worker-thread code!?

The FontFaceObject class is only used on the main-thread, and when encountering a broken font we fallback to the built-in font renderer; see

try {
await nativeFontFace.loaded;
} catch (ex) {
warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);
// When font loading failed, fall back to the built-in font renderer.
font.disableFontFace = true;
throw ex;
}
Hence the FontFaceObject class only needs a way to set the disableFontFace property, however nowhere on the main-thread do we ever update the bbox of a font.

@Snuffleupagus

This comment was marked as outdated.

@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.53%. Comparing base (1192e5e) to head (f1e1973).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #20869      +/-   ##
==========================================
- Coverage   62.54%   62.53%   -0.01%     
==========================================
  Files         173      173              
  Lines      121238   121234       -4     
==========================================
- Hits        75829    75818      -11     
- Misses      45409    45416       +7     
Flag Coverage Δ
fonttest 7.66% <ø> (?)
unittestcli 62.51% <ø> (-0.04%) ⬇️

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.

@Snuffleupagus Snuffleupagus force-pushed the FontFaceObject-rm-bbox-setter branch from 7e45b3c to e5a37de Compare March 14, 2026 09:15
@mozilla mozilla deleted a comment from moz-tools-bot Mar 14, 2026
@mozilla mozilla deleted a comment from moz-tools-bot Mar 14, 2026
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/53acd96a796dfac/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/53acd96a796dfac/output.txt

Total script time: 1.20 mins

Published

@Snuffleupagus
Copy link
Collaborator Author

/botio browsertest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/59e959a87ac54a5/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_browsertest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/3e6f904d9017178/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/59e959a87ac54a5/output.txt

Total script time: 18.88 mins

  • Regression tests: FAILED
  different ref/snapshot: 1

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

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/3e6f904d9017178/output.txt

Total script time: 25.52 mins

  • Regression tests: FAILED
  different ref/snapshot: 1

Image differences available at: http://54.193.163.58:8877/3e6f904d9017178/reftest-analyzer.html#web=eq.log

…27 follow-up)

The commit message for the patch in PR 20427 is pretty non-descriptive, being only a single line, however there's a bit more context in mozilla#20427 (comment) but unfortunately the details there don't really make sense.
Note that the PR only changed main-thread code, but all the links are to worker-thread code!?

The `FontFaceObject` class is only used on the main-thread, and when encountering a broken font we fallback to the built-in font renderer; see https://github.com/mozilla/pdf.js/blob/820b70eb25b1c6bf74f916e002d11afc49e929cf/src/display/font_loader.js#L135-L143
Hence the `FontFaceObject` class *only* needs a way to set the `disableFontFace` property, however nowhere on the main-thread do we ever update the `bbox` of a font.
@Snuffleupagus Snuffleupagus force-pushed the FontFaceObject-rm-bbox-setter branch from e5a37de to f1e1973 Compare March 15, 2026 20:16
@Snuffleupagus
Copy link
Collaborator Author

Rebased to master, no actual code changes made.

Copy link
Contributor

@calixteman calixteman left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you.

@Snuffleupagus Snuffleupagus merged commit d38cddf into mozilla:master Mar 15, 2026
12 checks passed
@Snuffleupagus Snuffleupagus deleted the FontFaceObject-rm-bbox-setter branch March 15, 2026 21:46
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.

4 participants