Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: calculate advance width for ch correctly #1608

Merged
merged 1 commit into from
Mar 22, 2022

Conversation

aschmitz
Copy link
Contributor

The "ch" value uses the advance width - not the ink width - of the "0" character.

This gets us closer to the results from line_break's line_size method, the only thing missing would be adding in the value of style['letter_spacing']. This method already avoids touching that because it could cause recursion, but it's not clear that it should be included anyway: the relevant spec seems to say only:

The advance measure of a glyph depends on writing-mode and text-orientation as well as font settings, text-transform, and any other properties that affect glyph selection or orientation.

(emphasis added)

Which would seem to indicate that perhaps we don't actually want to care about the letter spacing purely as part of the ch measurement.

The "ch" value uses the advance width - not the ink width - of the "0"
character.
@aschmitz
Copy link
Contributor Author

Apologies for this and #1607, clearly I should have done more testing before pushing 4833bf6.

With this commit, my render tests with documents that use both ex and ch generate pixel-identical PDFs to 5ad3b1d. (They didn't without both relevant PRs.)

@liZe
Copy link
Member

liZe commented Mar 22, 2022

The "ch" value uses the advance width - not the ink width - of the "0" character.

Funny to note that we shared this behavior with Internet Explorer (rest in peace).

Apologies for this and #1607, clearly I should have done more testing before pushing 4833bf6.

I should have too before merging!

With this commit, my render tests with documents that use both ex and ch generate pixel-identical PDFs to 5ad3b1d. (They didn't without both relevant PRs.)

That’s good to know.

@liZe liZe merged commit 9449297 into Kozea:master Mar 22, 2022
@grewn0uille grewn0uille added this to the 55.0 milestone Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants