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

attempt to offset vertical glyphs (#575) (#485) #619

Closed
wants to merge 1 commit into from

Conversation

marklh9
Copy link

@marklh9 marklh9 commented Nov 17, 2017

This patch would fix incorrect glyph position
highlighted in https://imgur.com/a/I0jJU as well
as in #485. I try to explain my point of view
and would like to know if I'm correct.

Note: for harfbuzz I have do some cairo translate.
In LibreOffice I don't. I don't know why.

Original issue is to fix text offset issue of
vertical writing in LibreOffice (#575)
after LibreOffice update its HarfBuzz from 1.3.3 to 1.4.8.
I tried to figure out how to use those values empirically.

Y_offset was 0 with HarfBuzz 1.3.3 and has
become -1160 (roughly 1EM upward) after upgrade to
1.4.8, I suspect that the offsets returned by Harfbuzz
are always repect to h_origin:

subtract_glyph_v_origin()
-> get_glyph_v_origin_with_fallback
-> guess_v_origin_minus_h_origin

But underlying renderer might expect positions relative
to the vertical origin. To compensate the result
I try to translate them back by calling
hb_font_add_glyph_origin_for_direction(),
to add the horizontal origin, hence make offset
relative to the v origin.

This patch would fix incorrect glyph position
highlighted in https://imgur.com/a/I0jJU as well
as in harfbuzz#485. I try to explain my point of view
and would like to know if I'm correct.

Note: for harfbuzz I have do some cairo translate.
In LibreOffice I don't. I don't know why.

Original issue is to fix text offset issue of
vertical writing in LibreOffice after LibreOffice
update its HarfBuzz from 1.3.3 to 1.4.8. I tried
to figure out how to use those values emprically.

Y_offset was 0 with HarfBuzz 1.3.3 and has
become -1160 (roughly 1EM upward) after upgrade to
1.4.8, I suspect that the offsets returned by Harfbuzz
are always repect to h_origin:

subtract_glyph_v_origin()
-> get_glyph_v_origin_with_fallback
-> guess_v_origin_minus_h_origin

But underlying renderer might expect positions relative
to the vertical origin. To compensate the result
I try to translate them back by calling
hb_font_add_glyph_origin_for_direction(),
to add the horizontal origin, hence make offset
relative to the v origin.
@behdad
Copy link
Member

behdad commented Feb 9, 2021

I'll try to review this soon. I've learned a lot about what's going on while debugging a similar issue on the Pango side. See #2765

@behdad
Copy link
Member

behdad commented Feb 16, 2022

I don't think this is correct. Our vertical support should be correct already.

@behdad behdad closed this Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Vertical Vertical text direction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants