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 incorrect text width with newer (1.43?) Pango #2184

Merged
merged 1 commit into from Jan 4, 2023
Merged

Conversation

chearon
Copy link
Collaborator

@chearon chearon commented Jan 2, 2023

Text renders wider or narrower, as if letter-spacing is set, than it should with newer versions of Pango.

master (node-canvas - browser) ch/text-width (node-canvas - browser)
Screen Shot 2023-01-02 at 5 54 29 PM Screen Shot 2023-01-02 at 5 53 10 PM

My best understanding of this problem is that around version 1.43 Pango dropped support for font hinting because it switched to Harbuzz for glyph postions instead of Freetype. For some reason it still rounds the glyph positions by default.

There's no need for node-canvas to support font hinting. The maintainers of the Linux font stack (Behdad and Matthias) have stated that they wont, and font hinting is subjective, and browsers have moved to subpixel positioning too.

Reading (warning: lots of drama to wade through):

Text renders wider or narrower, as if letter-spacing is set, than
it should with newer versions of Pango.

My best understanding of this problem is that around version 1.43
Pango dropped support for font hinting because it switched to
Harbuzz for glyph postions instead of Freetype. For some reason it
still rounds the glyph positions by default.

There's no need for node-canvas to support font hinting. The
maintainers of the Linux font stack (Behdad and Matthias) have
stated that they wont, and font hinting is subjective, and
browsers have moved to subpixel positioning too.

Reading (warning: lots of drama to wade through):
- https://gitlab.gnome.org/GNOME/pango/-/issues/404
- https://gitlab.gnome.org/GNOME/pango/-/issues/463
- harfbuzz/harfbuzz#1892
- harfbuzz/harfbuzz#2394
Copy link
Collaborator

@LinusU LinusU left a comment

Choose a reason for hiding this comment

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

👍

@zbjornson zbjornson merged commit 4c276e0 into master Jan 4, 2023
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.

None yet

3 participants