Merge branch 'master' into cff-subset

This commit is contained in:
Michiharu Ariza committed 2018-11-06 09:57:17 -08:00
commit 43ee0e4d00
41 files changed
+445 -638

No files matched your search

View File
Whitespace-only changes.
+2 -2
View File
@@ -153,9 +153,9 @@ check-gtester:
# Check tests under valgrind. Saves log to log-valgrind.txt
VALGRIND_FLAGS = \
--tool=memcheck --suppressions=$(srcdir)/.valgrind-suppressions \
--tool=memcheck \
--track-origins=yes \
--leak-check=yes
--leak-check=yes \
$(EXTRA_VALGRIND_FLAGS)
# Can't do for now: --show-reachable=yes
CLEANFILES += log-valgrind.txt
+29 -28
View File
@@ -33,7 +33,8 @@
static void
test_face (hb_face_t *face)
test_face (hb_face_t *face,
hb_codepoint_t cp)
{
hb_font_t *font = hb_font_create (face);
hb_ot_font_set_funcs (font);
@@ -41,35 +42,35 @@ test_face (hb_face_t *face)
hb_set_t *set = hb_set_create ();
hb_face_collect_unicodes (face, set);
hb_face_collect_variation_selectors (face, set);
hb_face_collect_variation_unicodes (face, 0, set);
hb_face_collect_variation_unicodes (face, cp, set);
hb_codepoint_t g;
hb_position_t x, y;
hb_glyph_extents_t extents;
char buf[5] = {0};
hb_font_get_nominal_glyph (font, 0, &g);
hb_font_get_variation_glyph (font, 0, 0, &g);
hb_font_get_glyph_h_advance (font, g);
hb_font_get_glyph_v_advance (font, g);
hb_font_get_glyph_h_origin (font, g, &x, &y);
hb_font_get_glyph_v_origin (font, g, &x, &y);
hb_font_get_glyph_extents (font, g, &extents);
hb_font_get_glyph_contour_point (font, g, 0, &x, &y);
hb_font_get_glyph_name (font, g, buf, sizeof (buf));
hb_font_get_nominal_glyph (font, cp, &g);
hb_font_get_variation_glyph (font, cp, cp, &g);
hb_font_get_glyph_h_advance (font, cp);
hb_font_get_glyph_v_advance (font, cp);
hb_font_get_glyph_h_origin (font, cp, &x, &y);
hb_font_get_glyph_v_origin (font, cp, &x, &y);
hb_font_get_glyph_extents (font, cp, &extents);
hb_font_get_glyph_contour_point (font, cp, 0, &x, &y);
hb_font_get_glyph_name (font, cp, buf, sizeof (buf));
hb_font_get_glyph_from_name (font, buf, strlen (buf), &g);
hb_ot_color_has_palettes (face);
hb_ot_color_palette_get_count (face);
hb_ot_color_palette_get_name_id (face, 0);
hb_ot_color_palette_color_get_name_id (face, 0);
hb_ot_color_palette_get_flags (face, 0);
hb_ot_color_palette_get_colors (face, 0, 0, NULL, NULL);
hb_ot_color_palette_get_name_id (face, cp);
hb_ot_color_palette_color_get_name_id (face, cp);
hb_ot_color_palette_get_flags (face, cp);
hb_ot_color_palette_get_colors (face, cp, 0, NULL, NULL);
hb_ot_color_has_layers (face);
hb_ot_color_glyph_get_layers (face, 0, 0, NULL, NULL);
hb_ot_color_glyph_get_layers (face, cp, 0, NULL, NULL);
hb_ot_color_has_svg (face);
hb_blob_destroy (hb_ot_color_glyph_reference_svg (face, 0));
hb_blob_destroy (hb_ot_color_glyph_reference_svg (face, cp));
hb_ot_color_has_png (face);
hb_blob_destroy (hb_ot_color_glyph_reference_png (font, 0));
hb_blob_destroy (hb_ot_color_glyph_reference_png (font, cp));
hb_ot_layout_has_glyph_classes (face);
hb_ot_layout_has_substitution (face);
@@ -77,19 +78,19 @@ test_face (hb_face_t *face)
hb_ot_math_has_data (face);
hb_ot_math_get_constant (font, HB_OT_MATH_CONSTANT_MATH_LEADING);
hb_ot_math_get_glyph_italics_correction (font, 0);
hb_ot_math_get_glyph_top_accent_attachment (font, 0);
hb_ot_math_is_glyph_extended_shape (face, 0);
hb_ot_math_get_glyph_kerning (font, 0, HB_OT_MATH_KERN_BOTTOM_RIGHT, 0);
hb_ot_math_get_glyph_variants (font, 0, HB_DIRECTION_TTB, 0, NULL, NULL);
hb_ot_math_get_glyph_italics_correction (font, cp);
hb_ot_math_get_glyph_top_accent_attachment (font, cp);
hb_ot_math_is_glyph_extended_shape (face, cp);
hb_ot_math_get_glyph_kerning (font, cp, HB_OT_MATH_KERN_BOTTOM_RIGHT, 0);
hb_ot_math_get_glyph_variants (font, cp, HB_DIRECTION_TTB, 0, NULL, NULL);
hb_ot_math_get_min_connector_overlap (font, HB_DIRECTION_RTL);
hb_ot_math_get_glyph_assembly (font, 0, HB_DIRECTION_BTT, 0, NULL, NULL, NULL);
hb_ot_math_get_glyph_assembly (font, cp, HB_DIRECTION_BTT, 0, NULL, NULL, NULL);
unsigned int len = sizeof (buf);
hb_ot_name_list_names (face, NULL);
hb_ot_name_get_utf8 (face, 0, NULL, &len, buf);
hb_ot_name_get_utf16 (face, 0, NULL, NULL, NULL);
hb_ot_name_get_utf32 (face, 0, NULL, NULL, NULL);
hb_ot_name_get_utf8 (face, cp, NULL, &len, buf);
hb_ot_name_get_utf16 (face, cp, NULL, NULL, NULL);
hb_ot_name_get_utf32 (face, cp, NULL, NULL, NULL);
hb_ot_var_get_axis_count (face);
hb_ot_var_get_axes (face, 0, NULL, NULL);
@@ -104,7 +105,7 @@ test_face (hb_face_t *face)
static void
test_ot_face_empty (void)
{
test_face (hb_face_get_empty ());
test_face (hb_face_get_empty (), 0);
}
int
+24 -3
View File
@@ -27,10 +27,11 @@
#include <hb-ot.h>
static hb_face_t *face;
static void
test_ot_layout_feature_get_name_ids_and_characters (void)
{
hb_face_t *face = hb_test_open_font_file ("fonts/cv01.otf");
hb_tag_t cv01 = HB_TAG ('c','v','0','1');
unsigned int feature_index;
if (!hb_ot_layout_language_find_feature (face,
@@ -68,8 +69,24 @@ test_ot_layout_feature_get_name_ids_and_characters (void)
g_assert_cmpint (char_count, ==, 2);
g_assert_cmpint (characters[0], ==, 10);
g_assert_cmpint (characters[1], ==, 24030);
}
hb_face_destroy (face);
static void
test_ot_name (void)
{
unsigned int num_entries;
const hb_ot_name_entry_t *entries;
entries = hb_ot_name_list_names (face, &num_entries);
g_assert_cmpuint (12, ==, num_entries);
hb_ot_name_id_t name_id = entries[3].name_id;
g_assert_cmpuint (3, ==, name_id);
hb_language_t lang = entries[3].language;
g_assert_cmpstr ("en", ==, hb_language_to_string (lang));
char text[10];
unsigned int text_size = 10;
g_assert_cmpuint (27, ==, hb_ot_name_get_utf8 (face, name_id, lang, &text_size, text));
g_assert_cmpuint (9, ==, text_size);
g_assert_cmpstr (text, ==, "FontForge");
}
int
@@ -78,6 +95,10 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
hb_test_add (test_ot_layout_feature_get_name_ids_and_characters);
hb_test_add (test_ot_name);
return hb_test_run ();
face = hb_test_open_font_file ("fonts/cv01.otf");
unsigned int status = hb_test_run ();
hb_face_destroy (face);
return status;
}