diff options
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc')
-rw-r--r-- | Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc | 125 |
1 files changed, 94 insertions, 31 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc index bc831dd53f2..7a430237c73 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc @@ -31,6 +31,8 @@ #include "hb-font.hh" #include "hb-machinery.hh" +#include "hb-ot.h" + /* * hb_font_funcs_t @@ -101,9 +103,42 @@ hb_font_get_nominal_glyph_default (hb_font_t *font, hb_codepoint_t *glyph, void *user_data HB_UNUSED) { + if (font->has_nominal_glyphs_func ()) + { + return font->get_nominal_glyphs (1, &unicode, 0, glyph, 0); + } return font->parent->get_nominal_glyph (unicode, glyph); } +#define hb_font_get_nominal_glyphs_nil hb_font_get_nominal_glyphs_default +static unsigned int +hb_font_get_nominal_glyphs_default (hb_font_t *font, + void *font_data HB_UNUSED, + unsigned int count, + const hb_codepoint_t *first_unicode, + unsigned int unicode_stride, + hb_codepoint_t *first_glyph, + unsigned int glyph_stride, + void *user_data HB_UNUSED) +{ + if (font->has_nominal_glyph_func ()) + { + for (unsigned int i = 0; i < count; i++) + { + if (!font->get_nominal_glyph (*first_unicode, first_glyph)) + return i; + + first_unicode = &StructAtOffset<hb_codepoint_t> (first_unicode, unicode_stride); + first_glyph = &StructAtOffset<hb_codepoint_t> (first_glyph, glyph_stride); + } + return count; + } + + return font->parent->get_nominal_glyphs (count, + first_unicode, unicode_stride, + first_glyph, glyph_stride); +} + static hb_bool_t hb_font_get_variation_glyph_nil (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, @@ -141,6 +176,12 @@ hb_font_get_glyph_h_advance_default (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { + if (font->has_glyph_h_advances_func ()) + { + hb_position_t ret; + font->get_glyph_h_advances (1, &glyph, 0, &ret, 0); + return ret; + } return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph)); } @@ -159,6 +200,12 @@ hb_font_get_glyph_v_advance_default (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { + if (font->has_glyph_v_advances_func ()) + { + hb_position_t ret; + font->get_glyph_v_advances (1, &glyph, 0, &ret, 0); + return ret; + } return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph)); } @@ -167,7 +214,7 @@ 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, + const hb_codepoint_t *first_glyph, unsigned int glyph_stride, hb_position_t *first_advance, unsigned int advance_stride, @@ -199,7 +246,7 @@ 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, + const hb_codepoint_t *first_glyph, unsigned int glyph_stride, hb_position_t *first_advance, unsigned int advance_stride, @@ -586,6 +633,8 @@ hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs) { if (unlikely (hb_object_is_inert (ffuncs))) return; + if (ffuncs->immutable) + return; ffuncs->immutable = true; } @@ -793,8 +842,8 @@ hb_font_get_glyph_v_advance (hb_font_t *font, **/ void hb_font_get_glyph_h_advances (hb_font_t* font, - unsigned count, - hb_codepoint_t *first_glyph, + unsigned int count, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride) @@ -811,8 +860,8 @@ hb_font_get_glyph_h_advances (hb_font_t* font, **/ void hb_font_get_glyph_v_advances (hb_font_t* font, - unsigned count, - hb_codepoint_t *first_glyph, + unsigned int count, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride) @@ -873,6 +922,7 @@ hb_font_get_glyph_v_origin (hb_font_t *font, * Return value: * * Since: 0.9.2 + * Deprecated: 2.0.0 **/ hb_position_t hb_font_get_glyph_h_kerning (hb_font_t *font, @@ -892,6 +942,7 @@ hb_font_get_glyph_h_kerning (hb_font_t *font, * Return value: * * Since: 0.9.2 + * Deprecated: 2.0.0 **/ hb_position_t hb_font_get_glyph_v_kerning (hb_font_t *font, @@ -991,7 +1042,7 @@ hb_font_get_glyph_from_name (hb_font_t *font, * hb_font_get_extents_for_direction: * @font: a font. * @direction: - * @extents: + * @extents: (out): * * * @@ -1036,8 +1087,8 @@ hb_font_get_glyph_advance_for_direction (hb_font_t *font, HB_EXTERN void hb_font_get_glyph_advances_for_direction (hb_font_t* font, hb_direction_t direction, - unsigned count, - hb_codepoint_t *first_glyph, + unsigned int count, + const hb_codepoint_t *first_glyph, unsigned glyph_stride, hb_position_t *first_advance, unsigned advance_stride) @@ -1120,6 +1171,7 @@ hb_font_subtract_glyph_origin_for_direction (hb_font_t *font, * * * Since: 0.9.2 + * Deprecated: 2.0.0 **/ void hb_font_get_glyph_kerning_for_direction (hb_font_t *font, @@ -1254,18 +1306,8 @@ DEFINE_NULL_INSTANCE (hb_font_t) = }; -/** - * hb_font_create: (Xconstructor) - * @face: a face. - * - * - * - * Return value: (transfer full): - * - * Since: 0.9.2 - **/ -hb_font_t * -hb_font_create (hb_face_t *face) +static hb_font_t * +_hb_font_create (hb_face_t *face) { hb_font_t *font; @@ -1285,6 +1327,27 @@ hb_font_create (hb_face_t *face) } /** + * hb_font_create: (Xconstructor) + * @face: a face. + * + * + * + * Return value: (transfer full): + * + * Since: 0.9.2 + **/ +hb_font_t * +hb_font_create (hb_face_t *face) +{ + hb_font_t *font = _hb_font_create (face); + + /* Install our in-house, very lightweight, funcs. */ + hb_ot_font_set_funcs (font); + + return font; +} + +/** * hb_font_create_sub_font: * @parent: parent font. * @@ -1300,7 +1363,7 @@ hb_font_create_sub_font (hb_font_t *parent) if (unlikely (!parent)) parent = hb_font_get_empty (); - hb_font_t *font = hb_font_create (parent->face); + hb_font_t *font = _hb_font_create (parent->face); if (unlikely (hb_object_is_inert (font))) return font; @@ -1444,6 +1507,8 @@ hb_font_make_immutable (hb_font_t *font) { if (unlikely (hb_object_is_inert (font))) return; + if (font->immutable) + return; if (font->parent) hb_font_make_immutable (font->parent); @@ -1703,9 +1768,11 @@ hb_font_get_ppem (hb_font_t *font, /** * hb_font_set_ptem: * @font: a font. - * @ptem: + * @ptem: font size in points. * - * Sets "point size" of the font. + * Sets "point size" of the font. Set to 0 to unset. + * + * There are 72 points in an inch. * * Since: 1.6.0 **/ @@ -1843,8 +1910,6 @@ hb_font_get_var_coords_normalized (hb_font_t *font, } -#ifndef HB_DISABLE_DEPRECATED - /* * Deprecated get_glyph_func(): */ @@ -1931,9 +1996,9 @@ hb_font_get_variation_glyph_trampoline (hb_font_t *font, /** * hb_font_funcs_set_glyph_func: * @ffuncs: font functions. - * @func: (closure user_data) (destroy destroy) (scope notified): - * @user_data: - * @destroy: + * @func: (closure user_data) (destroy destroy) (scope notified): callback function. + * @user_data: data to pass to @func. + * @destroy: function to call when @user_data is not needed anymore. * * Deprecated. Use hb_font_funcs_set_nominal_glyph_func() and * hb_font_funcs_set_variation_glyph_func() instead. @@ -1967,5 +2032,3 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs, trampoline, trampoline_destroy); } - -#endif /* HB_DISABLE_DEPRECATED */ |