From c743ec5886a1f6d57de26da33a770a8706be83d6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 5 Nov 2015 17:33:57 -0800 Subject: [PATCH] [ft] Fix extents with negative scales Fixes https://github.com/behdad/harfbuzz/issues/162 --- src/hb-ft.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 56309647b..9b872ea58 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -277,6 +277,16 @@ hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED, extents->y_bearing = ft_face->glyph->metrics.horiBearingY; extents->width = ft_face->glyph->metrics.width; extents->height = -ft_face->glyph->metrics.height; + if (font->x_scale < 0) + { + extents->x_bearing = -extents->x_bearing; + extents->width = -extents->width; + } + if (font->y_scale < 0) + { + extents->y_bearing = -extents->y_bearing; + extents->height = -extents->height; + } return true; }