From 981125aa2adbe4f513d3ecf357459e5bcfd06d0a Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 25 Jan 2020 21:31:36 +0330 Subject: [PATCH] Rename hb_ot_glyph_* to hb_outline_* --- docs/harfbuzz-sections.txt | 38 +++---- src/Makefile.sources | 6 +- src/harfbuzz.cc | 2 +- src/hb-config.hh | 2 +- src/hb-ot-cff1-table.cc | 12 +-- src/hb-ot-cff1-table.hh | 2 +- src/hb-ot-cff2-table.cc | 8 +- src/hb-ot-cff2-table.hh | 2 +- src/hb-ot-glyf-table.hh | 4 +- src/hb-ot-glyph.h | 92 ---------------- src/hb-ot.h | 1 - src/{hb-ot-glyph.cc => hb-outline.cc} | 86 +++++++-------- src/hb-outline.h | 92 ++++++++++++++++ src/{hb-ot-glyph.hh => hb-outline.hh} | 18 ++-- src/hb.h | 1 + src/main.cc | 26 ++--- test/api/Makefile.am | 2 +- test/api/test-ot-face.c | 6 +- test/api/{test-ot-glyph.c => test-outline.c} | 104 +++++++++---------- 19 files changed, 252 insertions(+), 252 deletions(-) delete mode 100644 src/hb-ot-glyph.h rename src/{hb-ot-glyph.cc => hb-outline.cc} (61%) create mode 100644 src/hb-outline.h rename src/{hb-ot-glyph.hh => hb-outline.hh} (75%) rename test/api/{test-ot-glyph.c => test-outline.c} (90%) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index d6bd111a8..53f2c5773 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -520,25 +520,6 @@ hb_ot_color_palette_get_name_id hb_ot_font_set_funcs -
-hb-ot-glyph -hb_ot_glyph_decompose_funcs_t -hb_ot_glyph_decompose_close_path_func_t -hb_ot_glyph_decompose_conic_to_func_t -hb_ot_glyph_decompose_cubic_to_func_t -hb_ot_glyph_decompose_line_to_func_t -hb_ot_glyph_decompose_move_to_func_t -hb_ot_glyph_decompose -hb_ot_glyph_decompose_funcs_create -hb_ot_glyph_decompose_funcs_destroy -hb_ot_glyph_decompose_funcs_reference -hb_ot_glyph_decompose_funcs_set_close_path_func -hb_ot_glyph_decompose_funcs_set_conic_to_func -hb_ot_glyph_decompose_funcs_set_cubic_to_func -hb_ot_glyph_decompose_funcs_set_line_to_func -hb_ot_glyph_decompose_funcs_set_move_to_func -
-
hb-ot-name hb_ot_name_id_t @@ -675,6 +656,25 @@ hb_ot_var_normalize_variations hb_ot_var_normalize_coords
+
+hb-outline +hb_outline_decompose_funcs_t +hb_outline_decompose_close_path_func_t +hb_outline_decompose_conic_to_func_t +hb_outline_decompose_cubic_to_func_t +hb_outline_decompose_line_to_func_t +hb_outline_decompose_move_to_func_t +hb_outline_decompose +hb_outline_decompose_funcs_create +hb_outline_decompose_funcs_destroy +hb_outline_decompose_funcs_reference +hb_outline_decompose_funcs_set_close_path_func +hb_outline_decompose_funcs_set_conic_to_func +hb_outline_decompose_funcs_set_cubic_to_func +hb_outline_decompose_funcs_set_line_to_func +hb_outline_decompose_funcs_set_move_to_func +
+
hb-set HB_SET_VALUE_INVALID diff --git a/src/Makefile.sources b/src/Makefile.sources index 58c9fda3b..a464f286a 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -40,6 +40,8 @@ HB_BASE_sources = \ hb-fallback-shape.cc \ hb-font.cc \ hb-font.hh \ + hb-outline.cc \ + hb-outline.hh \ hb-iter.hh \ hb-kern.hh \ hb-machinery.hh \ @@ -73,8 +75,6 @@ HB_BASE_sources = \ hb-ot-font.cc \ hb-ot-gasp-table.hh \ hb-ot-glyf-table.hh \ - hb-ot-glyph.cc \ - hb-ot-glyph.hh \ hb-ot-hdmx-table.hh \ hb-ot-head-table.hh \ hb-ot-hhea-table.hh \ @@ -197,11 +197,11 @@ HB_BASE_headers = \ hb-deprecated.h \ hb-face.h \ hb-font.h \ + hb-outline.h \ hb-map.h \ hb-ot-color.h \ hb-ot-deprecated.h \ hb-ot-font.h \ - hb-ot-glyph.h \ hb-ot-layout.h \ hb-ot-math.h \ hb-ot-meta.h \ diff --git a/src/harfbuzz.cc b/src/harfbuzz.cc index a7b82697d..9da30dfbf 100644 --- a/src/harfbuzz.cc +++ b/src/harfbuzz.cc @@ -7,6 +7,7 @@ #include "hb-face.cc" #include "hb-fallback-shape.cc" #include "hb-font.cc" +#include "hb-outline.cc" #include "hb-map.cc" #include "hb-number.cc" #include "hb-ot-cff1-table.cc" @@ -14,7 +15,6 @@ #include "hb-ot-color.cc" #include "hb-ot-face.cc" #include "hb-ot-font.cc" -#include "hb-ot-glyph.cc" #include "hb-ot-layout.cc" #include "hb-ot-map.cc" #include "hb-ot-math.cc" diff --git a/src/hb-config.hh b/src/hb-config.hh index 6d704a82f..41bd6c632 100644 --- a/src/hb-config.hh +++ b/src/hb-config.hh @@ -61,7 +61,6 @@ #define HB_NO_ERRNO #define HB_NO_FACE_COLLECT_UNICODES #define HB_NO_GETENV -#define HB_NO_GLYPH #define HB_NO_HINTING #define HB_NO_LANGUAGE_PRIVATE_SUBTAG #define HB_NO_LAYOUT_FEATURE_PARAMS @@ -73,6 +72,7 @@ #define HB_NO_MMAP #define HB_NO_NAME #define HB_NO_OPEN +#define HB_NO_OUTLINE #define HB_NO_SETLOCALE #define HB_NO_OT_FONT_GLYPH_NAMES #define HB_NO_OT_SHAPE_FRACTIONS diff --git a/src/hb-ot-cff1-table.cc b/src/hb-ot-cff1-table.cc index 5fb14f71b..878a02275 100644 --- a/src/hb-ot-cff1-table.cc +++ b/src/hb-ot-cff1-table.cc @@ -28,9 +28,9 @@ #ifndef HB_NO_CFF +#include "hb-outline.hh" #include "hb-ot-cff1-table.hh" #include "hb-cff1-interp-cs.hh" -#include "hb-ot-glyph.hh" using namespace CFF; @@ -346,7 +346,7 @@ bool OT::cff1::accelerator_t::get_extents (hb_font_t *font, hb_codepoint_t glyph struct cff1_path_param_t { cff1_path_param_t (const OT::cff1::accelerator_t *cff_, hb_font_t *font_, - const hb_ot_glyph_decompose_funcs_t *funcs_, void *user_data_, + const hb_outline_decompose_funcs_t *funcs_, void *user_data_, point_t *delta_) { path_open = false; @@ -395,7 +395,7 @@ struct cff1_path_param_t bool path_open; hb_font_t *font; - const hb_ot_glyph_decompose_funcs_t *funcs; + const hb_outline_decompose_funcs_t *funcs; void *user_data; point_t *delta; @@ -427,7 +427,7 @@ struct cff1_path_procs_path_t : path_procs_t @@ -449,7 +449,7 @@ struct cff1_cs_opset_path_t : cff1_cs_opset_tis_valid () || (glyph >= cff->num_glyphs))) return false; @@ -464,7 +464,7 @@ bool _get_path (const OT::cff1::accelerator_t *cff, hb_font_t *font, hb_codepoin } bool OT::cff1::accelerator_t::get_path (hb_font_t *font, hb_codepoint_t glyph, - const hb_ot_glyph_decompose_funcs_t *funcs, void *user_data) const + const hb_outline_decompose_funcs_t *funcs, void *user_data) const { #ifdef HB_NO_OT_FONT_CFF /* XXX Remove check when this code moves to .hh file. */ diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index da3210303..3eb254ffe 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -1348,7 +1348,7 @@ struct cff1 HB_INTERNAL bool get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const; HB_INTERNAL bool get_seac_components (hb_codepoint_t glyph, hb_codepoint_t *base, hb_codepoint_t *accent) const; HB_INTERNAL bool get_path (hb_font_t *font, hb_codepoint_t glyph, - const hb_ot_glyph_decompose_funcs_t *funcs, void *user_data) const; + const hb_outline_decompose_funcs_t *funcs, void *user_data) const; private: struct gname_t diff --git a/src/hb-ot-cff2-table.cc b/src/hb-ot-cff2-table.cc index 194b08e65..847e71ac3 100644 --- a/src/hb-ot-cff2-table.cc +++ b/src/hb-ot-cff2-table.cc @@ -30,7 +30,7 @@ #include "hb-ot-cff2-table.hh" #include "hb-cff2-interp-cs.hh" -#include "hb-ot-glyph.hh" +#include "hb-outline.hh" using namespace CFF; @@ -145,7 +145,7 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font, struct cff2_path_param_t { - cff2_path_param_t (hb_font_t *font_, const hb_ot_glyph_decompose_funcs_t *funcs_, void *user_data_) + cff2_path_param_t (hb_font_t *font_, const hb_outline_decompose_funcs_t *funcs_, void *user_data_) { path_open = false; font = font_; @@ -180,7 +180,7 @@ struct cff2_path_param_t bool path_open; hb_font_t *font; - const hb_ot_glyph_decompose_funcs_t *funcs; + const hb_outline_decompose_funcs_t *funcs; void *user_data; }; @@ -211,7 +211,7 @@ struct cff2_path_procs_path_t : path_procs_t {}; bool OT::cff2::accelerator_t::get_path (hb_font_t *font, hb_codepoint_t glyph, - const hb_ot_glyph_decompose_funcs_t *funcs, void *user_data) const + const hb_outline_decompose_funcs_t *funcs, void *user_data) const { #ifdef HB_NO_OT_FONT_CFF /* XXX Remove check when this code moves to .hh file. */ diff --git a/src/hb-ot-cff2-table.hh b/src/hb-ot-cff2-table.hh index 55312287f..f77fc701a 100644 --- a/src/hb-ot-cff2-table.hh +++ b/src/hb-ot-cff2-table.hh @@ -534,7 +534,7 @@ struct cff2 hb_codepoint_t glyph, hb_glyph_extents_t *extents) const; HB_INTERNAL bool get_path (hb_font_t *font, hb_codepoint_t glyph, - const hb_ot_glyph_decompose_funcs_t *funcs, void *user_data) const; + const hb_outline_decompose_funcs_t *funcs, void *user_data) const; }; typedef accelerator_templ_t accelerator_subset_t; diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 06eb303db..7567c98ca 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -34,7 +34,7 @@ #include "hb-ot-head-table.hh" #include "hb-ot-hmtx-table.hh" #include "hb-ot-var-gvar-table.hh" -#include "hb-ot-glyph.hh" +#include "hb-outline.hh" #include @@ -1045,7 +1045,7 @@ struct glyf bool get_path (hb_font_t *font, hb_codepoint_t gid, - const hb_ot_glyph_decompose_funcs_t *funcs, void *user_data) const + const hb_outline_decompose_funcs_t *funcs, void *user_data) const { /* Making this completely alloc free is not that easy https://github.com/harfbuzz/harfbuzz/issues/2095 diff --git a/src/hb-ot-glyph.h b/src/hb-ot-glyph.h deleted file mode 100644 index 56238f88e..000000000 --- a/src/hb-ot-glyph.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright © 2019-2020 Ebrahim Byagowi - * - * This is part of HarfBuzz, a text shaping library. - * - * Permission is hereby granted, without written agreement and without - * license or royalty fees, to use, copy, modify, and distribute this - * software and its documentation for any purpose, provided that the - * above copyright notice and the following two paragraphs appear in - * all copies of this software. - * - * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES - * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN - * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -#ifndef HB_OT_H_IN -#error "Include instead." -#endif - -#ifndef HB_OT_GLYPH_H -#define HB_OT_GLYPH_H - -#include "hb.h" - -HB_BEGIN_DECLS - -typedef void (*hb_ot_glyph_decompose_move_to_func_t) (hb_position_t to_x, hb_position_t to_y, void *user_data); -typedef void (*hb_ot_glyph_decompose_line_to_func_t) (hb_position_t to_x, hb_position_t to_y, void *user_data); -typedef void (*hb_ot_glyph_decompose_conic_to_func_t) (hb_position_t control_x, hb_position_t control_y, - hb_position_t to_x, hb_position_t to_y, - void *user_data); -typedef void (*hb_ot_glyph_decompose_cubic_to_func_t) (hb_position_t control1_x, hb_position_t control1_y, - hb_position_t control2_x, hb_position_t control2_y, - hb_position_t to_x, hb_position_t to_y, - void *user_data); -typedef void (*hb_ot_glyph_decompose_close_path_func_t) (void *user_data); - -/** - * hb_ot_glyph_decompose_funcs_t: - * - * Glyph decompose callbacks. - * - * Since: REPLACEME - **/ -typedef struct hb_ot_glyph_decompose_funcs_t hb_ot_glyph_decompose_funcs_t; - -HB_EXTERN void -hb_ot_glyph_decompose_funcs_set_move_to_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_move_to_func_t move_to); - -HB_EXTERN void -hb_ot_glyph_decompose_funcs_set_line_to_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_move_to_func_t line_to); - -HB_EXTERN void -hb_ot_glyph_decompose_funcs_set_conic_to_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_conic_to_func_t conic_to); - -HB_EXTERN void -hb_ot_glyph_decompose_funcs_set_cubic_to_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_cubic_to_func_t cubic_to); - -HB_EXTERN void -hb_ot_glyph_decompose_funcs_set_close_path_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_close_path_func_t close_path); - -HB_EXTERN hb_ot_glyph_decompose_funcs_t * -hb_ot_glyph_decompose_funcs_create (void); - -HB_EXTERN hb_ot_glyph_decompose_funcs_t * -hb_ot_glyph_decompose_funcs_reference (hb_ot_glyph_decompose_funcs_t *funcs); - -HB_EXTERN void -hb_ot_glyph_decompose_funcs_destroy (hb_ot_glyph_decompose_funcs_t *funcs); - -HB_EXTERN hb_bool_t -hb_ot_glyph_decompose (hb_font_t *font, hb_codepoint_t glyph, - const hb_ot_glyph_decompose_funcs_t *funcs, - void *user_data); - -HB_END_DECLS - -#endif /* HB_OT_GLYPH_H */ diff --git a/src/hb-ot.h b/src/hb-ot.h index a66840bea..f2dbaa1b3 100644 --- a/src/hb-ot.h +++ b/src/hb-ot.h @@ -33,7 +33,6 @@ #include "hb-ot-color.h" #include "hb-ot-deprecated.h" #include "hb-ot-font.h" -#include "hb-ot-glyph.h" #include "hb-ot-layout.h" #include "hb-ot-math.h" #include "hb-ot-meta.h" diff --git a/src/hb-ot-glyph.cc b/src/hb-outline.cc similarity index 61% rename from src/hb-ot-glyph.cc rename to src/hb-outline.cc index 1ccf681de..1bd333af6 100644 --- a/src/hb-ot-glyph.cc +++ b/src/hb-outline.cc @@ -24,16 +24,16 @@ #include "hb.hh" -#ifndef HB_NO_GLYPH +#ifndef HB_NO_OUTLINE #include "hb-ot.h" #include "hb-ot-glyf-table.hh" #include "hb-ot-cff1-table.hh" #include "hb-ot-cff2-table.hh" -#include "hb-ot-glyph.hh" +#include "hb-outline.hh" /** - * hb_ot_glyph_decompose_funcs_set_move_to_func: + * hb_outline_decompose_funcs_set_move_to_func: * @funcs: decompose functions object * @move_to: move-to callback * @@ -42,15 +42,15 @@ * Since: REPLACEME **/ void -hb_ot_glyph_decompose_funcs_set_move_to_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_move_to_func_t move_to) +hb_outline_decompose_funcs_set_move_to_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_move_to_func_t move_to) { - if (unlikely (funcs == &Null (hb_ot_glyph_decompose_funcs_t))) return; + if (unlikely (funcs == &Null (hb_outline_decompose_funcs_t))) return; funcs->move_to = move_to; } /** - * hb_ot_glyph_decompose_funcs_set_line_to_func: + * hb_outline_decompose_funcs_set_line_to_func: * @funcs: decompose functions object * @line_to: line-to callback * @@ -59,15 +59,15 @@ hb_ot_glyph_decompose_funcs_set_move_to_func (hb_ot_glyph_decompose_funcs_t * Since: REPLACEME **/ void -hb_ot_glyph_decompose_funcs_set_line_to_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_line_to_func_t line_to) +hb_outline_decompose_funcs_set_line_to_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_line_to_func_t line_to) { - if (unlikely (funcs == &Null (hb_ot_glyph_decompose_funcs_t))) return; + if (unlikely (funcs == &Null (hb_outline_decompose_funcs_t))) return; funcs->line_to = line_to; } /** - * hb_ot_glyph_decompose_funcs_set_conic_to_func: + * hb_outline_decompose_funcs_set_conic_to_func: * @funcs: decompose functions object * @move_to: conic-to callback * @@ -76,15 +76,15 @@ hb_ot_glyph_decompose_funcs_set_line_to_func (hb_ot_glyph_decompose_funcs_t * Since: REPLACEME **/ void -hb_ot_glyph_decompose_funcs_set_conic_to_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_conic_to_func_t conic_to) +hb_outline_decompose_funcs_set_conic_to_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_conic_to_func_t conic_to) { - if (unlikely (funcs == &Null (hb_ot_glyph_decompose_funcs_t))) return; + if (unlikely (funcs == &Null (hb_outline_decompose_funcs_t))) return; funcs->conic_to = conic_to; } /** - * hb_ot_glyph_decompose_funcs_set_cubic_to_func: + * hb_outline_decompose_funcs_set_cubic_to_func: * @funcs: decompose functions * @cubic_to: cubic-to callback * @@ -93,15 +93,15 @@ hb_ot_glyph_decompose_funcs_set_conic_to_func (hb_ot_glyph_decompose_funcs_t * Since: REPLACEME **/ void -hb_ot_glyph_decompose_funcs_set_cubic_to_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_cubic_to_func_t cubic_to) +hb_outline_decompose_funcs_set_cubic_to_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_cubic_to_func_t cubic_to) { - if (unlikely (funcs == &Null (hb_ot_glyph_decompose_funcs_t))) return; + if (unlikely (funcs == &Null (hb_outline_decompose_funcs_t))) return; funcs->cubic_to = cubic_to; } /** - * hb_ot_glyph_decompose_funcs_set_close_path_func: + * hb_outline_decompose_funcs_set_close_path_func: * @funcs: decompose functions object * @close_path: close-path callback * @@ -110,10 +110,10 @@ hb_ot_glyph_decompose_funcs_set_cubic_to_func (hb_ot_glyph_decompose_funcs_t * Since: REPLACEME **/ void -hb_ot_glyph_decompose_funcs_set_close_path_func (hb_ot_glyph_decompose_funcs_t *funcs, - hb_ot_glyph_decompose_close_path_func_t close_path) +hb_outline_decompose_funcs_set_close_path_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_close_path_func_t close_path) { - if (unlikely (funcs == &Null (hb_ot_glyph_decompose_funcs_t))) return; + if (unlikely (funcs == &Null (hb_outline_decompose_funcs_t))) return; funcs->close_path = close_path; } @@ -137,29 +137,29 @@ static void _close_path_nil (void *user_data HB_UNUSED) {} /** - * hb_ot_glyph_decompose_funcs_create: + * hb_outline_decompose_funcs_create: * * Creates a new decompose callbacks object. * * Since: REPLACEME **/ -hb_ot_glyph_decompose_funcs_t * -hb_ot_glyph_decompose_funcs_create () +hb_outline_decompose_funcs_t * +hb_outline_decompose_funcs_create () { - hb_ot_glyph_decompose_funcs_t *funcs; - if (unlikely (!(funcs = hb_object_create ()))) - return const_cast (&Null (hb_ot_glyph_decompose_funcs_t)); + hb_outline_decompose_funcs_t *funcs; + if (unlikely (!(funcs = hb_object_create ()))) + return const_cast (&Null (hb_outline_decompose_funcs_t)); - funcs->move_to = (hb_ot_glyph_decompose_move_to_func_t) _move_to_nil; - funcs->line_to = (hb_ot_glyph_decompose_line_to_func_t) _line_to_nil; - funcs->conic_to = (hb_ot_glyph_decompose_conic_to_func_t) _conic_to_nil; - funcs->cubic_to = (hb_ot_glyph_decompose_cubic_to_func_t) _cubic_to_nil; - funcs->close_path = (hb_ot_glyph_decompose_close_path_func_t) _close_path_nil; + funcs->move_to = (hb_outline_decompose_move_to_func_t) _move_to_nil; + funcs->line_to = (hb_outline_decompose_line_to_func_t) _line_to_nil; + funcs->conic_to = (hb_outline_decompose_conic_to_func_t) _conic_to_nil; + funcs->cubic_to = (hb_outline_decompose_cubic_to_func_t) _cubic_to_nil; + funcs->close_path = (hb_outline_decompose_close_path_func_t) _close_path_nil; return funcs; } /** - * hb_ot_glyph_decompose_funcs_reference: + * hb_outline_decompose_funcs_reference: * @funcs: decompose functions * * Add to callbacks object refcount. @@ -167,14 +167,14 @@ hb_ot_glyph_decompose_funcs_create () * Returns: The same object. * Since: REPLACEME **/ -hb_ot_glyph_decompose_funcs_t * -hb_ot_glyph_decompose_funcs_reference (hb_ot_glyph_decompose_funcs_t *funcs) +hb_outline_decompose_funcs_t * +hb_outline_decompose_funcs_reference (hb_outline_decompose_funcs_t *funcs) { return hb_object_reference (funcs); } /** - * hb_ot_glyph_decompose_funcs_destroy: + * hb_outline_decompose_funcs_destroy: * @funcs: decompose functions * * Decreases refcount of callbacks object and deletes the object if it reaches @@ -183,7 +183,7 @@ hb_ot_glyph_decompose_funcs_reference (hb_ot_glyph_decompose_funcs_t *funcs) * Since: REPLACEME **/ void -hb_ot_glyph_decompose_funcs_destroy (hb_ot_glyph_decompose_funcs_t *funcs) +hb_outline_decompose_funcs_destroy (hb_outline_decompose_funcs_t *funcs) { if (!hb_object_destroy (funcs)) return; @@ -191,7 +191,7 @@ hb_ot_glyph_decompose_funcs_destroy (hb_ot_glyph_decompose_funcs_t *funcs) } /** - * hb_ot_glyph_decompose: + * hb_outline_decompose: * @font: a font object * @glyph: a glyph id * @funcs: decompose callbacks object @@ -203,11 +203,11 @@ hb_ot_glyph_decompose_funcs_destroy (hb_ot_glyph_decompose_funcs_t *funcs) * Since: REPLACEME **/ hb_bool_t -hb_ot_glyph_decompose (hb_font_t *font, hb_codepoint_t glyph, - const hb_ot_glyph_decompose_funcs_t *funcs, - void *user_data) +hb_outline_decompose (hb_font_t *font, hb_codepoint_t glyph, + const hb_outline_decompose_funcs_t *funcs, + void *user_data) { - if (unlikely (!funcs || funcs == &Null (hb_ot_glyph_decompose_funcs_t) || + if (unlikely (funcs == &Null (hb_outline_decompose_funcs_t) || glyph >= font->face->get_num_glyphs ())) return false; diff --git a/src/hb-outline.h b/src/hb-outline.h new file mode 100644 index 000000000..ab123cad0 --- /dev/null +++ b/src/hb-outline.h @@ -0,0 +1,92 @@ +/* + * Copyright © 2019-2020 Ebrahim Byagowi + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + */ + +#ifndef HB_H_IN +#error "Include instead." +#endif + +#ifndef HB_OUTLINE_H +#define HB_OUTLINE_H + +#include "hb.h" + +HB_BEGIN_DECLS + +typedef void (*hb_outline_decompose_move_to_func_t) (hb_position_t to_x, hb_position_t to_y, void *user_data); +typedef void (*hb_outline_decompose_line_to_func_t) (hb_position_t to_x, hb_position_t to_y, void *user_data); +typedef void (*hb_outline_decompose_conic_to_func_t) (hb_position_t control_x, hb_position_t control_y, + hb_position_t to_x, hb_position_t to_y, + void *user_data); +typedef void (*hb_outline_decompose_cubic_to_func_t) (hb_position_t control1_x, hb_position_t control1_y, + hb_position_t control2_x, hb_position_t control2_y, + hb_position_t to_x, hb_position_t to_y, + void *user_data); +typedef void (*hb_outline_decompose_close_path_func_t) (void *user_data); + +/** + * hb_outline_decompose_funcs_t: + * + * Glyph decompose callbacks. + * + * Since: REPLACEME + **/ +typedef struct hb_outline_decompose_funcs_t hb_outline_decompose_funcs_t; + +HB_EXTERN void +hb_outline_decompose_funcs_set_move_to_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_move_to_func_t move_to); + +HB_EXTERN void +hb_outline_decompose_funcs_set_line_to_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_move_to_func_t line_to); + +HB_EXTERN void +hb_outline_decompose_funcs_set_conic_to_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_conic_to_func_t conic_to); + +HB_EXTERN void +hb_outline_decompose_funcs_set_cubic_to_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_cubic_to_func_t cubic_to); + +HB_EXTERN void +hb_outline_decompose_funcs_set_close_path_func (hb_outline_decompose_funcs_t *funcs, + hb_outline_decompose_close_path_func_t close_path); + +HB_EXTERN hb_outline_decompose_funcs_t * +hb_outline_decompose_funcs_create (void); + +HB_EXTERN hb_outline_decompose_funcs_t * +hb_outline_decompose_funcs_reference (hb_outline_decompose_funcs_t *funcs); + +HB_EXTERN void +hb_outline_decompose_funcs_destroy (hb_outline_decompose_funcs_t *funcs); + +HB_EXTERN hb_bool_t +hb_outline_decompose (hb_font_t *font, hb_codepoint_t glyph, + const hb_outline_decompose_funcs_t *funcs, + void *user_data); + +HB_END_DECLS + +#endif /* HB_OUTLINE_H */ diff --git a/src/hb-ot-glyph.hh b/src/hb-outline.hh similarity index 75% rename from src/hb-ot-glyph.hh rename to src/hb-outline.hh index 23434d92a..a66b2d985 100644 --- a/src/hb-ot-glyph.hh +++ b/src/hb-outline.hh @@ -22,21 +22,21 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -#ifndef HB_OT_GLYPH_HH -#define HB_OT_GLYPH_HH +#ifndef HB_OUTLINE_HH +#define HB_OUTLINE_HH #include "hb.hh" -struct hb_ot_glyph_decompose_funcs_t +struct hb_outline_decompose_funcs_t { hb_object_header_t header; - hb_ot_glyph_decompose_move_to_func_t move_to; - hb_ot_glyph_decompose_line_to_func_t line_to; - hb_ot_glyph_decompose_conic_to_func_t conic_to; - hb_ot_glyph_decompose_cubic_to_func_t cubic_to; - hb_ot_glyph_decompose_close_path_func_t close_path; + hb_outline_decompose_move_to_func_t move_to; + hb_outline_decompose_line_to_func_t line_to; + hb_outline_decompose_conic_to_func_t conic_to; + hb_outline_decompose_cubic_to_func_t cubic_to; + hb_outline_decompose_close_path_func_t close_path; }; -#endif /* HB_OT_GLYPH_HH */ +#endif /* HB_OUTLINE_HH */ diff --git a/src/hb.h b/src/hb.h index c5e7072fb..0d1eed09e 100644 --- a/src/hb.h +++ b/src/hb.h @@ -34,6 +34,7 @@ #include "hb-deprecated.h" #include "hb-face.h" #include "hb-font.h" +#include "hb-outline.h" #include "hb-map.h" #include "hb-set.h" #include "hb-shape.h" diff --git a/src/main.cc b/src/main.cc index 0927a1c5a..31ca250b3 100644 --- a/src/main.cc +++ b/src/main.cc @@ -37,7 +37,7 @@ #define hb_blob_create_from_file(x) hb_blob_get_empty () #endif -#if !defined(HB_NO_COLOR) && !defined(HB_NO_GLYPH) +#if !defined(HB_NO_COLOR) && !defined(HB_NO_OUTLINE) static void svg_dump (hb_face_t *face, unsigned face_index) { @@ -169,7 +169,7 @@ close_path (user_data_t &user_data) } static void -layered_glyph_dump (hb_font_t *font, hb_ot_glyph_decompose_funcs_t *funcs, unsigned face_index) +layered_glyph_dump (hb_font_t *font, hb_outline_decompose_funcs_t *funcs, unsigned face_index) { hb_face_t *face = hb_font_get_face (font); unsigned num_glyphs = hb_face_get_glyph_count (face); @@ -224,7 +224,7 @@ layered_glyph_dump (hb_font_t *font, hb_ot_glyph_decompose_funcs_t *funcs, unsig if (hb_color_get_alpha (color) != 255) fprintf (f, "fill-opacity=\"%.3f\"", (double) hb_color_get_alpha (color) / 255.); fprintf (f, "d=\""); - if (!hb_ot_glyph_decompose (font, layers[layer].glyph, funcs, &user_data)) + if (!hb_outline_decompose (font, layers[layer].glyph, funcs, &user_data)) printf ("Failed to decompose layer %d while %d\n", layers[layer].glyph, gid); fprintf (f, "\"/>\n"); } @@ -242,7 +242,7 @@ layered_glyph_dump (hb_font_t *font, hb_ot_glyph_decompose_funcs_t *funcs, unsig } static void -dump_glyphs (hb_font_t *font, hb_ot_glyph_decompose_funcs_t *funcs, unsigned face_index) +dump_glyphs (hb_font_t *font, hb_outline_decompose_funcs_t *funcs, unsigned face_index) { unsigned num_glyphs = hb_face_get_glyph_count (hb_font_get_face (font)); for (unsigned gid = 0; gid < num_glyphs; ++gid) @@ -266,7 +266,7 @@ dump_glyphs (hb_font_t *font, hb_ot_glyph_decompose_funcs_t *funcs, unsigned fac user_data_t user_data; user_data.ascender = font_extents.ascender; user_data.f = f; - if (!hb_ot_glyph_decompose (font, gid, funcs, &user_data)) + if (!hb_outline_decompose (font, gid, funcs, &user_data)) printf ("Failed to decompose gid: %d\n", gid); fprintf (f, "\"/>"); fclose (f); @@ -293,12 +293,12 @@ dump_glyphs (hb_blob_t *blob, const char *font_name) fwrite (font_name, 1, strlen (font_name), font_name_file); fclose (font_name_file); - hb_ot_glyph_decompose_funcs_t *funcs = hb_ot_glyph_decompose_funcs_create (); - hb_ot_glyph_decompose_funcs_set_move_to_func (funcs, (hb_ot_glyph_decompose_move_to_func_t) move_to); - hb_ot_glyph_decompose_funcs_set_line_to_func (funcs, (hb_ot_glyph_decompose_line_to_func_t) line_to); - hb_ot_glyph_decompose_funcs_set_conic_to_func (funcs, (hb_ot_glyph_decompose_conic_to_func_t) conic_to); - hb_ot_glyph_decompose_funcs_set_cubic_to_func (funcs, (hb_ot_glyph_decompose_cubic_to_func_t) cubic_to); - hb_ot_glyph_decompose_funcs_set_close_path_func (funcs, (hb_ot_glyph_decompose_close_path_func_t) close_path); + hb_outline_decompose_funcs_t *funcs = hb_outline_decompose_funcs_create (); + hb_outline_decompose_funcs_set_move_to_func (funcs, (hb_outline_decompose_move_to_func_t) move_to); + hb_outline_decompose_funcs_set_line_to_func (funcs, (hb_outline_decompose_line_to_func_t) line_to); + hb_outline_decompose_funcs_set_conic_to_func (funcs, (hb_outline_decompose_conic_to_func_t) conic_to); + hb_outline_decompose_funcs_set_cubic_to_func (funcs, (hb_outline_decompose_cubic_to_func_t) cubic_to); + hb_outline_decompose_funcs_set_close_path_func (funcs, (hb_outline_decompose_close_path_func_t) close_path); unsigned num_faces = hb_face_count (blob); for (unsigned face_index = 0; face_index < num_faces; ++face_index) @@ -324,7 +324,7 @@ dump_glyphs (hb_blob_t *blob, const char *font_name) hb_face_destroy (face); } - hb_ot_glyph_decompose_funcs_destroy (funcs); + hb_outline_decompose_funcs_destroy (funcs); } #endif @@ -501,7 +501,7 @@ main (int argc, char **argv) hb_blob_t *blob = hb_blob_create_from_file (argv[1]); printf ("Opened font file %s: %d bytes long\n", argv[1], hb_blob_get_length (blob)); print_layout_info_using_private_api (blob); -#if !defined(HB_NO_COLOR) && !defined(HB_NO_GLYPH) +#if !defined(HB_NO_COLOR) && !defined(HB_NO_OUTLINE) dump_glyphs (blob, argv[1]); #endif hb_blob_destroy (blob); diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 868fe9dcb..d6f47a53c 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -38,8 +38,8 @@ TEST_PROGS = \ test-map \ test-object \ test-ot-face \ - test-ot-glyph \ test-ot-glyphname \ + test-outline \ test-set \ test-shape \ test-subset \ diff --git a/test/api/test-ot-face.c b/test/api/test-ot-face.c index 4cc2024b1..62c52fedf 100644 --- a/test/api/test-ot-face.c +++ b/test/api/test-ot-face.c @@ -121,10 +121,10 @@ test_face (hb_face_t *face, hb_ot_var_normalize_variations (face, NULL, 0, NULL, 0); hb_ot_var_normalize_coords (face, 0, NULL, NULL); - hb_ot_glyph_decompose_funcs_t *funcs = hb_ot_glyph_decompose_funcs_create (); + hb_outline_decompose_funcs_t *funcs = hb_outline_decompose_funcs_create (); for (unsigned gid = 0; gid < 10; ++gid) - hb_ot_glyph_decompose (font, gid, funcs, NULL); - hb_ot_glyph_decompose_funcs_destroy (funcs); + hb_outline_decompose (font, gid, funcs, NULL); + hb_outline_decompose_funcs_destroy (funcs); hb_set_destroy (set); hb_font_destroy (font); diff --git a/test/api/test-ot-glyph.c b/test/api/test-outline.c similarity index 90% rename from test/api/test-ot-glyph.c rename to test/api/test-outline.c index 9f195185e..345fa8cd7 100644 --- a/test/api/test-ot-glyph.c +++ b/test/api/test-outline.c @@ -24,7 +24,7 @@ #include "hb-test.h" -#include +#include typedef struct user_data_t { @@ -159,16 +159,16 @@ close_path (user_data_t *user_data) user_data->str[user_data->consumed++] = 'Z'; } -static hb_ot_glyph_decompose_funcs_t *funcs; +static hb_outline_decompose_funcs_t *funcs; static void -test_hb_ot_glyph_empty (void) +test_hb_glyph_empty (void) { - g_assert (!hb_ot_glyph_decompose (hb_font_get_empty (), 3, funcs, NULL)); + g_assert (!hb_outline_decompose (hb_font_get_empty (), 3, funcs, NULL)); } static void -test_hb_ot_glyph_glyf (void) +test_hb_glyph_glyf (void) { hb_face_t *face = hb_test_open_font_file ("fonts/SourceSerifVariable-Roman-VVAR.abc.ttf"); hb_font_t *font = hb_font_create (face); @@ -182,9 +182,9 @@ test_hb_ot_glyph_glyf (void) }; user_data.consumed = 0; - g_assert (!hb_ot_glyph_decompose (font, 4, funcs, &user_data)); + g_assert (!hb_outline_decompose (font, 4, funcs, &user_data)); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 3, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 3, funcs, &user_data)); char expected[] = "M275,442L275,442Q232,442 198,420Q164,397 145,353Q126,309 126,245L126,245" "Q126,182 147,139Q167,95 204,73Q240,50 287,50L287,50Q330,50 367,70" "Q404,90 427,128L427,128L451,116Q431,54 384,21Q336,-13 266,-13L266,-13Q198,-13 148,18" @@ -199,7 +199,7 @@ test_hb_ot_glyph_glyf (void) hb_font_set_variations (font, &var, 1); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 3, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 3, funcs, &user_data)); char expected2[] = "M323,448L323,448Q297,448 271,430Q244,412 227,371" "Q209,330 209,261L209,261Q209,204 226,166Q242,127 273,107Q303,86 344,86L344,86Q378,86 404,101" "Q430,115 451,137L451,137L488,103Q458,42 404,13Q350,-16 279,-16L279,-16Q211,-16 153,13Q95,41 60,99" @@ -212,7 +212,7 @@ test_hb_ot_glyph_glyf (void) } static void -test_hb_ot_glyph_cff1 (void) +test_hb_glyph_cff1 (void) { hb_face_t *face = hb_test_open_font_file ("fonts/cff1_seac.otf"); hb_font_t *font = hb_font_create (face); @@ -224,7 +224,7 @@ test_hb_ot_glyph_cff1 (void) .size = sizeof (str), .consumed = 0 }; - g_assert (hb_ot_glyph_decompose (font, 3, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 3, funcs, &user_data)); char expected[] = "M203,367C227,440 248,512 268,588L272,588C293,512 314,440 338,367L369,267L172,267Z" "M3,0L88,0L151,200L390,200L452,0L541,0L319,656L225,656Z" "M300,653L342,694L201,861L143,806Z"; @@ -234,7 +234,7 @@ test_hb_ot_glyph_cff1 (void) } static void -test_hb_ot_glyph_cff1_rline (void) +test_hb_glyph_cff1_rline (void) { /* https://github.com/harfbuzz/harfbuzz/pull/2053 */ hb_face_t *face = hb_test_open_font_file ("fonts/RanaKufi-Regular.subset.otf"); @@ -247,7 +247,7 @@ test_hb_ot_glyph_cff1_rline (void) .size = sizeof (str), .consumed = 0 }; - g_assert (hb_ot_glyph_decompose (font, 1, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 1, funcs, &user_data)); char expected[] = "M775,400C705,400 650,343 650,274L650,250L391,250L713,572L392,893" "L287,1000C311,942 296,869 250,823C250,823 286,858 321,823L571,572" "L150,150L750,150L750,276C750,289 761,300 775,300C789,300 800,289 800,276" @@ -259,7 +259,7 @@ test_hb_ot_glyph_cff1_rline (void) } static void -test_hb_ot_glyph_cff2 (void) +test_hb_glyph_cff2 (void) { hb_face_t *face = hb_test_open_font_file ("fonts/AdobeVFPrototype.abc.otf"); hb_font_t *font = hb_font_create (face); @@ -272,7 +272,7 @@ test_hb_ot_glyph_cff2 (void) }; user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 3, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 3, funcs, &user_data)); char expected[] = "M275,442C303,442 337,435 371,417L325,454L350,366" "C357,341 370,321 403,321C428,321 443,333 448,358" "C435,432 361,487 272,487C153,487 43,393 43,236" @@ -286,7 +286,7 @@ test_hb_ot_glyph_cff2 (void) hb_font_set_variations (font, &var, 1); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 3, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 3, funcs, &user_data)); char expected2[] = "M323,448C356,448 380,441 411,427L333,469L339,401" "C343,322 379,297 420,297C458,297 480,314 492,352" "C486,433 412,501 303,501C148,501 25,406 25,241" @@ -298,7 +298,7 @@ test_hb_ot_glyph_cff2 (void) } static void -test_hb_ot_glyph_ttf_parser_tests (void) +test_hb_glyph_ttf_parser_tests (void) { /* https://github.com/RazrFalcon/ttf-parser/blob/337e7d1c/tests/tests.rs#L50-L133 */ char str[1024] = {0}; @@ -313,19 +313,19 @@ test_hb_ot_glyph_ttf_parser_tests (void) { /* We aren't identical on paths points for glyf with ttf-parser but visually, investigate */ user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 0, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 0, funcs, &user_data)); char expected[] = "M450,0L50,0L50,750L450,750L450,0Z"; g_assert_cmpmem (str, user_data.consumed, expected, sizeof (expected) - 1); } { user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 1, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 1, funcs, &user_data)); char expected[] = "M514,416L56,416L56,487L514,487L514,416ZM514,217L56,217L56,288L514,288L514,217Z"; g_assert_cmpmem (str, user_data.consumed, expected, sizeof (expected) - 1); } { user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 4, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 4, funcs, &user_data)); char expected[] = "M332,536L332,468L197,468L197,0L109,0L109,468L15,468L15,509L109,539L109,570" "Q109,674 155,720Q201,765 283,765L283,765Q315,765 342,760Q368,754 387,747" "L387,747L364,678Q348,683 327,688Q306,693 284,693L284,693Q240,693 219,664" @@ -338,13 +338,13 @@ test_hb_ot_glyph_ttf_parser_tests (void) { /* According to tests on tts-parser we should return an empty on single point but we aren't */ user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 5, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 5, funcs, &user_data)); char expected[] = "M15,0Q15,0 15,0Z"; g_assert_cmpmem (str, user_data.consumed, expected, sizeof (expected) - 1); } { user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 6, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 6, funcs, &user_data)); char expected[] = "M346,536L346,468L211,468L211,0L123,0L123,468L29,468" "L29,509L123,539L123,570Q123,674 169,720Q215,765 297,765" "L297,765Q329,765 356,760Q382,754 401,747L401,747L378,678" @@ -361,7 +361,7 @@ test_hb_ot_glyph_ttf_parser_tests (void) hb_face_destroy (face); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 1, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 1, funcs, &user_data)); char expected[] = "M0,0C100,0 150,-20 250,-20C350,-20 400,0 500,0C500,100 520,150 520,250" "C520,350 500,400 500,500C400,500 350,520 250,520C150,520 100,500 0,500" "C0,400 -20,350 -20,250C-20,150 0,100 0,0ZM50,50C50,130 34,170 34,250" @@ -378,7 +378,7 @@ test_hb_ot_glyph_ttf_parser_tests (void) hb_face_destroy (face); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 1, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 1, funcs, &user_data)); char expected[] = "M82,0L164,0L164,486L82,486ZM124,586C156,586 181,608 181,639" "C181,671 156,692 124,692C92,692 67,671 67,639C67,608 92,586 124,586Z"; g_assert_cmpmem (str, user_data.consumed, expected, sizeof (expected) - 1); @@ -388,7 +388,7 @@ test_hb_ot_glyph_ttf_parser_tests (void) } static void -test_hb_ot_glyph_font_kit_glyphs_tests (void) +test_hb_glyph_font_kit_glyphs_tests (void) { /* https://github.com/foliojs/fontkit/blob/master/test/glyphs.js */ char str[2048]; @@ -404,7 +404,7 @@ test_hb_ot_glyph_font_kit_glyphs_tests (void) /* should get a path for the glyph */ user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 37, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 37, funcs, &user_data)); char expected[] = "M201,0L201,1462L614,1462Q905,1462 1035,1375Q1165,1288 1165,1100" "L1165,1100Q1165,970 1093,886Q1020,801 881,776L881,776L881,766" "Q1214,709 1214,416L1214,416Q1214,220 1082,110Q949,0 711,0L711,0L201,0Z" @@ -416,7 +416,7 @@ test_hb_ot_glyph_font_kit_glyphs_tests (void) /* should get a path for the glyph */ user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 171, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 171, funcs, &user_data)); char expected2[] = "M639,-20L639,-20Q396,-20 256,128Q115,276 115,539L115,539" "Q115,804 246,960Q376,1116 596,1116L596,1116Q802,1116 922,981" "Q1042,845 1042,623L1042,623L1042,518L287,518Q292,325 385,225" @@ -445,7 +445,7 @@ test_hb_ot_glyph_font_kit_glyphs_tests (void) /* should resolve composite glyphs recursively */ user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, codepoint, funcs, &user_data)); + g_assert (hb_outline_decompose (font, codepoint, funcs, &user_data)); char expected[] = "M581,170L581,274L443,274Q409,274 384,259Q359,243 348,219" "Q336,194 340,166Q343,138 365,111L365,111L468,-13Q470,-10 473,-7" "Q475,-3 477,0L477,0L253,0Q225,0 203,8Q180,15 168,32Q155,48 155,73" @@ -463,7 +463,7 @@ test_hb_ot_glyph_font_kit_glyphs_tests (void) /* should transform points of a composite glyph */ user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 2, funcs, &user_data)); /* 2 == arAlef.fina */ + g_assert (hb_outline_decompose (font, 2, funcs, &user_data)); /* 2 == arAlef.fina */ char expected2[] = "M50,624L155,624L155,84Q150,90 146,95Q141,99 136,105L136,105" "L292,105L292,0L156,0Q128,0 104,14Q79,27 65,51Q50,74 50,104" "L50,104L50,624ZM282,0L282,105L312,105L312,0L282,0Z"; @@ -478,7 +478,7 @@ test_hb_ot_glyph_font_kit_glyphs_tests (void) hb_face_destroy (face); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 5, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 5, funcs, &user_data)); char expected[] = "M90,0L258,0C456,0 564,122 564,331C564,539 456,656 254,656L90,656ZM173,68" "L173,588L248,588C401,588 478,496 478,331C478,165 401,68 248,68Z"; g_assert_cmpmem (str, user_data.consumed, expected, sizeof (expected) - 1); @@ -493,7 +493,7 @@ test_hb_ot_glyph_font_kit_glyphs_tests (void) hb_face_destroy (face); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, 1, funcs, &user_data)); + g_assert (hb_outline_decompose (font, 1, funcs, &user_data)); char expected[] = "M139,390C175,390 205,419 205,459C205,501 175,530 139,530C103,530 73,501 73,459" "C73,419 103,390 139,390ZM139,-13C175,-13 205,15 205,56C205,97 175,127 139,127" "C103,127 73,97 73,56C73,15 103,-13 139,-13Z"; @@ -505,7 +505,7 @@ test_hb_ot_glyph_font_kit_glyphs_tests (void) } static void -test_hb_ot_glyph_font_kit_variations_tests (void) +test_hb_glyph_font_kit_variations_tests (void) { /* https://github.com/foliojs/fontkit/blob/b310db5/test/variations.js */ char str[2048]; @@ -538,7 +538,7 @@ test_hb_ot_glyph_font_kit_variations_tests (void) hb_buffer_destroy (buffer); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, codepoint, funcs, &user_data)); + g_assert (hb_outline_decompose (font, codepoint, funcs, &user_data)); char expected[] = "M414,-102L371,-102L371,539L914,539L914,-27Q914,-102 840,-102L840,-102Q796,-102 755,-98" "L755,-98L742,-59Q790,-66 836,-66L836,-66Q871,-66 871,-31L871,-31L871,504L414,504L414,-102Z" "M203,-94L203,-94Q138,-94 86,-90L86,-90L74,-52Q137,-59 188,-59L188,-59Q211,-59 222,-47" @@ -584,7 +584,7 @@ test_hb_ot_glyph_font_kit_variations_tests (void) hb_buffer_destroy (buffer); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, codepoint, funcs, &user_data)); + g_assert (hb_outline_decompose (font, codepoint, funcs, &user_data)); char expected[] = "M414,-102L371,-102L371,539L914,539L914,-27Q914,-102 840,-102L840,-102Q796,-102 755,-98" "L755,-98L742,-59Q790,-66 836,-66L836,-66Q871,-66 871,-31L871,-31L871,504L414,504" "L414,-102ZM203,-94L203,-94Q138,-94 86,-90L86,-90L74,-52Q137,-59 188,-59L188,-59" @@ -630,7 +630,7 @@ test_hb_ot_glyph_font_kit_variations_tests (void) hb_buffer_destroy (buffer); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, codepoint, funcs, &user_data)); + g_assert (hb_outline_decompose (font, codepoint, funcs, &user_data)); char expected[] = "M414,-102L371,-102L371,539L914,539L914,-27Q914,-102 840,-102L840,-102" "Q796,-102 755,-98L755,-98L742,-59Q790,-66 836,-66L836,-66Q871,-66 871,-31" "L871,-31L871,504L414,504L414,-102ZM203,-94L203,-94Q138,-94 86,-90" @@ -680,7 +680,7 @@ test_hb_ot_glyph_font_kit_variations_tests (void) hb_buffer_destroy (buffer); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, codepoint, funcs, &user_data)); + g_assert (hb_outline_decompose (font, codepoint, funcs, &user_data)); char expected[] = "M246,15C188,15 147,27 101,68L142,23L117,117C111,143 96,149 81,149" "C65,149 56,141 52,126C71,40 137,-13 244,-13C348,-13 436,46 436,156" "C436,229 405,295 271,349L247,359C160,393 119,439 119,506" @@ -704,7 +704,7 @@ test_hb_ot_glyph_font_kit_variations_tests (void) hb_buffer_destroy (buffer); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, codepoint, funcs, &user_data)); + g_assert (hb_outline_decompose (font, codepoint, funcs, &user_data)); char expected[] = "M251,36C206,36 165,42 118,61L176,21L161,99C151,152 129,167 101,167" "C78,167 61,155 51,131C54,43 133,-14 247,-14C388,-14 474,64 474,171" "C474,258 430,321 294,370L257,383C188,406 150,438 150,499" @@ -729,7 +729,7 @@ test_hb_ot_glyph_font_kit_variations_tests (void) hb_buffer_destroy (buffer); user_data.consumed = 0; - g_assert (hb_ot_glyph_decompose (font, codepoint, funcs, &user_data)); + g_assert (hb_outline_decompose (font, codepoint, funcs, &user_data)); char expected[] = "M258,38C197,38 167,48 118,71L192,19L183,103C177,155 155,174 115,174" "C89,174 64,161 51,125C52,36 124,-16 258,-16C417,-16 513,67 513,175" "C513,278 457,328 322,388L289,403C232,429 203,452 203,500C203,562 244,589 301,589" @@ -747,25 +747,25 @@ test_hb_ot_glyph_font_kit_variations_tests (void) int main (int argc, char **argv) { - funcs = hb_ot_glyph_decompose_funcs_create (); - hb_ot_glyph_decompose_funcs_set_move_to_func (funcs, (hb_ot_glyph_decompose_move_to_func_t) move_to); - hb_ot_glyph_decompose_funcs_set_line_to_func (funcs, (hb_ot_glyph_decompose_line_to_func_t) line_to); - hb_ot_glyph_decompose_funcs_set_conic_to_func (funcs, (hb_ot_glyph_decompose_conic_to_func_t) conic_to); - hb_ot_glyph_decompose_funcs_set_cubic_to_func (funcs, (hb_ot_glyph_decompose_cubic_to_func_t) cubic_to); - hb_ot_glyph_decompose_funcs_set_close_path_func (funcs, (hb_ot_glyph_decompose_close_path_func_t) close_path); + funcs = hb_outline_decompose_funcs_create (); + hb_outline_decompose_funcs_set_move_to_func (funcs, (hb_outline_decompose_move_to_func_t) move_to); + hb_outline_decompose_funcs_set_line_to_func (funcs, (hb_outline_decompose_line_to_func_t) line_to); + hb_outline_decompose_funcs_set_conic_to_func (funcs, (hb_outline_decompose_conic_to_func_t) conic_to); + hb_outline_decompose_funcs_set_cubic_to_func (funcs, (hb_outline_decompose_cubic_to_func_t) cubic_to); + hb_outline_decompose_funcs_set_close_path_func (funcs, (hb_outline_decompose_close_path_func_t) close_path); hb_test_init (&argc, &argv); hb_test_add (test_itoa); - hb_test_add (test_hb_ot_glyph_empty); - hb_test_add (test_hb_ot_glyph_glyf); - hb_test_add (test_hb_ot_glyph_cff1); - hb_test_add (test_hb_ot_glyph_cff1_rline); - hb_test_add (test_hb_ot_glyph_cff2); - hb_test_add (test_hb_ot_glyph_ttf_parser_tests); - hb_test_add (test_hb_ot_glyph_font_kit_glyphs_tests); - hb_test_add (test_hb_ot_glyph_font_kit_variations_tests); + hb_test_add (test_hb_glyph_empty); + hb_test_add (test_hb_glyph_glyf); + hb_test_add (test_hb_glyph_cff1); + hb_test_add (test_hb_glyph_cff1_rline); + hb_test_add (test_hb_glyph_cff2); + hb_test_add (test_hb_glyph_ttf_parser_tests); + hb_test_add (test_hb_glyph_font_kit_glyphs_tests); + hb_test_add (test_hb_glyph_font_kit_variations_tests); unsigned result = hb_test_run (); - hb_ot_glyph_decompose_funcs_destroy (funcs); + hb_outline_decompose_funcs_destroy (funcs); return result; }