Skip to content

Fix placement of marks in upright vertical text for fonts without vertical metrics.

Tavmjong Bah requested to merge tavmjong1/pango:vertical-upright-glyphs into master

The merge request !168 (merged) fixes #454 (closed) by shifting glyphs using values from hb_font_get_glyph_v_origin(). The need to shift glyphs is because HarfBuzz shaping is relative to the horizontal origin while pre-HarfBuzz, shaping was relative to the vertical origin (see !168 (comment 981983)). Passing FC_VERTICAL true to pangocairo-fc causes Cairo to shift the glyphs from the horizontal origin to the vertical origin. Basically, the glyph shifting in !168 (merged) undoes this shift. The problem is that the shift calculated by HarfBuzz is not the inverse of the shift calculated by Cairo (HarfBuzz seems to match "HarfBuzz OpenType functions" glyph positioning where glyphs are moved so the top of their ink-rectangle is aligned with the top of the em-box while Cairo matches "HarfBuzz FreeType functions" glyph positioning which centers glyphs inside the em-box).

This merge request avoids the issue altogether by disabling Cairo's glyph shifts. With those shifts disabled, there is no need for Pango to undo the shifts. This fixes anchored glyph positioning as seen in the figure below.

Note: The minus sign change in !168 (merged) does fix a different issue and needs to be kept.

Incorrect glyph placement (before this merge request): Vertical_Glyphs_Incorrect

Correct glyph placement (after this merge request): Vertical_Glyphs_Correct

Merge request reports