static hb_set_t *
_populate_gids_to_retain (hb_face_t *face,
const hb_set_t *unicodes,
+ const hb_set_t *input_glyphs_to_retain,
bool close_over_gsub,
hb_set_t *unicodes_to_retain,
hb_map_t *codepoint_to_glyph,
hb_set_t *initial_gids_to_retain = hb_set_create ();
initial_gids_to_retain->add (0); // Not-def
+ hb_set_union (initial_gids_to_retain, input_glyphs_to_retain);
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
while (unicodes->next (&cp))
plan->reverse_glyph_map = hb_map_create();
plan->_glyphset = _populate_gids_to_retain (face,
input->unicodes,
+ input->glyphs,
!plan->drop_layout,
plan->unicodes,
plan->codepoint_to_glyph,
HB_BEGIN_DECLS
static inline hb_subset_input_t *
-hb_subset_test_create_input(const hb_set_t *codepoints)
+hb_subset_test_create_input (const hb_set_t *codepoints)
{
hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t * input_codepoints = hb_subset_input_unicode_set (input);
return input;
}
+static inline hb_subset_input_t *
+hb_subset_test_create_input_from_glyphs (const hb_set_t *glyphs)
+{
+ hb_subset_input_t *input = hb_subset_input_create_or_fail ();
+ hb_set_t * input_glyphs = hb_subset_input_glyph_set (input);
+ hb_set_union (input_glyphs, glyphs);
+ return input;
+}
+
static inline hb_face_t *
hb_subset_test_create_subset (hb_face_t *source,
hb_subset_input_t *input)
}
static void
+test_subset_glyf_with_input_glyphs (void)
+{
+ hb_face_t *face_abc = hb_test_open_font_file ("fonts/Roboto-Regular.abc.ttf");
+ hb_face_t *face_ac = hb_test_open_font_file ("fonts/Roboto-Regular.ac.ttf");
+
+ hb_set_t *glyphs = hb_set_create();
+ hb_face_t *face_abc_subset;
+ hb_set_add (glyphs, 1);
+ hb_set_add (glyphs, 3);
+ face_abc_subset =
+ hb_subset_test_create_subset (face_abc, hb_subset_test_create_input_from_glyphs (glyphs));
+ hb_set_destroy (glyphs);
+
+ hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('g','l','y','f'));
+ hb_subset_test_check (face_ac, face_abc_subset, HB_TAG ('l','o','c', 'a'));
+ check_maxp_num_glyphs(face_abc_subset, 3, true);
+
+ hb_face_destroy (face_abc_subset);
+ hb_face_destroy (face_abc);
+ hb_face_destroy (face_ac);
+}
+
+static void
test_subset_glyf_with_components (void)
{
hb_face_t *face_components = hb_test_open_font_file ("fonts/Roboto-Regular.components.ttf");
hb_test_add (test_subset_glyf_noop);
hb_test_add (test_subset_glyf);
+ hb_test_add (test_subset_glyf_with_input_glyphs);
hb_test_add (test_subset_glyf_strip_hints_simple);
hb_test_add (test_subset_glyf_strip_hints_composite);
hb_test_add (test_subset_glyf_strip_hints_invalid);