From 8180c37df0a856dbc3564c0aefd8b2acab8baf8a Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 27 Oct 2018 14:45:00 +0330 Subject: [PATCH] [ot-color] Remove _png and _svg public APIs --- docs/harfbuzz-sections.txt | 4 ---- src/dump-emoji.cc | 11 ++++++++--- src/hb-ot-color.cc | 39 ++++++++++++++++++++++++++++++++++---- src/hb-ot-color.h | 24 ----------------------- test/api/test-ot-color.c | 8 ++++++-- 5 files changed, 49 insertions(+), 37 deletions(-) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 67f9ae2c4..7bca7ca20 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -460,12 +460,8 @@ HB_OT_H_IN
hb-ot-color hb_ot_color_glyph_get_layers -hb_ot_color_glyph_reference_blob_png -hb_ot_color_glyph_reference_blob_svg hb_ot_color_has_layers hb_ot_color_has_palettes -hb_ot_color_has_png -hb_ot_color_has_svg hb_ot_color_layer_t hb_ot_color_palette_color_get_name_id hb_ot_color_palette_flags_t diff --git a/src/dump-emoji.cc b/src/dump-emoji.cc index 73305aa77..63fb5885f 100644 --- a/src/dump-emoji.cc +++ b/src/dump-emoji.cc @@ -89,9 +89,12 @@ svg_dump (hb_face_t *face) { unsigned glyph_count = hb_face_get_glyph_count (face); + OT::SVG::accelerator_t svg; + svg.init (face); + for (unsigned int glyph_id = 0; glyph_id < glyph_count; glyph_id++) { - hb_blob_t *blob = hb_ot_color_glyph_reference_blob_svg (face, glyph_id); + hb_blob_t *blob = svg.reference_blob_for_glyph (glyph_id); if (hb_blob_get_length (blob) == 0) continue; @@ -110,6 +113,8 @@ svg_dump (hb_face_t *face) hb_blob_destroy (blob); } + + svg.fini (); } static void @@ -290,8 +295,8 @@ main (int argc, char **argv) sbix_dump (face); - if (hb_ot_color_has_svg (face)) - svg_dump (face); +// if (hb_ot_color_has_svg (face)) + svg_dump (face); cairo_font_face_t *cairo_face; { diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc index a2b753833..7ffc3d88b 100644 --- a/src/hb-ot-color.cc +++ b/src/hb-ot-color.cc @@ -47,12 +47,14 @@ _get_colr (hb_face_t *face) return *(hb_ot_face_data (face)->COLR.get ()); } +#if 0 static inline const OT::CBDT_accelerator_t& _get_cbdt (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::CBDT_accelerator_t); return *(hb_ot_face_data (face)->CBDT.get ()); } +#endif static inline const OT::CPAL& _get_cpal (hb_face_t *face) @@ -61,6 +63,7 @@ _get_cpal (hb_face_t *face) return *(hb_ot_face_data (face)->CPAL.get ()); } +#if 0 static inline const OT::sbix_accelerator_t& _get_sbix (hb_face_t *face) { @@ -74,6 +77,7 @@ _get_svg (hb_face_t *face) if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::SVG_accelerator_t); return *(hb_ot_face_data (face)->SVG.get ()); } +#endif /* @@ -239,6 +243,7 @@ hb_ot_color_glyph_get_layers (hb_face_t *face, } +#if 0 /* * SVG */ @@ -249,7 +254,7 @@ hb_ot_color_glyph_get_layers (hb_face_t *face, * * Returns: whether SVG table is available. * - * Since: REPLACEME + * Since: DONTREPLACEME */ hb_bool_t hb_ot_color_has_svg (hb_face_t *face) @@ -264,7 +269,7 @@ hb_ot_color_has_svg (hb_face_t *face) * * Returns: respective svg blob of the glyph, if available. * - * Since: REPLACEME + * Since: DONTREPLACEME */ hb_blob_t * hb_ot_color_glyph_reference_blob_svg (hb_face_t *face, hb_codepoint_t glyph) @@ -283,7 +288,7 @@ hb_ot_color_glyph_reference_blob_svg (hb_face_t *face, hb_codepoint_t glyph) * * Returns: whether either of CBDT or sbix tables is available. * - * Since: REPLACEME + * Since: DONTREPLACEME */ hb_bool_t hb_ot_color_has_png (hb_face_t *face) @@ -302,7 +307,7 @@ hb_ot_color_has_png (hb_face_t *face) * * Returns: respective png blob of the glyph, if available. * - * Since: REPLACEME + * Since: DONTREPLACEME */ hb_blob_t * hb_ot_color_glyph_reference_blob_png (hb_font_t *font, @@ -328,3 +333,29 @@ hb_ot_color_glyph_reference_blob_png (hb_font_t *font, return blob; } + +/* To be moved to public header */ + +/* + * SVG + */ + +HB_EXTERN hb_bool_t +hb_ot_color_has_svg (hb_face_t *face); + +HB_EXTERN hb_blob_t * +hb_ot_color_glyph_reference_blob_svg (hb_face_t *face, hb_codepoint_t glyph); + +/* + * PNG: CBDT or sbix + */ + +HB_EXTERN hb_bool_t +hb_ot_color_has_png (hb_face_t *face); + +HB_EXTERN hb_blob_t * +hb_ot_color_glyph_reference_blob_png (hb_font_t *font, + hb_codepoint_t glyph, + unsigned int *strike_x_ppem, + unsigned int *strike_y_ppem); +#endif diff --git a/src/hb-ot-color.h b/src/hb-ot-color.h index a8eae8618..6e4c1777e 100644 --- a/src/hb-ot-color.h +++ b/src/hb-ot-color.h @@ -111,30 +111,6 @@ hb_ot_color_glyph_get_layers (hb_face_t *face, unsigned int *count, /* IN/OUT. May be NULL. */ hb_ot_color_layer_t *layers /* OUT. May be NULL. */); -/* - * SVG - */ - -HB_EXTERN hb_bool_t -hb_ot_color_has_svg (hb_face_t *face); - -HB_EXTERN hb_blob_t * -hb_ot_color_glyph_reference_blob_svg (hb_face_t *face, hb_codepoint_t glyph); - -/* - * PNG: CBDT or sbix - */ - -HB_EXTERN hb_bool_t -hb_ot_color_has_png (hb_face_t *face); - -HB_EXTERN hb_blob_t * -hb_ot_color_glyph_reference_blob_png (hb_font_t *font, - hb_codepoint_t glyph, - unsigned int *strike_x_ppem, - unsigned int *strike_y_ppem); - - HB_END_DECLS #endif /* HB_OT_COLOR_H */ diff --git a/test/api/test-ot-color.c b/test/api/test-ot-color.c index 51b901d25..27409e10c 100644 --- a/test/api/test-ot-color.c +++ b/test/api/test-ot-color.c @@ -363,6 +363,7 @@ test_hb_ot_color_has_data (void) g_assert (hb_ot_color_has_palettes (sbix) == FALSE); g_assert (hb_ot_color_has_palettes (svg) == FALSE); +#if 0 g_assert (hb_ot_color_has_svg (empty) == FALSE); g_assert (hb_ot_color_has_svg (cpal_v0) == FALSE); g_assert (hb_ot_color_has_svg (cpal_v1) == FALSE); @@ -378,8 +379,10 @@ test_hb_ot_color_has_data (void) g_assert (hb_ot_color_has_png (cbdt) == TRUE); g_assert (hb_ot_color_has_png (sbix) == TRUE); g_assert (hb_ot_color_has_png (svg) == FALSE); +#endif } +#if 0 static void test_hb_ot_color_svg (void) { @@ -441,6 +444,7 @@ test_hb_ot_color_png (void) hb_blob_destroy (blob); hb_font_destroy (cbdt_font); } +#endif int main (int argc, char **argv) @@ -468,8 +472,8 @@ main (int argc, char **argv) hb_test_add (test_hb_ot_color_palette_color_get_name_id); hb_test_add (test_hb_ot_color_glyph_get_layers); hb_test_add (test_hb_ot_color_has_data); - hb_test_add (test_hb_ot_color_png); - hb_test_add (test_hb_ot_color_svg); +// hb_test_add (test_hb_ot_color_png); +// hb_test_add (test_hb_ot_color_svg); status = hb_test_run(); hb_face_destroy (cpal_v0); hb_face_destroy (cpal_v1);