Add batch advance width callback function

New API:
+hb_font_funcs_set_glyph_h_advances_func
+hb_font_funcs_set_glyph_v_advances_func
+hb_font_get_glyph_h_advances
+hb_font_get_glyph_h_advances_func_t
+hb_font_get_glyph_v_advances
+hb_font_get_glyph_v_advances_func_t
This commit is contained in:
Behdad Esfahbod 2018-08-06 09:45:17 -07:00
parent 9533364cc3
commit 79e21984b1
5 changed files with 256 additions and 148 deletions

View File

@ -208,10 +208,12 @@ hb_font_funcs_set_glyph_contour_point_func
hb_font_funcs_set_glyph_extents_func hb_font_funcs_set_glyph_extents_func
hb_font_funcs_set_glyph_from_name_func hb_font_funcs_set_glyph_from_name_func
hb_font_funcs_set_glyph_h_advance_func hb_font_funcs_set_glyph_h_advance_func
hb_font_funcs_set_glyph_h_advances_func
hb_font_funcs_set_glyph_h_kerning_func hb_font_funcs_set_glyph_h_kerning_func
hb_font_funcs_set_glyph_h_origin_func hb_font_funcs_set_glyph_h_origin_func
hb_font_funcs_set_glyph_name_func hb_font_funcs_set_glyph_name_func
hb_font_funcs_set_glyph_v_advance_func hb_font_funcs_set_glyph_v_advance_func
hb_font_funcs_set_glyph_v_advances_func
hb_font_funcs_set_glyph_v_kerning_func hb_font_funcs_set_glyph_v_kerning_func
hb_font_funcs_set_glyph_v_origin_func hb_font_funcs_set_glyph_v_origin_func
hb_font_funcs_set_nominal_glyph_func hb_font_funcs_set_nominal_glyph_func
@ -233,6 +235,8 @@ hb_font_get_glyph_from_name
hb_font_get_glyph_from_name_func_t hb_font_get_glyph_from_name_func_t
hb_font_get_glyph_h_advance hb_font_get_glyph_h_advance
hb_font_get_glyph_h_advance_func_t hb_font_get_glyph_h_advance_func_t
hb_font_get_glyph_h_advances
hb_font_get_glyph_h_advances_func_t
hb_font_get_glyph_h_kerning hb_font_get_glyph_h_kerning
hb_font_get_glyph_h_kerning_func_t hb_font_get_glyph_h_kerning_func_t
hb_font_get_glyph_h_origin hb_font_get_glyph_h_origin
@ -245,6 +249,8 @@ hb_font_get_glyph_origin_for_direction
hb_font_get_glyph_origin_func_t hb_font_get_glyph_origin_func_t
hb_font_get_glyph_v_advance hb_font_get_glyph_v_advance
hb_font_get_glyph_v_advance_func_t hb_font_get_glyph_v_advance_func_t
hb_font_get_glyph_v_advances
hb_font_get_glyph_v_advances_func_t
hb_font_get_glyph_v_kerning hb_font_get_glyph_v_kerning
hb_font_get_glyph_v_kerning_func_t hb_font_get_glyph_v_kerning_func_t
hb_font_get_glyph_v_origin hb_font_get_glyph_v_origin

View File

