[face] Introduce character-map API
New API: +hb_face_collect_unicodes +hb_face_collect_variation_selectors +hb_face_collect_variation_unicodes
This commit is contained in:
parent
66384db97c
commit
dae39c58fb
|
@ -189,6 +189,9 @@ hb_face_set_glyph_count
|
||||||
hb_face_set_index
|
hb_face_set_index
|
||||||
hb_face_set_upem
|
hb_face_set_upem
|
||||||
hb_face_set_user_data
|
hb_face_set_user_data
|
||||||
|
hb_face_collect_unicodes
|
||||||
|
hb_face_collect_variation_selectors
|
||||||
|
hb_face_collect_variation_unicodes
|
||||||
hb_face_builder_create
|
hb_face_builder_create
|
||||||
hb_face_builder_add_table
|
hb_face_builder_add_table
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "hb-face.hh"
|
#include "hb-face.hh"
|
||||||
#include "hb-blob.hh"
|
#include "hb-blob.hh"
|
||||||
#include "hb-open-file.hh"
|
#include "hb-open-file.hh"
|
||||||
|
#include "hb-ot-cmap-table.hh"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -514,6 +515,65 @@ hb_face_get_table_tags (const hb_face_t *face,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Character set.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hb_face_collect_unicodes:
|
||||||
|
* @face: font face.
|
||||||
|
* @out: set to add Unicode characters covered by @face to.
|
||||||
|
*
|
||||||
|
* Since: REPLACEME
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
hb_face_collect_unicodes (hb_face_t *face,
|
||||||
|
hb_set_t *out)
|
||||||
|
{
|
||||||
|
/* XXX Use saved accel. */
|
||||||
|
hb_auto_t<OT::cmap::accelerator_t> cmap (face);
|
||||||
|
cmap.collect_unicodes (out);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hb_face_collect_variation_selectors:
|
||||||
|
* @face: font face.
|
||||||
|
* @out: set to add Variation Selector characters covered by @face to.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Since: REPLACEME
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
hb_face_collect_variation_selectors (hb_face_t *face,
|
||||||
|
hb_set_t *out)
|
||||||
|
{
|
||||||
|
/* XXX Use saved accel. */
|
||||||
|
hb_auto_t<OT::cmap::accelerator_t> cmap (face);
|
||||||
|
cmap.collect_variation_selectors (out);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hb_face_collect_variation_unicodes:
|
||||||
|
* @face: font face.
|
||||||
|
* @out: set to add Unicode characters for @variation_selector covered by @face to.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Since: REPLACEME
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
hb_face_collect_variation_unicodes (hb_face_t *face,
|
||||||
|
hb_codepoint_t variation_selector,
|
||||||
|
hb_set_t *out)
|
||||||
|
{
|
||||||
|
/* XXX Use saved accel. */
|
||||||
|
hb_auto_t<OT::cmap::accelerator_t> cmap (face);
|
||||||
|
cmap.collect_variation_unicodes (variation_selector, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* face-builder: A face that has add_table().
|
* face-builder: A face that has add_table().
|
||||||
*/
|
*/
|
||||||
|
@ -660,4 +720,3 @@ hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include "hb-common.h"
|
#include "hb-common.h"
|
||||||
#include "hb-blob.h"
|
#include "hb-blob.h"
|
||||||
|
#include "hb-set.h"
|
||||||
|
|
||||||
HB_BEGIN_DECLS
|
HB_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -121,6 +122,24 @@ hb_face_get_table_tags (const hb_face_t *face,
|
||||||
hb_tag_t *table_tags /* OUT */);
|
hb_tag_t *table_tags /* OUT */);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Character set.
|
||||||
|
*/
|
||||||
|
|
||||||
|
HB_EXTERN void
|
||||||
|
hb_face_collect_unicodes (hb_face_t *face,
|
||||||
|
hb_set_t *out);
|
||||||
|
|
||||||
|
HB_EXTERN void
|
||||||
|
hb_face_collect_variation_selectors (hb_face_t *face,
|
||||||
|
hb_set_t *out);
|
||||||
|
|
||||||
|
HB_EXTERN void
|
||||||
|
hb_face_collect_variation_unicodes (hb_face_t *face,
|
||||||
|
hb_codepoint_t variation_selector,
|
||||||
|
hb_set_t *out);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Builder face.
|
* Builder face.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -235,56 +235,3 @@ hb_subset (hb_face_t *source,
|
||||||
hb_subset_plan_destroy (plan);
|
hb_subset_plan_destroy (plan);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* hb_subset_collect_unicodes:
|
|
||||||
* @face: font face.
|
|
||||||
* @out: set to add Unicode characters covered by @face to.
|
|
||||||
*
|
|
||||||
* Since: REPLACEME
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
hb_subset_collect_unicodes (hb_face_t *face, hb_set_t *out)
|
|
||||||
{
|
|
||||||
/* XXX Use saved accel. */
|
|
||||||
hb_auto_t<OT::cmap::accelerator_t> cmap (face);
|
|
||||||
cmap.collect_unicodes (out);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hb_subset_collect_variation_selectors:
|
|
||||||
* @face: font face.
|
|
||||||
* @out: set to add Variation Selector characters covered by @face to.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Since: REPLACEME
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
hb_subset_collect_variation_selectors (hb_face_t *face,
|
|
||||||
hb_set_t *out)
|
|
||||||
{
|
|
||||||
/* XXX Use saved accel. */
|
|
||||||
hb_auto_t<OT::cmap::accelerator_t> cmap (face);
|
|
||||||
cmap.collect_variation_selectors (out);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hb_subset_collect_variation_unicodes:
|
|
||||||
* @face: font face.
|
|
||||||
* @out: set to add Unicode characters for @variation_selector covered by @face to.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Since: REPLACEME
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
hb_subset_collect_variation_unicodes (hb_face_t *face,
|
|
||||||
hb_codepoint_t variation_selector,
|
|
||||||
hb_set_t *out)
|
|
||||||
{
|
|
||||||
/* XXX Use saved accel. */
|
|
||||||
hb_auto_t<OT::cmap::accelerator_t> cmap (face);
|
|
||||||
cmap.collect_variation_unicodes (variation_selector, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -81,21 +81,6 @@ hb_subset (hb_face_t *source,
|
||||||
hb_subset_input_t *input);
|
hb_subset_input_t *input);
|
||||||
|
|
||||||
|
|
||||||
/* TODO Move to hb-face.h. */
|
|
||||||
|
|
||||||
HB_EXTERN void
|
|
||||||
hb_subset_collect_unicodes (hb_face_t *face, hb_set_t *out);
|
|
||||||
|
|
||||||
HB_EXTERN void
|
|
||||||
hb_subset_collect_variation_selectors (hb_face_t *face,
|
|
||||||
hb_set_t *out);
|
|
||||||
|
|
||||||
HB_EXTERN void
|
|
||||||
hb_subset_collect_variation_unicodes (hb_face_t *face,
|
|
||||||
hb_codepoint_t variation_selector,
|
|
||||||
hb_set_t *out);
|
|
||||||
|
|
||||||
|
|
||||||
HB_END_DECLS
|
HB_END_DECLS
|
||||||
|
|
||||||
#endif /* HB_SUBSET_H */
|
#endif /* HB_SUBSET_H */
|
||||||
|
|
|
@ -33,7 +33,7 @@ test_collect_unicodes_format4 (void)
|
||||||
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format4.ttf");
|
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format4.ttf");
|
||||||
hb_set_t *codepoints = hb_set_create();
|
hb_set_t *codepoints = hb_set_create();
|
||||||
|
|
||||||
hb_subset_collect_unicodes (face, codepoints);
|
hb_face_collect_unicodes (face, codepoints);
|
||||||
|
|
||||||
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
||||||
g_assert (hb_set_next (codepoints, &cp));
|
g_assert (hb_set_next (codepoints, &cp));
|
||||||
|
@ -54,7 +54,7 @@ test_collect_unicodes_format12 (void)
|
||||||
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format12.ttf");
|
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format12.ttf");
|
||||||
hb_set_t *codepoints = hb_set_create();
|
hb_set_t *codepoints = hb_set_create();
|
||||||
|
|
||||||
hb_subset_collect_unicodes (face, codepoints);
|
hb_face_collect_unicodes (face, codepoints);
|
||||||
|
|
||||||
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
||||||
g_assert (hb_set_next (codepoints, &cp));
|
g_assert (hb_set_next (codepoints, &cp));
|
||||||
|
@ -75,7 +75,7 @@ test_collect_unicodes (void)
|
||||||
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf");
|
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf");
|
||||||
hb_set_t *codepoints = hb_set_create();
|
hb_set_t *codepoints = hb_set_create();
|
||||||
|
|
||||||
hb_subset_collect_unicodes (face, codepoints);
|
hb_face_collect_unicodes (face, codepoints);
|
||||||
|
|
||||||
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
|
||||||
g_assert (hb_set_next (codepoints, &cp));
|
g_assert (hb_set_next (codepoints, &cp));
|
||||||
|
|
|
@ -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_face_t *face = hb_face_create (blob, 0);
|
||||||
|
|
||||||
hb_set_t *output = hb_set_create();
|
hb_set_t *output = hb_set_create();
|
||||||
hb_subset_collect_unicodes (face, output);
|
hb_face_collect_unicodes (face, output);
|
||||||
|
|
||||||
hb_set_destroy (output);
|
hb_set_destroy (output);
|
||||||
hb_face_destroy (face);
|
hb_face_destroy (face);
|
||||||
|
|
Loading…
Reference in New Issue