diff options
author | Caleb Hearon <crh0872@gmail.com> | 2020-06-08 22:22:55 +0000 |
---|---|---|
committer | Caleb Hearon <crh0872@gmail.com> | 2020-06-13 03:29:35 +0000 |
commit | e023cf0d66b323359740c453481507ab91005a34 (patch) | |
tree | 75171773d024713c7103d13c3764223908f7df8b /pango/pangofc-fontmap.c | |
parent | 79baf68b39e7654f8f00c60c8a86ef6054a391dc (diff) | |
download | pango-e023cf0d66b323359740c453481507ab91005a34.tar.gz |
add pango_fc_font_map_set_default_substitute
added:
pango_fc_font_map_set_default_substitute
pango_fc_font_map_default_substitute_changed
deprecated:
pango_ft2_font_map_set_default_substitute
pango_ft2_font_map_changed
pango_xft_font_map_set_default_substitute
pango_xft_font_map_changed
Now PangoCairoFcFontMap will call what is passed to
pango_fc_font_map_set_default_substitute when it is time.
The deprecated functions make calls to the parent (FC) class now.
The user-supplied callbacks are executed in the exact same places as
before.
Diffstat (limited to 'pango/pangofc-fontmap.c')
-rw-r--r-- | pango/pangofc-fontmap.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 8aa27c1e..41da194d 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -1328,6 +1328,9 @@ pango_fc_font_map_finalize (GObject *object) pango_fc_font_map_shutdown (fcfontmap); + if (fcfontmap->substitute_destroy) + fcfontmap->substitute_destroy (fcfontmap->substitute_data); + G_OBJECT_CLASS (pango_fc_font_map_parent_class)->finalize (object); } @@ -1790,6 +1793,28 @@ pango_fc_default_substitute (PangoFcFontMap *fontmap, PANGO_FC_FONT_MAP_GET_CLASS (fontmap)->default_substitute (fontmap, pattern); } +void +pango_fc_font_map_set_default_substitute (PangoFcFontMap *fontmap, + PangoFcSubstituteFunc func, + gpointer data, + GDestroyNotify notify) +{ + if (fontmap->substitute_destroy) + fontmap->substitute_destroy (fontmap->substitute_data); + + fontmap->substitute_func = func; + fontmap->substitute_data = data; + fontmap->substitute_destroy = notify; + + pango_fc_font_map_substitute_changed (fontmap); +} + +void +pango_fc_font_map_substitute_changed (PangoFcFontMap *fontmap) { + pango_fc_font_map_cache_clear(fontmap); + pango_font_map_changed(PANGO_FONT_MAP (fontmap)); +} + static double pango_fc_font_map_get_resolution (PangoFcFontMap *fcfontmap, PangoContext *context) |