diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index ec77c2b43..5352156f0 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -944,9 +944,9 @@ struct glyf return; } extents->x_bearing = font->em_scalef_x (min_x); - extents->width = font->em_scalef_x (max_x - min_x); + extents->width = font->em_scalef_x (max_x) - extents->x_bearing; extents->y_bearing = font->em_scalef_y (max_y); - extents->height = font->em_scalef_y (min_y - max_y); + extents->height = font->em_scalef_y (min_y) - extents->y_bearing; } protected: diff --git a/test/api/test-ot-metrics-tt-var.c b/test/api/test-ot-metrics-tt-var.c index ac03514bf..9871c0815 100644 --- a/test/api/test-ot-metrics-tt-var.c +++ b/test/api/test-ot-metrics-tt-var.c @@ -55,7 +55,7 @@ test_extents_tt_var (void) g_assert_cmpint (extents.x_bearing, ==, 0); g_assert_cmpint (extents.y_bearing, ==, 874); - g_assert_cmpint (extents.width, ==, 550); + g_assert_cmpint (extents.width, ==, 551); g_assert_cmpint (extents.height, ==, -874); hb_font_destroy (font); @@ -186,7 +186,7 @@ test_extents_tt_var_comp (void) g_assert_cmpint (extents.x_bearing, ==, 19); g_assert_cmpint (extents.y_bearing, ==, 663); g_assert_cmpint (extents.width, ==, 519); - g_assert_cmpint (extents.height, ==, -894); + g_assert_cmpint (extents.height, ==, -895); result = hb_font_get_glyph_extents (font, 3, &extents); /* Cacute, acute y-scaled by 0.8, with unscaled component offset (default) */ g_assert (result);