Rename get_all_codepoints() to collect_unicodes()
This commit is contained in:
parent
531051b8b9
commit
d60c465627
|
@ -283,7 +283,7 @@ struct CmapSubtableFormat4
|
|||
return *glyph != 0;
|
||||
}
|
||||
|
||||
static inline void get_all_codepoints_func (const void *obj, hb_set_t *out)
|
||||
static inline void collect_unicodes_func (const void *obj, hb_set_t *out)
|
||||
{
|
||||
const accelerator_t *thiz = (const accelerator_t *) obj;
|
||||
for (unsigned int i = 0; i < thiz->segCount; i++)
|
||||
|
@ -436,7 +436,7 @@ struct CmapSubtableLongSegmented
|
|||
return *glyph != 0;
|
||||
}
|
||||
|
||||
inline void get_all_codepoints (hb_set_t *out) const
|
||||
inline void collect_unicodes (hb_set_t *out) const
|
||||
{
|
||||
for (unsigned int i = 0; i < this->groups.len; i++) {
|
||||
hb_set_add_range (out,
|
||||
|
@ -939,24 +939,24 @@ struct cmap
|
|||
if (unlikely (symbol))
|
||||
{
|
||||
this->get_glyph_func = get_glyph_from_symbol<CmapSubtable>;
|
||||
this->get_all_codepoints_func = null_get_all_codepoints_func;
|
||||
this->collect_unicodes_func = collect_unicodes_func_nil;
|
||||
} else {
|
||||
switch (subtable->u.format) {
|
||||
/* Accelerate format 4 and format 12. */
|
||||
default:
|
||||
this->get_glyph_func = get_glyph_from<CmapSubtable>;
|
||||
this->get_all_codepoints_func = null_get_all_codepoints_func;
|
||||
this->collect_unicodes_func = collect_unicodes_func_nil;
|
||||
break;
|
||||
case 12:
|
||||
this->get_glyph_func = get_glyph_from<CmapSubtableFormat12>;
|
||||
this->get_all_codepoints_func = get_all_codepoints_from<CmapSubtableFormat12>;
|
||||
this->collect_unicodes_func = collect_unicodes_from<CmapSubtableFormat12>;
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
this->format4_accel.init (&subtable->u.format4);
|
||||
this->get_glyph_data = &this->format4_accel;
|
||||
this->get_glyph_func = this->format4_accel.get_glyph_func;
|
||||
this->get_all_codepoints_func = this->format4_accel.get_all_codepoints_func;
|
||||
this->collect_unicodes_func = this->format4_accel.collect_unicodes_func;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -990,19 +990,19 @@ struct cmap
|
|||
return get_nominal_glyph (unicode, glyph);
|
||||
}
|
||||
|
||||
inline void get_all_codepoints (hb_set_t *out) const
|
||||
inline void collect_unicodes (hb_set_t *out) const
|
||||
{
|
||||
this->get_all_codepoints_func (get_glyph_data, out);
|
||||
this->collect_unicodes_func (get_glyph_data, out);
|
||||
}
|
||||
|
||||
protected:
|
||||
typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj,
|
||||
hb_codepoint_t codepoint,
|
||||
hb_codepoint_t *glyph);
|
||||
typedef void (*hb_cmap_get_all_codepoints_func_t) (const void *obj,
|
||||
typedef void (*hb_cmap_collect_unicodes_func_t) (const void *obj,
|
||||
hb_set_t *out);
|
||||
|
||||
static inline void null_get_all_codepoints_func (const void *obj, hb_set_t *out)
|
||||
static inline void collect_unicodes_func_nil (const void *obj, hb_set_t *out)
|
||||
{
|
||||
// NOOP
|
||||
}
|
||||
|
@ -1017,11 +1017,11 @@ struct cmap
|
|||
}
|
||||
|
||||
template <typename Type>
|
||||
static inline void get_all_codepoints_from (const void *obj,
|
||||
static inline void collect_unicodes_from (const void *obj,
|
||||
hb_set_t *out)
|
||||
{
|
||||
const Type *typed_obj = (const Type *) obj;
|
||||
typed_obj->get_all_codepoints (out);
|
||||
typed_obj->collect_unicodes (out);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
|
@ -1049,7 +1049,7 @@ struct cmap
|
|||
private:
|
||||
hb_cmap_get_glyph_func_t get_glyph_func;
|
||||
const void *get_glyph_data;
|
||||
hb_cmap_get_all_codepoints_func_t get_all_codepoints_func;
|
||||
hb_cmap_collect_unicodes_func_t collect_unicodes_func;
|
||||
|
||||
CmapSubtableFormat4::accelerator_t format4_accel;
|
||||
|
||||
|
|
|
@ -237,15 +237,15 @@ hb_subset (hb_face_t *source,
|
|||
}
|
||||
|
||||
/**
|
||||
* hb_subset_get_all_codepoints:
|
||||
* hb_subset_collect_unicodes:
|
||||
* @source: font face data to load.
|
||||
* @out: set to add the all codepoints covered by font face, source.
|
||||
*/
|
||||
void
|
||||
hb_subset_get_all_codepoints (hb_face_t *source, hb_set_t *out)
|
||||
hb_subset_collect_unicodes (hb_face_t *source, hb_set_t *out)
|
||||
{
|
||||
OT::cmap::accelerator_t cmap;
|
||||
cmap.init (source);
|
||||
cmap.get_all_codepoints (out);
|
||||
cmap.collect_unicodes (out);
|
||||
cmap.fini();
|
||||
}
|
||||
|
|
|
@ -80,9 +80,9 @@ hb_subset (hb_face_t *source,
|
|||
hb_subset_profile_t *profile,
|
||||
hb_subset_input_t *input);
|
||||
|
||||
/* hb_subset_get_all_codepoints */
|
||||
/* hb_subset_collect_unicodes */
|
||||
HB_EXTERN void
|
||||
hb_subset_get_all_codepoints (hb_face_t *source, hb_set_t *out);
|
||||
hb_subset_collect_unicodes (hb_face_t *source, hb_set_t *out);
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#include "hb-subset-test.h"
|
||||
|
||||
static void
|
||||
test_get_all_codepoints_format4 (void)
|
||||
test_collect_unicodes_format4 (void)
|
||||
{
|
||||
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format4.ttf");
|
||||
hb_set_t *codepoints = hb_set_create();
|
||||
|
||||
hb_subset_get_all_codepoints (face, codepoints);
|
||||
hb_subset_collect_unicodes (face, codepoints);
|
||||
|
||||
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
||||
g_assert (hb_set_next (codepoints, &cp));
|
||||
|
@ -49,12 +49,12 @@ test_get_all_codepoints_format4 (void)
|
|||
}
|
||||
|
||||
static void
|
||||
test_get_all_codepoints_format12 (void)
|
||||
test_collect_unicodes_format12 (void)
|
||||
{
|
||||
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format12.ttf");
|
||||
hb_set_t *codepoints = hb_set_create();
|
||||
|
||||
hb_subset_get_all_codepoints (face, codepoints);
|
||||
hb_subset_collect_unicodes (face, codepoints);
|
||||
|
||||
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
||||
g_assert (hb_set_next (codepoints, &cp));
|
||||
|
@ -70,12 +70,12 @@ test_get_all_codepoints_format12 (void)
|
|||
}
|
||||
|
||||
static void
|
||||
test_get_all_codepoints (void)
|
||||
test_collect_unicodes (void)
|
||||
{
|
||||
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf");
|
||||
hb_set_t *codepoints = hb_set_create();
|
||||
|
||||
hb_subset_get_all_codepoints (face, codepoints);
|
||||
hb_subset_collect_unicodes (face, codepoints);
|
||||
|
||||
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
||||
g_assert (hb_set_next (codepoints, &cp));
|
||||
|
@ -95,9 +95,9 @@ main (int argc, char **argv)
|
|||
{
|
||||
hb_test_init (&argc, &argv);
|
||||
|
||||
hb_test_add (test_get_all_codepoints);
|
||||
hb_test_add (test_get_all_codepoints_format4);
|
||||
hb_test_add (test_get_all_codepoints_format12);
|
||||
hb_test_add (test_collect_unicodes);
|
||||
hb_test_add (test_collect_unicodes_format4);
|
||||
hb_test_add (test_collect_unicodes_format12);
|
||||
|
||||
return hb_test_run();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||
hb_face_t *face = hb_face_create (blob, 0);
|
||||
|
||||
hb_set_t *output = hb_set_create();
|
||||
hb_subset_get_all_codepoints (face, output);
|
||||
hb_subset_collect_unicodes (face, output);
|
||||
|
||||
hb_set_destroy (output);
|
||||
hb_face_destroy (face);
|
||||
|
|
Loading…
Reference in New Issue