Commit 5a0cc9f7 authored by Matthias Clasen's avatar Matthias Clasen

Support variation selectors for shaping

This is necessary to make some emoji sequences shape
and render correctly.
parent 333dc12d
......@@ -98,6 +98,27 @@ pango_fc_hb_font_get_nominal_glyph (hb_font_t *font, void *font_data,
return FALSE;
static hb_bool_t
pango_fc_hb_font_get_variation_glyph (hb_font_t *font,
void *font_data,
hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
hb_codepoint_t *glyph,
void *user_data G_GNUC_UNUSED)
PangoFcHbContext *context = (PangoFcHbContext *) font_data;
FT_Face ft_face = context->ft_face;
unsigned int g;
g = FT_Face_GetCharVariantIndex (ft_face, unicode, variation_selector);
if (G_UNLIKELY (!g))
return FALSE;
*glyph = g;
return TRUE;
static hb_bool_t
pango_fc_hb_font_get_glyph_contour_point (hb_font_t *font, void *font_data,
hb_codepoint_t glyph, unsigned int point_index,
......@@ -246,7 +267,7 @@ pango_fc_get_hb_font_funcs (void)
if (G_UNLIKELY (!funcs)) {
funcs = hb_font_funcs_create ();
hb_font_funcs_set_nominal_glyph_func (funcs, pango_fc_hb_font_get_nominal_glyph, NULL, NULL);
/* XXX we don't support variation selectors yet :(. */
hb_font_funcs_set_variation_glyph_func (funcs, pango_fc_hb_font_get_variation_glyph, NULL, NULL);
hb_font_funcs_set_glyph_h_advance_func (funcs, pango_fc_hb_font_get_glyph_advance, NULL, NULL);
hb_font_funcs_set_glyph_v_advance_func (funcs, pango_fc_hb_font_get_glyph_advance, NULL, NULL);
hb_font_funcs_set_glyph_h_origin_func (funcs, pango_fc_hb_font_get_glyph_h_origin, NULL, NULL);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment