[API] One last font-funcs API change Now that vertical text works correctly, I'm doing a last round modification of the font-funcs API to simplify. Expect no more changes around here.
diff --git a/test/test-font.c b/test/test-font.c index 2bf5224..40540c4 100644 --- a/test/test-font.c +++ b/test/test-font.c
@@ -121,8 +121,7 @@ g_assert_cmpint (x, ==, 0); g_assert_cmpint (y, ==, 0); - x = 13; - hb_font_get_glyph_h_advance (font, 17, &x); + x = hb_font_get_glyph_h_advance (font, 17); g_assert_cmpint (x, ==, 0); extents.x_bearing = extents.y_bearing = 13; @@ -138,7 +137,7 @@ g_assert_cmpint (glyph, ==, 0); x = 13; - hb_font_get_glyph_h_kerning (font, 17, 19, &x); + x = hb_font_get_glyph_h_kerning (font, 17, 19); g_assert_cmpint (x, ==, 0); } @@ -236,15 +235,15 @@ glyph, point_index, x, y); } -static void +static hb_position_t glyph_h_advance_func1 (hb_font_t *font, void *font_data, hb_codepoint_t glyph, - hb_position_t *advance, void *user_data) { - if (glyph == 1) { - *advance = 8; - } + if (glyph == 1) + return 8; + + return 0; } static void @@ -287,9 +286,9 @@ g_assert (!hb_font_get_glyph_contour_point_for_origin (font1, 3, 7, HB_DIRECTION_RTL, &x, &y)); g_assert_cmpint (x, ==, 0); g_assert_cmpint (y, ==, 0); - hb_font_get_glyph_h_advance (font1, 1, &x); + x = hb_font_get_glyph_h_advance (font1, 1); g_assert_cmpint (x, ==, 8); - hb_font_get_glyph_h_advance (font1, 2, &x); + x = hb_font_get_glyph_h_advance (font1, 2); g_assert_cmpint (x, ==, 0); @@ -313,9 +312,9 @@ g_assert (!hb_font_get_glyph_contour_point_for_origin (font2, 3, 7, HB_DIRECTION_LTR, &x, &y)); g_assert_cmpint (x, ==, 0); g_assert_cmpint (y, ==, 0); - hb_font_get_glyph_h_advance (font2, 1, &x); + x = hb_font_get_glyph_h_advance (font2, 1); g_assert_cmpint (x, ==, 8); - hb_font_get_glyph_h_advance (font2, 2, &x); + x = hb_font_get_glyph_h_advance (font2, 2); g_assert_cmpint (x, ==, 0); @@ -336,9 +335,9 @@ g_assert (!hb_font_get_glyph_contour_point_for_origin (font3, 3, 7, HB_DIRECTION_LTR, &x, &y)); g_assert_cmpint (x, ==, 0*2); g_assert_cmpint (y, ==, 0*3); - hb_font_get_glyph_h_advance (font3, 1, &x); + x = hb_font_get_glyph_h_advance (font3, 1); g_assert_cmpint (x, ==, 8*2); - hb_font_get_glyph_h_advance (font3, 2, &x); + x = hb_font_get_glyph_h_advance (font3, 2); g_assert_cmpint (x, ==, 0*2);
diff --git a/test/test-shape.c b/test/test-shape.c index 64594b2..c8017bf 100644 --- a/test/test-shape.c +++ b/test/test-shape.c
@@ -37,17 +37,17 @@ static const char test_data[] = "test\0data"; -static void +static hb_position_t glyph_h_advance_func (hb_font_t *font, void *font_data, hb_codepoint_t glyph, - hb_position_t *advance, void *user_data) { switch (glyph) { - case 1: *advance = 10; return; - case 2: *advance = 6; return; - case 3: *advance = 5; return; + case 1: return 10; + case 2: return 6; + case 3: return 5; } + return 0; } static hb_bool_t @@ -61,19 +61,18 @@ case 'e': *glyph = 2; return TRUE; case 's': *glyph = 3; return TRUE; } - return FALSE; } -static void +static hb_position_t glyph_h_kerning_func (hb_font_t *font, void *font_data, hb_codepoint_t left, hb_codepoint_t right, - hb_position_t *kerning, void *user_data) { - if (left == 1 && right == 2) { - *kerning = -2; - } + if (left == 1 && right == 2) + return -2; + + return 0; } static const char TesT[] = "TesT";