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

rounding differences between harfbuzz and cairo #1892

Open
matthiasclasen opened this issue Aug 7, 2019 · 5 comments

Comments

@matthiasclasen
Copy link

commented Aug 7, 2019

In pango 1.44, we've replaced cairo by harfbuzz for getting glyph extents. Some people complain that fonts are 'stretched' now (https://gitlab.gnome.org/GNOME/pango/issues/404).

Comparing 1.43 and 1.44, I find that i get this returned from cairo (note that the values here are rounded to multiples of 1024:

glyph 78 width 3072 
glyph 83 width 8192 
glyph 74 width 8192

And this is what i get from harfbuzz:

glyph 78 width 3652
glyph 83 width 8294
glyph 74 width 7964

the harfbuzz values are not rounded, that is ok. The issue here is that 3652 rounds to 4096, giving us an extra pixel of width for that glyph.

I haven't gotten to the bottom of why these values are different. I did notice that the scales of the font are similar enough to not be the reason: 15024 (with 1.43) vs 15019 (with 1.44).

@behdad

This comment has been minimized.

Copy link
Member

commented Aug 7, 2019

What kind of hinting setting is that with?

@matthiasclasen

This comment has been minimized.

Copy link
Author

commented Aug 7, 2019

everything is default:

font options: antialias 0 subpixel_order 0 hint-style 0 hint-metrics 0

i can turn hint-metrics off if you think it matters for what cairo returns

Look at that, it does:

glyph 78 advance 3652
glyph 83 advance 8294
glyph 74 advance 7964

This is cairo with hint-metrics off

@matthiasclasen

This comment has been minimized.

Copy link
Author

commented Aug 7, 2019

Where does this leave us ? harfbuzz is giving me the same values are cairo with hint-metrics off.
But rounding those values on the pango side does not reproduce the same values as cairo with hint-metrics on.

@jfkthame

This comment has been minimized.

Copy link
Collaborator

commented Aug 7, 2019

@mxmilkb

This comment has been minimized.

Copy link

commented Aug 16, 2019

This issue was mentioned in #sway in regard to a font clipping/shrinking issue in sway-bar, but I'd like to confirm if this issue is actually related?

rose_2019-08-14-110559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.