static hb_font_funcs_t* harfBuzzCoreTextGetFontFuncs() { static hb_font_funcs_t* harfBuzzCoreTextFontFuncs = 0; if (!harfBuzzCoreTextFontFuncs) { harfBuzzCoreTextFontFuncs = hb_font_funcs_create(); hb_font_funcs_set_glyph_func(harfBuzzCoreTextFontFuncs, getGlyph, 0, 0); hb_font_funcs_set_glyph_h_advance_func(harfBuzzCoreTextFontFuncs, getGlyphHorizontalAdvance, 0, 0); hb_font_funcs_set_glyph_h_origin_func(harfBuzzCoreTextFontFuncs, getGlyphHorizontalOrigin, 0, 0); hb_font_funcs_set_glyph_extents_func(harfBuzzCoreTextFontFuncs, getGlyphExtents, 0, 0); hb_font_funcs_make_immutable(harfBuzzCoreTextFontFuncs); } return harfBuzzCoreTextFontFuncs; }
static hb_font_funcs_t* harfbuzzSkiaGetFontFuncs() { static hb_font_funcs_t* harfbuzzSkiaFontFuncs = 0; // We don't set callback functions which we can't support. // Harfbuzz will use the fallback implementation if they aren't set. if (!harfbuzzSkiaFontFuncs) { harfbuzzSkiaFontFuncs = hb_font_funcs_create(); hb_font_funcs_set_glyph_func(harfbuzzSkiaFontFuncs, harfbuzzGetGlyph, 0, 0); hb_font_funcs_set_glyph_h_advance_func(harfbuzzSkiaFontFuncs, harfbuzzGetGlyphHorizontalAdvance, 0, 0); hb_font_funcs_set_glyph_h_origin_func(harfbuzzSkiaFontFuncs, harfbuzzGetGlyphHorizontalOrigin, 0, 0); hb_font_funcs_set_glyph_extents_func(harfbuzzSkiaFontFuncs, harfbuzzGetGlyphExtents, 0, 0); hb_font_funcs_make_immutable(harfbuzzSkiaFontFuncs); } return harfbuzzSkiaFontFuncs; }