@ -46,6 +46,8 @@
HB_FONT_FUNC_IMPLEMENT (variation_glyph) \ HB_FONT_FUNC_IMPLEMENT (variation_glyph) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \ HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \ HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advances) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_advances) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \ HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_origin) \ HB_FONT_FUNC_IMPLEMENT (glyph_v_origin) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning) \ HB_FONT_FUNC_IMPLEMENT (glyph_h_kerning) \
@ -54,7 +56,6 @@
HB_FONT_FUNC_IMPLEMENT (glyph_contour_point) \ HB_FONT_FUNC_IMPLEMENT (glyph_contour_point) \
HB_FONT_FUNC_IMPLEMENT (glyph_name) \ HB_FONT_FUNC_IMPLEMENT (glyph_name) \
HB_FONT_FUNC_IMPLEMENT (glyph_from_name) \ HB_FONT_FUNC_IMPLEMENT (glyph_from_name) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advances) \
/* ^--- Add new callbacks here */ /* ^--- Add new callbacks here */
struct hb_font_funcs_t struct hb_font_funcs_t
@ -228,18 +229,6 @@ struct hb_font_t
klass->user_data.glyph_h_advance); klass->user_data.glyph_h_advance);
} }
inline void get_glyph_h_advances(unsigned count,
hb_codepoint_t* glyphs,
unsigned glyph_struct_size,
hb_position_t* advances,
unsigned advance_struct_size) {
return klass->get.f.glyph_h_advances (this, user_data,
count,
glyphs, glyph_struct_size,
advances, advance_struct_size,
klass->user_data.glyph_h_advances);
}
inline hb_position_t get_glyph_v_advance (hb_codepoint_t glyph) inline hb_position_t get_glyph_v_advance (hb_codepoint_t glyph)
{ {
return klass->get.f.glyph_v_advance (this, user_data, return klass->get.f.glyph_v_advance (this, user_data,
@ -247,6 +236,32 @@ struct hb_font_t
klass->user_data.glyph_v_advance); klass->user_data.glyph_v_advance);
} }
inline void get_glyph_h_advances (unsigned int count,
hb_codepoint_t *first_glyph,
unsigned int glyph_stride,
hb_position_t *first_advance,
unsigned int advance_stride)
{
return klass->get.f.glyph_h_advances (this, user_data,
count,
first_glyph, glyph_stride,
first_advance, advance_stride,
klass->user_data.glyph_h_advances);
}
inline void get_glyph_v_advances (unsigned int count,
hb_codepoint_t *first_glyph,
unsigned int glyph_stride,
hb_position_t *first_advance,
unsigned int advance_stride)
{
return klass->get.f.glyph_v_advances (this, user_data,
count,
first_glyph, glyph_stride,
first_advance, advance_stride,
klass->user_data.glyph_v_advances);
}
inline hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph, inline hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y) hb_position_t *x, hb_position_t *y)
{ {

View File

@ -29,6 +29,7 @@
#include "hb-private.hh" #include "hb-private.hh"
#include "hb-font-private.hh" #include "hb-font-private.hh"
#include "hb-machinery-private.hh"
/* /*
@ -45,7 +46,7 @@ hb_font_get_font_h_extents_nil (hb_font_t *font HB_UNUSED,
return false; return false;
} }
static hb_bool_t static hb_bool_t
hb_font_get_font_h_extents_parent (hb_font_t *font, hb_font_get_font_h_extents_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_font_extents_t *metrics, hb_font_extents_t *metrics,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
@ -69,7 +70,7 @@ hb_font_get_font_v_extents_nil (hb_font_t *font HB_UNUSED,
return false; return false;
} }
static hb_bool_t static hb_bool_t
hb_font_get_font_v_extents_parent (hb_font_t *font, hb_font_get_font_v_extents_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_font_extents_t *metrics, hb_font_extents_t *metrics,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
@ -94,7 +95,7 @@ hb_font_get_nominal_glyph_nil (hb_font_t *font HB_UNUSED,
return false; return false;
} }
static hb_bool_t static hb_bool_t
hb_font_get_nominal_glyph_parent (hb_font_t *font, hb_font_get_nominal_glyph_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t unicode, hb_codepoint_t unicode,
hb_codepoint_t *glyph, hb_codepoint_t *glyph,
@ -115,7 +116,7 @@ hb_font_get_variation_glyph_nil (hb_font_t *font HB_UNUSED,
return false; return false;
} }
static hb_bool_t static hb_bool_t
hb_font_get_variation_glyph_parent (hb_font_t *font, hb_font_get_variation_glyph_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t unicode, hb_codepoint_t unicode,
hb_codepoint_t variation_selector, hb_codepoint_t variation_selector,
@ -129,13 +130,13 @@ hb_font_get_variation_glyph_parent (hb_font_t *font,
static hb_position_t static hb_position_t
hb_font_get_glyph_h_advance_nil (hb_font_t *font, hb_font_get_glyph_h_advance_nil (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph, hb_codepoint_t glyph HB_UNUSED,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
{ {
return font->x_scale; return font->x_scale;
} }
static hb_position_t static hb_position_t
hb_font_get_glyph_h_advance_parent (hb_font_t *font, hb_font_get_glyph_h_advance_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph, hb_codepoint_t glyph,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
@ -143,54 +144,17 @@ hb_font_get_glyph_h_advance_parent (hb_font_t *font,
return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph)); return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph));
} }
template <class T>
T* advance_by_byte_size(T* p, unsigned byte_size) {
return reinterpret_cast<T*>(reinterpret_cast<uint8_t*>(p) + byte_size);
}
static void
hb_font_get_glyph_h_advances_nil(hb_font_t *font,
void *font_data HB_UNUSED,
unsigned count,
hb_codepoint_t* glyphs,
unsigned glyph_struct_size,
hb_position_t* advances,
unsigned advance_struct_size,
void *user_data HB_UNUSED) {
for (; count--;
glyphs = advance_by_byte_size(glyphs, glyph_struct_size),
advances = advance_by_byte_size(advances, advance_struct_size)) {
*advances = hb_font_get_glyph_h_advance_nil(font, font_data, *glyphs, user_data);
}
}
static void
hb_font_get_glyph_h_advances_parent(hb_font_t* font,
void* font_data HB_UNUSED,
unsigned count,
hb_codepoint_t* glyphs,
unsigned glyph_struct_size,
hb_position_t* advances,
unsigned advance_struct_size,
void* user_data HB_UNUSED) {
for (; count--;
glyphs = advance_by_byte_size(glyphs, glyph_struct_size),
advances = advance_by_byte_size(advances, advance_struct_size)) {
*advances = hb_font_get_glyph_h_advance_parent(font, font_data, *glyphs, user_data);
}
}
static hb_position_t static hb_position_t
hb_font_get_glyph_v_advance_nil (hb_font_t *font, hb_font_get_glyph_v_advance_nil (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph, hb_codepoint_t glyph HB_UNUSED,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
{ {
/* TODO use font_extents.ascender+descender */ /* TODO use font_extents.ascender+descender */
return font->y_scale; return font->y_scale;
} }
static hb_position_t static hb_position_t
hb_font_get_glyph_v_advance_parent (hb_font_t *font, hb_font_get_glyph_v_advance_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph, hb_codepoint_t glyph,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
@ -198,6 +162,102 @@ hb_font_get_glyph_v_advance_parent (hb_font_t *font,
return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph)); return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph));
} }
static void
hb_font_get_glyph_h_advances_nil (hb_font_t* font,
void* font_data HB_UNUSED,
unsigned int count,
hb_codepoint_t *first_glyph HB_UNUSED,
unsigned int glyph_stride HB_UNUSED,
hb_position_t *first_advance,
unsigned int advance_stride,
void *user_data HB_UNUSED)
{
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->get_glyph_h_advance (*first_glyph);
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
}
}
static void
hb_font_get_glyph_h_advances_default (hb_font_t* font,
void* font_data HB_UNUSED,
unsigned int count,
hb_codepoint_t *first_glyph,
unsigned int glyph_stride,
hb_position_t *first_advance,
unsigned int advance_stride,
void *user_data HB_UNUSED)
{
if (font->has_glyph_h_advance_func ())
{
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->get_glyph_h_advance (*first_glyph);
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
}
return;
}
font->parent->get_glyph_h_advances (count,
first_glyph, glyph_stride,
first_advance, advance_stride);
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->parent_scale_x_distance (*first_advance);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
}
}
static void
hb_font_get_glyph_v_advances_nil (hb_font_t* font,
void* font_data HB_UNUSED,
unsigned int count,
hb_codepoint_t *first_glyph HB_UNUSED,
unsigned int glyph_stride HB_UNUSED,
hb_position_t *first_advance,
unsigned int advance_stride,
void *user_data HB_UNUSED)
{
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->get_glyph_v_advance (*first_glyph);
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
}
}
static void
hb_font_get_glyph_v_advances_default (hb_font_t* font,
void* font_data HB_UNUSED,
unsigned int count,
hb_codepoint_t *first_glyph,
unsigned int glyph_stride,
hb_position_t *first_advance,
unsigned int advance_stride,
void *user_data HB_UNUSED)
{
if (font->has_glyph_v_advance_func ())
{
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->get_glyph_v_advance (*first_glyph);
first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
}
return;
}
font->parent->get_glyph_v_advances (count,
first_glyph, glyph_stride,
first_advance, advance_stride);
for (unsigned int i = 0; i < count; i++)
{
*first_advance = font->parent_scale_y_distance (*first_advance);
first_advance = &StructAtOffset<hb_position_t> (first_advance, advance_stride);
}
}
static hb_bool_t static hb_bool_t
hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED, hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
@ -210,7 +270,7 @@ hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
return true; return true;
} }
static hb_bool_t static hb_bool_t
hb_font_get_glyph_h_origin_parent (hb_font_t *font, hb_font_get_glyph_h_origin_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph, hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *x,
@ -235,7 +295,7 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
return false; return false;
} }
static hb_bool_t static hb_bool_t
hb_font_get_glyph_v_origin_parent (hb_font_t *font, hb_font_get_glyph_v_origin_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph, hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *x,
@ -258,7 +318,7 @@ hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
return 0; return 0;
} }
static hb_position_t static hb_position_t
hb_font_get_glyph_h_kerning_parent (hb_font_t *font, hb_font_get_glyph_h_kerning_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t left_glyph, hb_codepoint_t left_glyph,
hb_codepoint_t right_glyph, hb_codepoint_t right_glyph,
@ -277,7 +337,7 @@ hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
return 0; return 0;
} }
static hb_position_t static hb_position_t
hb_font_get_glyph_v_kerning_parent (hb_font_t *font, hb_font_get_glyph_v_kerning_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t top_glyph, hb_codepoint_t top_glyph,
hb_codepoint_t bottom_glyph, hb_codepoint_t bottom_glyph,
@ -297,7 +357,7 @@ hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
return false; return false;
} }
static hb_bool_t static hb_bool_t
hb_font_get_glyph_extents_parent (hb_font_t *font, hb_font_get_glyph_extents_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph, hb_codepoint_t glyph,
hb_glyph_extents_t *extents, hb_glyph_extents_t *extents,
@ -324,7 +384,7 @@ hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
return false; return false;
} }
static hb_bool_t static hb_bool_t
hb_font_get_glyph_contour_point_parent (hb_font_t *font, hb_font_get_glyph_contour_point_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph, hb_codepoint_t glyph,
unsigned int point_index, unsigned int point_index,
@ -349,7 +409,7 @@ hb_font_get_glyph_name_nil (hb_font_t *font HB_UNUSED,
return false; return false;
} }
static hb_bool_t static hb_bool_t
hb_font_get_glyph_name_parent (hb_font_t *font, hb_font_get_glyph_name_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t glyph, hb_codepoint_t glyph,
char *name, unsigned int size, char *name, unsigned int size,
@ -369,7 +429,7 @@ hb_font_get_glyph_from_name_nil (hb_font_t *font HB_UNUSED,
return false; return false;
} }
static hb_bool_t static hb_bool_t
hb_font_get_glyph_from_name_parent (hb_font_t *font, hb_font_get_glyph_from_name_default (hb_font_t *font,
void *font_data HB_UNUSED, void *font_data HB_UNUSED,
const char *name, int len, /* -1 means nul-terminated */ const char *name, int len, /* -1 means nul-terminated */
hb_codepoint_t *glyph, hb_codepoint_t *glyph,
@ -403,7 +463,7 @@ DEFINE_NULL_INSTANCE (hb_font_funcs_t) =
} }
}; };
static const hb_font_funcs_t _hb_font_funcs_parent = { static const hb_font_funcs_t _hb_font_funcs_default = {
HB_OBJECT_HEADER_STATIC, HB_OBJECT_HEADER_STATIC,
true, /* immutable */ true, /* immutable */
@ -420,7 +480,7 @@ static const hb_font_funcs_t _hb_font_funcs_parent = {
}, },
{ {
{ {
#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_parent, #define HB_FONT_FUNC_IMPLEMENT(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
} }
@ -445,7 +505,7 @@ hb_font_funcs_create (void)
if (!(ffuncs = hb_object_create<hb_font_funcs_t> ())) if (!(ffuncs = hb_object_create<hb_font_funcs_t> ()))
return hb_font_funcs_get_empty (); return hb_font_funcs_get_empty ();
ffuncs->get = _hb_font_funcs_parent.get; ffuncs->get = _hb_font_funcs_default.get;
return ffuncs; return ffuncs;
} }
@ -462,7 +522,7 @@ hb_font_funcs_create (void)
hb_font_funcs_t * hb_font_funcs_t *
hb_font_funcs_get_empty (void) hb_font_funcs_get_empty (void)
{ {
return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_parent); return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_default);
} }
/** /**
@ -601,7 +661,7 @@ hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
ffuncs->user_data.name = user_data; \ ffuncs->user_data.name = user_data; \
ffuncs->destroy.name = destroy; \ ffuncs->destroy.name = destroy; \
} else { \ } else { \
ffuncs->get.f.name = hb_font_get_##name##_parent; \ ffuncs->get.f.name = hb_font_get_##name##_default; \
ffuncs->user_data.name = nullptr; \ ffuncs->user_data.name = nullptr; \
ffuncs->destroy.name = nullptr; \ ffuncs->destroy.name = nullptr; \
} \ } \
@ -613,9 +673,8 @@ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
bool bool
hb_font_t::has_func (unsigned int i) hb_font_t::has_func (unsigned int i)
{ {
if (parent && parent != hb_font_get_empty () && parent->has_func (i)) return (this->klass->get.array[i] != _hb_font_funcs_default.get.array[i]) ||
return true; (parent && parent != &_hb_Null_hb_font_t && parent->has_func (i));
return this->klass->get.array[i] != _hb_font_funcs_parent.get.array[i];
} }
/* Public getters */ /* Public getters */

