[paint] Rename hb_font_get_glyph_paint_func_t

The 'get' was just there due to implementation
choices. Work around that and call the vfunc
what it should be: hb_font_paint_glyph_func_t.
This commit is contained in:
Matthias Clasen 2022-12-19 13:45:45 -05:00 committed by Behdad Esfahbod
parent b0fa40b2ec
commit 0f287e75ec
4 changed files with 61 additions and 61 deletions

View File

@ -514,12 +514,12 @@ hb_font_get_glyph_shape_nil (hb_font_t *font HB_UNUSED,
} }
static void static void
hb_font_get_glyph_paint_nil (hb_font_t *font HB_UNUSED, hb_font_paint_glyph_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph HB_UNUSED, hb_codepoint_t glyph HB_UNUSED,
hb_paint_funcs_t *paint_funcs HB_UNUSED, hb_paint_funcs_t *paint_funcs HB_UNUSED,
void *paint_data HB_UNUSED, void *paint_data HB_UNUSED,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
{ {
} }
@ -650,12 +650,12 @@ hb_font_get_glyph_shape_default (hb_font_t *font,
} }
static void static void
hb_font_get_glyph_paint_default (hb_font_t *font, hb_font_paint_glyph_default (hb_font_t *font,
void *font_data, void *font_data,
hb_codepoint_t glyph, hb_codepoint_t glyph,
hb_paint_funcs_t *paint_funcs, hb_paint_funcs_t *paint_funcs,
void *paint_data, void *paint_data,
void *user_data) void *user_data)
{ {
paint_funcs->push_transform (paint_data, paint_funcs->push_transform (paint_data,
font->parent->x_scale ? (float) font->x_scale / (float) font->parent->x_scale : 0.f, font->parent->x_scale ? (float) font->x_scale / (float) font->parent->x_scale : 0.f,
@ -666,7 +666,7 @@ hb_font_get_glyph_paint_default (hb_font_t *font,
0.f, 0.f,
0.f); 0.f);
font->parent->get_glyph_paint (glyph, paint_funcs, paint_data); font->parent->paint_glyph (glyph, paint_funcs, paint_data);
paint_funcs->pop_transform (paint_data); paint_funcs->pop_transform (paint_data);
} }
@ -679,7 +679,7 @@ DEFINE_NULL_INSTANCE (hb_font_funcs_t) =
nullptr, nullptr,
{ {
{ {
#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil, #define HB_FONT_FUNC_IMPLEMENT(get_,name) hb_font_##get_##name##_nil,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT #undef HB_FONT_FUNC_IMPLEMENT
} }
@ -693,7 +693,7 @@ static const hb_font_funcs_t _hb_font_funcs_default = {
nullptr, nullptr,
{ {
{ {
#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_default, #define HB_FONT_FUNC_IMPLEMENT(get_,name) hb_font_##get_##name##_default,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT #undef HB_FONT_FUNC_IMPLEMENT
} }
@ -771,7 +771,7 @@ hb_font_funcs_destroy (hb_font_funcs_t *ffuncs)
if (ffuncs->destroy) if (ffuncs->destroy)
{ {
#define HB_FONT_FUNC_IMPLEMENT(name) if (ffuncs->destroy->name) \ #define HB_FONT_FUNC_IMPLEMENT(get_,name) if (ffuncs->destroy->name) \
ffuncs->destroy->name (!ffuncs->user_data ? nullptr : ffuncs->user_data->name); ffuncs->destroy->name (!ffuncs->user_data ? nullptr : ffuncs->user_data->name);
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT #undef HB_FONT_FUNC_IMPLEMENT
@ -911,11 +911,11 @@ fail:
return false; return false;
} }
#define HB_FONT_FUNC_IMPLEMENT(name) \ #define HB_FONT_FUNC_IMPLEMENT(get_,name) \
\ \
void \ void \
hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \ hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
hb_font_get_##name##_func_t func, \ hb_font_##get_##name##_func_t func, \
void *user_data, \ void *user_data, \
hb_destroy_func_t destroy) \ hb_destroy_func_t destroy) \
{ \ { \
@ -931,7 +931,7 @@ hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
if (func) \ if (func) \
ffuncs->get.f.name = func; \ ffuncs->get.f.name = func; \
else \ else \
ffuncs->get.f.name = hb_font_get_##name##_default; \ ffuncs->get.f.name = hb_font_##get_##name##_default; \
\ \
if (ffuncs->user_data) \ if (ffuncs->user_data) \
ffuncs->user_data->name = user_data; \ ffuncs->user_data->name = user_data; \
@ -1421,7 +1421,7 @@ hb_font_paint_glyph (hb_font_t *font,
hb_codepoint_t glyph, hb_codepoint_t glyph,
hb_paint_funcs_t *pfuncs, void *paint_data) hb_paint_funcs_t *pfuncs, void *paint_data)
{ {
font->get_glyph_paint (glyph, pfuncs, paint_data); font->paint_glyph (glyph, pfuncs, paint_data);
} }
/* A bit higher-level, and with fallback */ /* A bit higher-level, and with fallback */

View File

@ -513,10 +513,10 @@ typedef void (*hb_font_get_glyph_shape_func_t) (hb_font_t *font, void *font_data
hb_draw_funcs_t *draw_funcs, void *draw_data, hb_draw_funcs_t *draw_funcs, void *draw_data,
void *user_data); void *user_data);
typedef void (*hb_font_get_glyph_paint_func_t) (hb_font_t *font, void *font_data, typedef void (*hb_font_paint_glyph_func_t) (hb_font_t *font, void *font_data,
hb_codepoint_t glyph, hb_codepoint_t glyph,
hb_paint_funcs_t *paint_funcs, void *paint_data, hb_paint_funcs_t *paint_funcs, void *paint_data,
void *user_data); void *user_data);
/* func setters */ /* func setters */
@ -793,19 +793,19 @@ hb_font_funcs_set_glyph_shape_func (hb_font_funcs_t *ffuncs,
void *user_data, hb_destroy_func_t destroy); void *user_data, hb_destroy_func_t destroy);
/** /**
* hb_font_funcs_set_glyph_paint_func: * hb_font_funcs_set_paint_glyph_func:
* @ffuncs: * @ffuncs:
* @func: (closure user_data) (destroy destroy) (scope notified): * @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data: * @user_data:
* @destroy: (nullable): * @destroy: (nullable):
* *
* Sets the implementation function for #hb_font_get_glyph_paint_func_t. * Sets the implementation function for #hb_font_paint_glyph_func_t.
* *
* Since: REPLACEME * Since: REPLACEME
*/ */
HB_EXTERN void HB_EXTERN void
hb_font_funcs_set_glyph_paint_func (hb_font_funcs_t *ffuncs, hb_font_funcs_set_paint_glyph_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_paint_func_t func, hb_font_paint_glyph_func_t func,
void *user_data, hb_destroy_func_t destroy); void *user_data, hb_destroy_func_t destroy);
/* func dispatch */ /* func dispatch */

View File

@ -40,25 +40,25 @@
*/ */
#define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \ #define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \
HB_FONT_FUNC_IMPLEMENT (font_h_extents) \ HB_FONT_FUNC_IMPLEMENT (get_,font_h_extents) \
HB_FONT_FUNC_IMPLEMENT (font_v_extents) \ HB_FONT_FUNC_IMPLEMENT (get_,font_v_extents) \
HB_FONT_FUNC_IMPLEMENT (nominal_glyph) \ HB_FONT_FUNC_IMPLEMENT (get_,nominal_glyph) \
HB_FONT_FUNC_IMPLEMENT (nominal_glyphs) \ HB_FONT_FUNC_IMPLEMENT (get_,nominal_glyphs) \
HB_FONT_FUNC_IMPLEMENT (variation_glyph) \ HB_FONT_FUNC_IMPLEMENT (get_,variation_glyph) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_h_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_v_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advances) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_h_advances) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_advances) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_v_advances) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_h_origin) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_origin) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_v_origin) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_h_kerning) \
HB_IF_NOT_DEPRECATED (HB_FONT_FUNC_IMPLEMENT (glyph_v_kerning)) \ HB_IF_NOT_DEPRECATED (HB_FONT_FUNC_IMPLEMENT (get_,glyph_v_kerning)) \
HB_FONT_FUNC_IMPLEMENT (glyph_extents) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_extents) \
HB_FONT_FUNC_IMPLEMENT (glyph_contour_point) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_contour_point) \
HB_FONT_FUNC_IMPLEMENT (glyph_name) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_name) \
HB_FONT_FUNC_IMPLEMENT (glyph_from_name) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_from_name) \
HB_FONT_FUNC_IMPLEMENT (glyph_shape) \ HB_FONT_FUNC_IMPLEMENT (get_,glyph_shape) \
HB_FONT_FUNC_IMPLEMENT (glyph_paint) \ HB_FONT_FUNC_IMPLEMENT (,paint_glyph) \
/* ^--- Add new callbacks here */ /* ^--- Add new callbacks here */
struct hb_font_funcs_t struct hb_font_funcs_t
@ -66,13 +66,13 @@ struct hb_font_funcs_t
hb_object_header_t header; hb_object_header_t header;
struct { struct {
#define HB_FONT_FUNC_IMPLEMENT(name) void *name; #define HB_FONT_FUNC_IMPLEMENT(get_,name) void *name;
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT #undef HB_FONT_FUNC_IMPLEMENT
} *user_data; } *user_data;
struct { struct {
#define HB_FONT_FUNC_IMPLEMENT(name) hb_destroy_func_t name; #define HB_FONT_FUNC_IMPLEMENT(get_,name) hb_destroy_func_t name;
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT #undef HB_FONT_FUNC_IMPLEMENT
} *destroy; } *destroy;
@ -80,12 +80,12 @@ struct hb_font_funcs_t
/* Don't access these directly. Call font->get_*() instead. */ /* Don't access these directly. Call font->get_*() instead. */
union get_t { union get_t {
struct get_funcs_t { struct get_funcs_t {
#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name; #define HB_FONT_FUNC_IMPLEMENT(get_,name) hb_font_##get_##name##_func_t name;
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT #undef HB_FONT_FUNC_IMPLEMENT
} f; } f;
void (*array[0 void (*array[0
#define HB_FONT_FUNC_IMPLEMENT(name) +1 #define HB_FONT_FUNC_IMPLEMENT(get_,name) +1
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT #undef HB_FONT_FUNC_IMPLEMENT
]) (); ]) ();
@ -199,7 +199,7 @@ struct hb_font_t
HB_INTERNAL bool has_func_set (unsigned int i); HB_INTERNAL bool has_func_set (unsigned int i);
/* has_* ... */ /* has_* ... */
#define HB_FONT_FUNC_IMPLEMENT(name) \ #define HB_FONT_FUNC_IMPLEMENT(get_,name) \
bool \ bool \
has_##name##_func () \ has_##name##_func () \
{ \ { \
@ -402,13 +402,13 @@ struct hb_font_t
!klass->user_data ? nullptr : klass->user_data->glyph_shape); !klass->user_data ? nullptr : klass->user_data->glyph_shape);
} }
void get_glyph_paint (hb_codepoint_t glyph, void paint_glyph (hb_codepoint_t glyph,
hb_paint_funcs_t *paint_funcs, void *paint_data) hb_paint_funcs_t *paint_funcs, void *paint_data)
{ {
klass->get.f.glyph_paint (this, user_data, klass->get.f.paint_glyph (this, user_data,
glyph, glyph,
paint_funcs, paint_data, paint_funcs, paint_data,
!klass->user_data ? nullptr : klass->user_data->glyph_paint); !klass->user_data ? nullptr : klass->user_data->paint_glyph);
} }
/* A bit higher-level, and with fallback */ /* A bit higher-level, and with fallback */

