From afe0910295f0b5bd245d68d5b142bcc9319b87ee Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sun, 9 Jul 2023 02:45:52 +0300 Subject: [PATCH] [font] Actually deprecate get_glyph_shape() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We previously marked it as deprecated in the documentation but didn’t actually deprecate it in code. Now the only known users have migrated to draw_glyph(), lets deprecate o=it for good. --- docs/harfbuzz-sections.txt | 6 ++--- src/hb-deprecated.h | 46 ++++++++++++++++++++++++++++++++++++++ src/hb-font.cc | 4 ++++ src/hb-font.h | 45 +------------------------------------ src/main.cc | 4 ++-- test/api/test-ot-face.c | 2 +- 6 files changed, 57 insertions(+), 50 deletions(-) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 45a7caecc..c2079011d 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -322,6 +322,9 @@ hb_unicode_decompose_compatibility hb_unicode_funcs_set_decompose_compatibility_func HB_UNICODE_COMBINING_CLASS_CCC133 hb_font_funcs_set_glyph_v_kerning_func +hb_font_get_glyph_shape +hb_font_get_glyph_shape_func_t +hb_font_funcs_set_glyph_shape_func hb_font_get_glyph_v_kerning hb_font_get_glyph_v_kerning_func_t @@ -406,7 +409,6 @@ hb_font_get_glyph_h_origin hb_font_get_glyph_v_origin hb_font_get_glyph_origin_for_direction hb_font_get_glyph_name -hb_font_get_glyph_shape hb_font_draw_glyph hb_font_paint_glyph hb_font_get_nominal_glyph @@ -474,8 +476,6 @@ hb_font_get_glyph_v_origin_func_t hb_font_funcs_set_glyph_v_origin_func hb_font_get_glyph_name_func_t hb_font_funcs_set_glyph_name_func -hb_font_get_glyph_shape_func_t -hb_font_funcs_set_glyph_shape_func hb_font_draw_glyph_func_t hb_font_funcs_set_draw_glyph_func hb_font_paint_glyph_func_t diff --git a/src/hb-deprecated.h b/src/hb-deprecated.h index b032a941b..9fcce6d9a 100644 --- a/src/hb-deprecated.h +++ b/src/hb-deprecated.h @@ -255,6 +255,52 @@ HB_EXTERN hb_position_t hb_font_get_glyph_v_kerning (hb_font_t *font, hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph); + +/** + * hb_font_get_glyph_shape_func_t: + * @font: #hb_font_t to work upon + * @font_data: @font user data pointer + * @glyph: The glyph ID to query + * @draw_funcs: The draw functions to send the shape data to + * @draw_data: The data accompanying the draw functions + * @user_data: User data pointer passed by the caller + * + * A virtual method for the #hb_font_funcs_t of an #hb_font_t object. + * + * Since: 4.0.0 + * Deprecated: 7.0.0: Use #hb_font_draw_glyph_func_t instead + **/ +typedef void (*hb_font_get_glyph_shape_func_t) (hb_font_t *font, void *font_data, + hb_codepoint_t glyph, + hb_draw_funcs_t *draw_funcs, void *draw_data, + void *user_data); + +/** + * hb_font_funcs_set_glyph_shape_func: + * @ffuncs: A font-function structure + * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign + * @user_data: Data to pass to @func + * @destroy: (nullable): The function to call when @user_data is not needed anymore + * + * Sets the implementation function for #hb_font_get_glyph_shape_func_t, + * which is the same as #hb_font_draw_glyph_func_t. + * + * Since: 4.0.0 + * Deprecated: 7.0.0: Use hb_font_funcs_set_draw_glyph_func() instead + **/ +HB_DEPRECATED_FOR (hb_font_funcs_set_draw_glyph_func) +HB_EXTERN void +hb_font_funcs_set_glyph_shape_func (hb_font_funcs_t *ffuncs, + hb_font_get_glyph_shape_func_t func, + void *user_data, hb_destroy_func_t destroy); + +HB_DEPRECATED_FOR (hb_font_draw_glyph) +HB_EXTERN void +hb_font_get_glyph_shape (hb_font_t *font, + hb_codepoint_t glyph, + hb_draw_funcs_t *dfuncs, void *draw_data); + + #endif diff --git a/src/hb-font.cc b/src/hb-font.cc index 745f91454..f062bfaf7 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -1389,6 +1389,7 @@ hb_font_get_glyph_from_name (hb_font_t *font, return font->get_glyph_from_name (name, len, glyph); } +#ifndef HB_DISABLE_DEPRECATED /** * hb_font_get_glyph_shape: * @font: #hb_font_t to work upon @@ -1410,6 +1411,7 @@ hb_font_get_glyph_shape (hb_font_t *font, { hb_font_draw_glyph (font, glyph, dfuncs, draw_data); } +#endif /** * hb_font_draw_glyph: @@ -3055,6 +3057,7 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs, #endif +#ifndef HB_DISABLE_DEPRECATED void hb_font_funcs_set_glyph_shape_func (hb_font_funcs_t *ffuncs, hb_font_get_glyph_shape_func_t func, @@ -3063,3 +3066,4 @@ hb_font_funcs_set_glyph_shape_func (hb_font_funcs_t *ffuncs, { hb_font_funcs_set_draw_glyph_func (ffuncs, func, user_data, destroy); } +#endif diff --git a/src/hb-font.h b/src/hb-font.h index f3b589bd0..3c2355af2 100644 --- a/src/hb-font.h +++ b/src/hb-font.h @@ -485,25 +485,6 @@ typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void * hb_codepoint_t *glyph, void *user_data); -/** - * hb_font_get_glyph_shape_func_t: - * @font: #hb_font_t to work upon - * @font_data: @font user data pointer - * @glyph: The glyph ID to query - * @draw_funcs: The draw functions to send the shape data to - * @draw_data: The data accompanying the draw functions - * @user_data: User data pointer passed by the caller - * - * A virtual method for the #hb_font_funcs_t of an #hb_font_t object. - * - * Since: 4.0.0 - * Deprecated: 7.0.0: Use #hb_font_draw_glyph_func_t instead - **/ -typedef void (*hb_font_get_glyph_shape_func_t) (hb_font_t *font, void *font_data, - hb_codepoint_t glyph, - hb_draw_funcs_t *draw_funcs, void *draw_data, - void *user_data); - /** * hb_font_draw_glyph_func_t: * @font: #hb_font_t to work upon @@ -803,24 +784,6 @@ hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs, hb_font_get_glyph_from_name_func_t func, void *user_data, hb_destroy_func_t destroy); -/** - * hb_font_funcs_set_glyph_shape_func: - * @ffuncs: A font-function structure - * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign - * @user_data: Data to pass to @func - * @destroy: (nullable): The function to call when @user_data is not needed anymore - * - * Sets the implementation function for #hb_font_get_glyph_shape_func_t, - * which is the same as #hb_font_draw_glyph_func_t. - * - * Since: 4.0.0 - * Deprecated: 7.0.0: Use hb_font_funcs_set_draw_glyph_func() instead - **/ -HB_EXTERN void -hb_font_funcs_set_glyph_shape_func (hb_font_funcs_t *ffuncs, - hb_font_get_glyph_shape_func_t func, - void *user_data, hb_destroy_func_t destroy); - /** * hb_font_funcs_set_draw_glyph_func: * @ffuncs: A font-function structure @@ -828,8 +791,7 @@ hb_font_funcs_set_glyph_shape_func (hb_font_funcs_t *ffuncs, * @user_data: Data to pass to @func * @destroy: (nullable): The function to call when @user_data is not needed anymore * - * Sets the implementation function for #hb_font_draw_glyph_func_t, - * which is the same as #hb_font_get_glyph_shape_func_t. + * Sets the implementation function for #hb_font_draw_glyph_func_t. * * Since: 7.0.0 **/ @@ -934,11 +896,6 @@ hb_font_get_glyph_from_name (hb_font_t *font, const char *name, int len, /* -1 means nul-terminated */ hb_codepoint_t *glyph); -HB_EXTERN void -hb_font_get_glyph_shape (hb_font_t *font, - hb_codepoint_t glyph, - hb_draw_funcs_t *dfuncs, void *draw_data); - HB_EXTERN void hb_font_draw_glyph (hb_font_t *font, hb_codepoint_t glyph, diff --git a/src/main.cc b/src/main.cc index edc9872ee..4af9569d1 100644 --- a/src/main.cc +++ b/src/main.cc @@ -245,7 +245,7 @@ layered_glyph_dump (hb_font_t *font, hb_draw_funcs_t *funcs, unsigned face_index if (hb_color_get_alpha (color) != 255) fprintf (f, "fill-opacity=\"%.3f\"", (double) hb_color_get_alpha (color) / 255.); fprintf (f, "d=\""); - hb_font_get_glyph_shape (font, layers[layer].glyph, funcs, &draw_data); + hb_font_draw_glyph (font, layers[layer].glyph, funcs, &draw_data); fprintf (f, "\"/>\n"); } @@ -284,7 +284,7 @@ dump_glyphs (hb_font_t *font, hb_draw_funcs_t *funcs, unsigned face_index) draw_data_t draw_data; draw_data.ascender = font_extents.ascender; draw_data.f = f; - hb_font_get_glyph_shape (font, gid, funcs, &draw_data); + hb_font_draw_glyph (font, gid, funcs, &draw_data); fprintf (f, "\"/>"); fclose (f); } diff --git a/test/api/test-ot-face.c b/test/api/test-ot-face.c index 7ed96aa59..ba3cfd3ad 100644 --- a/test/api/test-ot-face.c +++ b/test/api/test-ot-face.c @@ -188,7 +188,7 @@ test_font (hb_font_t *font, hb_codepoint_t cp) hb_ot_var_normalize_coords (face, 0, NULL, NULL); hb_draw_funcs_t *funcs = hb_draw_funcs_create (); - hb_font_get_glyph_shape (font, cp, funcs, NULL); + hb_font_draw_glyph (font, cp, funcs, NULL); hb_draw_funcs_destroy (funcs); hb_set_destroy (set);