View File

@ -132,15 +132,15 @@ typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void
typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t; typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t;
typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t; typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;
typedef void (*hb_font_get_glyph_h_advances_func_t)( typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data,
hb_font_t* font,
void* font_data,
unsigned count, unsigned count,
hb_codepoint_t* glyphs, hb_codepoint_t *first_glyph,
unsigned glyph_struct_size, unsigned glyph_stride,
hb_position_t* advances, hb_position_t *first_advance,
unsigned advance_struct_size, unsigned advance_stride,
void *user_data); void *user_data);
typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_h_advances_func_t;
typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_v_advances_func_t;
typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data, typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data,
hb_codepoint_t glyph, hb_codepoint_t glyph,
@ -258,11 +258,6 @@ hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_h_advance_func_t func, hb_font_get_glyph_h_advance_func_t func,
void *user_data, hb_destroy_func_t destroy); void *user_data, hb_destroy_func_t destroy);
HB_EXTERN void
hb_font_funcs_set_glyph_h_advances_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_h_advances_func_t func,
void *user_data, hb_destroy_func_t destroy);
/** /**
* hb_font_funcs_set_glyph_v_advance_func: * hb_font_funcs_set_glyph_v_advance_func:
* @ffuncs: font functions. * @ffuncs: font functions.
@ -279,6 +274,38 @@ hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_v_advance_func_t func, hb_font_get_glyph_v_advance_func_t func,
void *user_data, hb_destroy_func_t destroy); void *user_data, hb_destroy_func_t destroy);
/**
* hb_font_funcs_set_glyph_h_advances_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: REPLACEME
**/
HB_EXTERN void
hb_font_funcs_set_glyph_h_advances_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_h_advances_func_t func,
void *user_data, hb_destroy_func_t destroy);
/**
* hb_font_funcs_set_glyph_v_advances_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: REPLACEME
**/
HB_EXTERN void
hb_font_funcs_set_glyph_v_advances_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_v_advances_func_t func,
void *user_data, hb_destroy_func_t destroy);
/** /**
* hb_font_funcs_set_glyph_h_origin_func: * hb_font_funcs_set_glyph_h_origin_func:
* @ffuncs: font functions. * @ffuncs: font functions.

View File

@ -691,9 +691,10 @@ hb_ot_position_default (hb_ot_shape_context_t *c)
} }
else else
{ {
c->font->get_glyph_v_advances (count, &info[0].codepoint, sizeof(info[0]),
&pos[0].y_advance, sizeof(pos[0]));
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
pos[i].y_advance = c->font->get_glyph_v_advance (info[i].codepoint);
c->font->subtract_glyph_v_origin (info[i].codepoint, c->font->subtract_glyph_v_origin (info[i].codepoint,
&pos[i].x_offset, &pos[i].x_offset,
&pos[i].y_offset); &pos[i].y_offset);