Skip to content

Account for the Firefox font size quantization in the text layer - #21810

Merged
calixteman merged 1 commit into
mozilla:masterfrom
calixteman:quantize_measured_font_size
Sep 2, 2026
Merged

calixteman merged 1 commit into
mozilla:masterfrom
calixteman:quantize_measured_font_size

Conversation

@calixteman

Copy link
Copy Markdown
Contributor

Firefox rounds the font size set on a canvas 2d context, once divided by the device pixel ratio, to 7 bits of precision. Hence measureText can return a width up to ~1% off the one the spans are laid out with, which made --scale-x slightly wrong in a zoom dependent way. Measure with a size left untouched by that rounding and rescale the returned width, which is linear in the font size.

@codecov-commenter

codecov-commenter commented Aug 21, 2026 •

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 90.19%. Comparing base (49ff3dc) to head (651ee70).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #21810   +/-   ##
=======================================
  Coverage   90.18%   90.19%           
=======================================
  Files         264      264           
  Lines       67312    67320    +8     
=======================================
+ Hits        60707    60720   +13     
+ Misses       6605     6600    -5     
Flag Coverage Ξ”
browsertest 66.32% <93.33%> (+<0.01%) ⬆️
fonttest 8.92% <ΓΈ> (ΓΈ)
integrationtest 69.41% <100.00%> (+0.01%) ⬆️
unittest 58.38% <93.33%> (+<0.01%) ⬆️
unittestcli 56.93% <0.00%> (-0.03%) ⬇️

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.

Comment thread src/display/text_layer.js Resolved
@timvandermeij

Copy link
Copy Markdown
Collaborator

/botio browsertest

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/31dfc3b1d7e65f1/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/4e301653b974ed6/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/31dfc3b1d7e65f1/output.txt

Total script time: 18.92 mins

  • Regression tests: FAILED
  different ref/snapshot: 75

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

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/4e301653b974ed6/output.txt

Total script time: 23.77 mins

  • Regression tests: FAILED
  different ref/snapshot: 72

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

@calixteman

Copy link
Copy Markdown
Contributor Author

The diff are expected.

@calixteman
calixteman merged commit 74515c6 into mozilla:master Sep 2, 2026
21 checks passed
@calixteman

Copy link
Copy Markdown
Contributor Author

/botio makeref

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/d0ff812ccec0985/output.txt

@moz-tools-bot

Copy link
Copy Markdown
Collaborator

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/e53356f25b90a8a/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/d0ff812ccec0985/output.txt

Total script time: 19.02 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/e53356f25b90a8a/output.txt

Total script time: 24.23 mins

  • Make references: Passed
  • Check references: Passed

This branch was previously deployed

1 inactive deployment
code-coverage β€” 651ee701 Deployed Aug 26, 2026 by calixteman via windows-latest / firefox #1324
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.

5 participants