# HG changeset patch # User Thinker K.F. Li # Date 1248765102 -28800 # Node ID 3ba48126c49c1b20ff63e2e81e5ba563104b294a # Parent c6c0d017dc8ebca26e08daad9295a36938e6138c Check bearing and advance of text_extents. diff -r c6c0d017dc8e -r 3ba48126c49c src/shape_stext.c --- a/src/shape_stext.c Tue Jul 28 15:11:42 2009 +0800 +++ b/src/shape_stext.c Tue Jul 28 15:11:42 2009 +0800 @@ -597,6 +597,8 @@ static void test_compute_text_extents(void) { co_aix matrix[6] = {10, 0, 0, 0, 10, 0}; + co_aix x_adv1, x_adv2; + co_aix x_bearing1, x_bearing2; mb_font_face_t *face; mb_scaled_font_t *scaled; mb_text_extents_t ext; @@ -609,8 +611,24 @@ compute_text_extents(scaled, "test", &ext); CU_ASSERT(MBE_GET_HEIGHT(&ext) >= 5 && MBE_GET_HEIGHT(&ext) <= 12); CU_ASSERT(MBE_GET_WIDTH(&ext) >= 16 && MBE_GET_WIDTH(&ext) <= 48); + x_adv1 = MBE_GET_X_ADV(&ext); + x_bearing1 = MBE_GET_X_BEARING(&ext); + scaled_font_free(scaled); + matrix[2] = 5; + scaled = make_scaled_font_face_matrix(face, matrix); + CU_ASSERT(scaled != NULL); + + compute_text_extents(scaled, "test", &ext); + CU_ASSERT(MBE_GET_HEIGHT(&ext) >= 5 && MBE_GET_HEIGHT(&ext) <= 12); + CU_ASSERT(MBE_GET_WIDTH(&ext) >= 16 && MBE_GET_WIDTH(&ext) <= 48); + x_adv2 = MBE_GET_X_ADV(&ext); + x_bearing2 = MBE_GET_X_BEARING(&ext); scaled_font_free(scaled); + + CU_ASSERT(x_adv1 == x_adv2); + CU_ASSERT((x_bearing1 + 5) == x_bearing2); + free_font_face(face); }