test_face_empty (void)
{
g_assert (hb_face_get_empty ());
- g_assert (hb_face_get_empty () != hb_face_create (hb_blob_get_empty (), 0));
- g_assert (hb_face_get_empty () != hb_face_create (NULL, 0));
+ g_assert (hb_face_get_empty () == hb_face_create (hb_blob_get_empty (), 0));
+ g_assert (hb_face_get_empty () == hb_face_create (NULL, 0));
g_assert (hb_face_reference_table (hb_face_get_empty (), HB_TAG ('h','e','a','d')) == hb_blob_get_empty ());
hb_codepoint_t glyph;
hb_position_t x, y;
hb_glyph_extents_t extents;
- unsigned int upem = hb_face_get_upem (hb_font_get_face (font));
x = y = 13;
g_assert (!hb_font_get_glyph_contour_point (font, 17, 2, &x, &y));
g_assert_cmpint (y, ==, 0);
x = hb_font_get_glyph_h_advance (font, 17);
- g_assert_cmpint (x, ==, upem);
+ g_assert_cmpint (x, ==, 0);
extents.x_bearing = extents.y_bearing = 13;
extents.width = extents.height = 15;
x = hb_font_get_glyph_h_advance (font1, 2);
g_assert_cmpint (x, ==, 0);
- /* creating sub-font doesn't make the parent font immutable;
- * making a font immutable however makes it's lineage immutable.
- */
- font2 = hb_font_create_sub_font (font1);
- font3 = hb_font_create_sub_font (font2);
- g_assert (!hb_font_is_immutable (font1));
- g_assert (!hb_font_is_immutable (font2));
- g_assert (!hb_font_is_immutable (font3));
- hb_font_make_immutable (font3);
- g_assert (hb_font_is_immutable (font1));
- g_assert (hb_font_is_immutable (font2));
- g_assert (hb_font_is_immutable (font3));
- hb_font_destroy (font2);
- hb_font_destroy (font3);
font2 = hb_font_create_sub_font (font1);
+ g_assert (hb_font_is_immutable (font1));
hb_font_destroy (font1);
/* setup font2 to override some funcs */
x = hb_font_get_glyph_h_advance (font2, 2);
g_assert_cmpint (x, ==, 0);
- /* setup font3 to override scale */
+
font3 = hb_font_create_sub_font (font2);
+ g_assert (hb_font_is_immutable (font2));
+ hb_font_destroy (font2);
+
+ /* setup font3 to override scale */
hb_font_set_scale (font3, 20, 30);
x = y = 1;
test_font_empty (void)
{
g_assert (hb_font_get_empty ());
- g_assert (hb_font_get_empty () != hb_font_create (hb_face_get_empty ()));
- g_assert (hb_font_get_empty () != hb_font_create (NULL));
- g_assert (hb_font_get_empty () != hb_font_create_sub_font (NULL));
+ g_assert (hb_font_get_empty () == hb_font_create (hb_face_get_empty ()));
+ g_assert (hb_font_get_empty () == hb_font_create (NULL));
+ g_assert (hb_font_get_empty () == hb_font_create_sub_font (NULL));
g_assert (hb_font_is_immutable (hb_font_get_empty ()));
g_assert (hb_font_get_face (hb_font_get_empty ()) == hb_face_get_empty ());
hb_font_t *subfont;
int x_scale, y_scale;
unsigned int x_ppem, y_ppem;
- unsigned int upem;
blob = hb_blob_create (test_data, sizeof (test_data), HB_MEMORY_MODE_READONLY, NULL, NULL);
face = hb_face_create (blob, 0);
g_assert (hb_font_get_face (font) == face);
- g_assert (hb_font_get_parent (font) == hb_font_get_empty ());
- subfont = hb_font_create_sub_font (font);
- g_assert (hb_font_get_parent (subfont) == font);
- hb_font_set_parent(subfont, NULL);
- g_assert (hb_font_get_parent (subfont) == hb_font_get_empty());
- hb_font_set_parent(subfont, font);
- g_assert (hb_font_get_parent (subfont) == font);
- hb_font_set_parent(subfont, NULL);
- hb_font_make_immutable (subfont);
- g_assert (hb_font_get_parent (subfont) == hb_font_get_empty());
- hb_font_set_parent(subfont, font);
- g_assert (hb_font_get_parent (subfont) == hb_font_get_empty());
- hb_font_destroy (subfont);
+ g_assert (hb_font_get_parent (font) == NULL);
/* Check scale */
- upem = hb_face_get_upem (hb_font_get_face (font));
hb_font_get_scale (font, NULL, NULL);
x_scale = y_scale = 13;
hb_font_get_scale (font, &x_scale, NULL);
- g_assert_cmpint (x_scale, ==, upem);
+ g_assert_cmpint (x_scale, ==, 0);
x_scale = y_scale = 13;
hb_font_get_scale (font, NULL, &y_scale);
- g_assert_cmpint (y_scale, ==, upem);
+ g_assert_cmpint (y_scale, ==, 0);
x_scale = y_scale = 13;
hb_font_get_scale (font, &x_scale, &y_scale);
- g_assert_cmpint (x_scale, ==, upem);
- g_assert_cmpint (y_scale, ==, upem);
+ g_assert_cmpint (x_scale, ==, 0);
+ g_assert_cmpint (y_scale, ==, 0);
hb_font_set_scale (font, 17, 19);