diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 93d6de6ef..5c9edbfab 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -520,6 +520,18 @@ hb_ot_color_palette_get_name_id hb_ot_font_set_funcs +
+hb-ot-glyph +hb_ot_glyph_path_t +hb_ot_glyph_path_create +hb_ot_glyph_path_create_from_font +hb_ot_glyph_path_destroy +hb_ot_glyph_path_empty +hb_ot_glyph_path_get_commands +hb_ot_glyph_path_get_coords +hb_ot_glyph_path_reference +
+
hb-ot-name hb_ot_name_id_t diff --git a/src/hb-ot-glyph.cc b/src/hb-ot-glyph.cc index 2db41a7de..24c4f23a2 100644 --- a/src/hb-ot-glyph.cc +++ b/src/hb-ot-glyph.cc @@ -52,7 +52,7 @@ hb_ot_glyph_path_empty () } hb_ot_glyph_path_t * -hb_ot_glyph_create_path (hb_position_t *coords, +hb_ot_glyph_path_create (hb_position_t *coords, unsigned int coords_count, uint8_t *commands, unsigned int commands_count, @@ -133,14 +133,14 @@ struct _hb_ot_glyph_path_vectors }; static void -_hb_ot_glyph_free_path_vectors (void *user_data) +_hb_ot_glyph_path_free_vectors (void *user_data) { ((_hb_ot_glyph_path_vectors *) user_data)->fini (); free (user_data); } hb_ot_glyph_path_t * -hb_ot_glyph_create_path_from_font (hb_font_t *font, hb_codepoint_t glyph) +hb_ot_glyph_path_create_from_font (hb_font_t *font, hb_codepoint_t glyph) { _hb_ot_glyph_path_vectors *user_data = (_hb_ot_glyph_path_vectors *) malloc (sizeof (_hb_ot_glyph_path_vectors)); @@ -161,8 +161,8 @@ hb_ot_glyph_create_path_from_font (hb_font_t *font, hb_codepoint_t glyph) if (unlikely (!ret)) return hb_ot_glyph_path_empty (); - return hb_ot_glyph_create_path (coords.arrayZ, coords.length, commands.arrayZ, commands.length, - user_data, (hb_destroy_func_t) _hb_ot_glyph_free_path_vectors); + return hb_ot_glyph_path_create (coords.arrayZ, coords.length, commands.arrayZ, commands.length, + user_data, (hb_destroy_func_t) _hb_ot_glyph_path_free_vectors); } #endif diff --git a/src/hb-ot-glyph.h b/src/hb-ot-glyph.h index 5b37c30c8..2e38c76d2 100644 --- a/src/hb-ot-glyph.h +++ b/src/hb-ot-glyph.h @@ -36,30 +36,31 @@ HB_BEGIN_DECLS typedef struct hb_ot_glyph_path_t hb_ot_glyph_path_t; HB_EXTERN hb_ot_glyph_path_t * -hb_ot_glyph_path_empty (void); - -HB_EXTERN hb_ot_glyph_path_t * -hb_ot_glyph_create_path (hb_position_t *coords, +hb_ot_glyph_path_create (hb_position_t *coords, unsigned int coords_count, uint8_t *commands, unsigned int commands_count, void *user_data, hb_destroy_func_t destroy); -HB_EXTERN const hb_position_t * -hb_ot_glyph_path_get_coords (hb_ot_glyph_path_t *path, unsigned int *count); - -HB_EXTERN const uint8_t * -hb_ot_glyph_path_get_commands (hb_ot_glyph_path_t *path, unsigned int *count); - HB_EXTERN hb_ot_glyph_path_t * -hb_ot_glyph_path_reference (hb_ot_glyph_path_t *path); +hb_ot_glyph_path_create_from_font (hb_font_t *font, hb_codepoint_t glyph); HB_EXTERN void hb_ot_glyph_path_destroy (hb_ot_glyph_path_t *path); HB_EXTERN hb_ot_glyph_path_t * -hb_ot_glyph_create_path_from_font (hb_font_t *font, hb_codepoint_t glyph); +hb_ot_glyph_path_empty (void); + +HB_EXTERN const uint8_t * +hb_ot_glyph_path_get_commands (hb_ot_glyph_path_t *path, unsigned int *count); + +HB_EXTERN const hb_position_t * +hb_ot_glyph_path_get_coords (hb_ot_glyph_path_t *path, unsigned int *count); + +HB_EXTERN hb_ot_glyph_path_t * +hb_ot_glyph_path_reference (hb_ot_glyph_path_t *path); + HB_END_DECLS diff --git a/src/test-ot-glyph.cc b/src/test-ot-glyph.cc index a241c39f7..8722f3dc1 100644 --- a/src/test-ot-glyph.cc +++ b/src/test-ot-glyph.cc @@ -30,6 +30,7 @@ #include #include +#include int main (int argc, char **argv) @@ -66,30 +67,35 @@ main (int argc, char **argv) " viewBox=\"%d %d %d %d\">= j + 2); fprintf (f, "%d,%d", coords[j], font_extents.ascender - coords[j + 1]); //extents.y_bearing - points[i].y); j += 2; if (commands[i] == 'Q') { + assert (coords_count >= j + 2); fprintf (f, " %d,%d", coords[j], font_extents.ascender - coords[j + 1]); //extents.y_bearing - points[i].y); j += 2; } if (commands[i] == 'C') { + assert (coords_count >= j + 4); fprintf (f, " %d,%d", coords[j], font_extents.ascender - coords[j + 1]); //extents.y_bearing - points[i].y); j += 2; fprintf (f, " %d,%d", coords[j], font_extents.ascender - coords[j + 1]); //extents.y_bearing - points[i].y); j += 2; } } + assert (coords_count == j); fprintf (f, "\"/>"); fclose (f); hb_ot_glyph_path_destroy (path);