attempt to offset vertical glyphs (#575) (#485) #619
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.