View File

@ -442,11 +442,11 @@ hb_ot_get_glyph_shape (hb_font_t *font,
#ifndef HB_NO_PAINT #ifndef HB_NO_PAINT
static void static void
hb_ot_get_glyph_paint (hb_font_t *font, hb_ot_paint_glyph (hb_font_t *font,
void *font_data, void *font_data,
hb_codepoint_t glyph, hb_codepoint_t glyph,
hb_paint_funcs_t *paint_funcs, void *paint_data, hb_paint_funcs_t *paint_funcs, void *paint_data,
void *user_data) void *user_data)
{ {
#ifndef HB_NO_COLOR #ifndef HB_NO_COLOR
if (font->face->table.COLR->paint_glyph (font, glyph, paint_funcs, paint_data)) return; if (font->face->table.COLR->paint_glyph (font, glyph, paint_funcs, paint_data)) return;
@ -491,7 +491,7 @@ static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot
#endif #endif
#ifndef HB_NO_PAINT #ifndef HB_NO_PAINT
hb_font_funcs_set_glyph_paint_func (funcs, hb_ot_get_glyph_paint, nullptr, nullptr); hb_font_funcs_set_paint_glyph_func (funcs, hb_ot_paint_glyph, nullptr, nullptr);
#endif #endif
hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, nullptr, nullptr); hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, nullptr, nullptr);