calculate extents based on scaled then rounded values; undo two of the earlier test result adjustments

This commit is contained in:
justvanrossum 2021-02-17 10:13:54 +01:00 committed by Behdad Esfahbod
parent 1d02e9c63b
commit d01ebeae21
2 changed files with 4 additions and 4 deletions

View File

@ -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:

View File

@ -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);