From 7888a6b07a9922cedd3e0d235959058e0011357b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 28 Jan 2015 12:40:40 -0800 Subject: [PATCH] [ft] Handle negative scales with vertical writing --- src/hb-ft.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hb-ft.cc b/src/hb-ft.cc index f57f566..322f93a 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -118,6 +118,9 @@ hb_ft_get_glyph_v_advance (hb_font_t *font HB_UNUSED, if (unlikely (FT_Get_Advance (ft_face, glyph, load_flags, &v))) return 0; + if (font->y_scale < 0) + v = -v; + /* Note: FreeType's vertical metrics grows downward while other FreeType coordinates * have a Y growing upward. Hence the extra negation. */ return (-v + (1<<9)) >> 10; @@ -154,6 +157,11 @@ hb_ft_get_glyph_v_origin (hb_font_t *font HB_UNUSED, *x = ft_face->glyph->metrics.horiBearingX - ft_face->glyph->metrics.vertBearingX; *y = ft_face->glyph->metrics.horiBearingY - (-ft_face->glyph->metrics.vertBearingY); + if (font->x_scale < 0) + *x = -*x; + if (font->y_scale < 0) + *y = -*y; + return true; } -- 2.7.4