diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-08-13 23:15:00 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-10-31 19:52:36 -0400 |
commit | a582dbbb60da8aff7574d576cc636799e89c72d8 (patch) | |
tree | 9091d5652eafbf00bd15a8cd62d3027a9880740f /pango/pangofc-fontmap.c | |
parent | 40a805478dfa8988315fd8b7f8515af65c3f90c7 (diff) | |
download | pango-a582dbbb60da8aff7574d576cc636799e89c72d8.tar.gz |
Add pango_font_get_face
Since we've run out of slots in PangoFontClass,
this is implemented with a vfunc in PangoFontMapClass.
Diffstat (limited to 'pango/pangofc-fontmap.c')
-rw-r--r-- | pango/pangofc-fontmap.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index dd066cd3..03d508dd 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -228,6 +228,9 @@ static PangoFont *pango_fc_font_map_new_font (PangoFcFontMap *fontmap, PangoFcFontsetKey *fontset_key, FcPattern *match); +static PangoFontFace *pango_fc_font_map_get_face (PangoFontMap *fontmap, + PangoFont *font); + static guint pango_fc_font_face_data_hash (PangoFcFontFaceData *key); static gboolean pango_fc_font_face_data_equal (PangoFcFontFaceData *key1, PangoFcFontFaceData *key2); @@ -1193,6 +1196,7 @@ pango_fc_font_map_class_init (PangoFcFontMapClass *class) fontmap_class->load_fontset = pango_fc_font_map_load_fontset; fontmap_class->list_families = pango_fc_font_map_list_families; fontmap_class->get_family = pango_fc_font_map_get_family; + fontmap_class->get_face = pango_fc_font_map_get_face; fontmap_class->shape_engine_type = PANGO_RENDER_TYPE_FC; } @@ -1709,6 +1713,26 @@ pango_fc_font_map_new_font (PangoFcFontMap *fcfontmap, return (PangoFont *)fcfont; } +static PangoFontFace * +pango_fc_font_map_get_face (PangoFontMap *fontmap, + PangoFont *font) +{ + PangoFcFont *fcfont = PANGO_FC_FONT (font); + FcResult res; + const char *s; + PangoFontFamily *family; + + res = FcPatternGetString (fcfont->font_pattern, FC_FAMILY, 0, (FcChar8 **) &s); + g_assert (res == FcResultMatch); + + family = pango_font_map_get_family (fontmap, s); + + res = FcPatternGetString (fcfont->font_pattern, FC_STYLE, 0, (FcChar8 **)(void*)&s); + g_assert (res == FcResultMatch); + + return pango_font_family_get_face (family, s); +} + static void pango_fc_default_substitute (PangoFcFontMap *fontmap, PangoFcFontsetKey *fontsetkey, |