-
Notifications
You must be signed in to change notification settings - Fork 606
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
Chinese Characters not well aligned with 'vpal' feature enabled #485
Comments
|
Assigning to @kenlunde to see if he can figure out what's going on. I have no idea and no time to debug any time soon. |
|
@behdad: The glyph for a single ideograph, U+4E00 一, is included within the scope of the 'vpal' GPOS feature. The following is my raw (using Unicode-based working glyph names) "features" file code for this glyph:
The second element adjusts lowers the Y-axis origin by 140 units, whose effect is to raise the glyph by 140 units. The fourth element trims 280 units from the vertical advance, making it 720 units. The end result is that 140 units are trimmed from both the top and bottom of the glyph. |
|
So HarfBuzz need to handle all four elements to clip the glyph when this feature is activated. BTW I found HarfBuzz has the similar problem for 'vhal' feature. |
|
The 'vert' GPOS (not GSUB) feature also uses the same four elements, so it needs to be checked, too. However, given that U+3001 、 IDEOGRAPHIC COMMA seems to behave correctly and is handled via the same feature ('vpal'), I wonder whether something else it at work here. |
|
We seems to be applying GPOS just fine. However, neither FreeType nor hb-ot-font implement VORG table. I don't know what the reporter's screenshots are coming from, but probably same issue. Without VORG, it's not possible to correctly get the vertical glyph origin.. |
The first screenshot generated directly by hb-view.exe; the second image found at Type is Beautiful, according to TIB, this screenshot came from Adobe Illustrator to show the effect when enabling 'vpal' feature in SHS font. |
|
So this can be consider as duplicate of #250, isn’t it? |
|
What's the text sequence? |
You can copying from here: |
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.
|
After I got HarfBuzz 2.2.0, the problem is still there. So what’s wrong with it? |
|
This also seems fixed to me. |

I have tested hb-view with Source Han Serif font, if 'vpal' feature enabled, then Chinese Characters not centered, and the height have not been changed.


They should works as this (found at Type is Beautiful):
The text was updated successfully, but these errors were encountered: