diff options
author | Alexander Larsson <alexl@redhat.com> | 2012-12-05 13:29:48 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2012-12-06 16:36:19 +0100 |
commit | 3f3a095a1809375ef600dc3a947b3ff2df08f22c (patch) | |
tree | 5d7d2cb3ada7f3fe92fb4525eea7907f185165e1 /pango/pangocairo-coretextfontmap.c | |
parent | b359bb484bc7d27a835cfd6d9ffcaed582ebf2ae (diff) | |
download | pango-3f3a095a1809375ef600dc3a947b3ff2df08f22c.tar.gz |
Track changes in FontMaps using a serial
This adds the pango_font_map_get_serial method that lets you see
if a fontmap has changes since the last check. It adds implementations
to all current fontmaps.
https://bugzilla.gnome.org/show_bug.cgi?id=340066
Diffstat (limited to 'pango/pangocairo-coretextfontmap.c')
-rw-r--r-- | pango/pangocairo-coretextfontmap.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pango/pangocairo-coretextfontmap.c b/pango/pangocairo-coretextfontmap.c index cd1f3f25..5561358b 100644 --- a/pango/pangocairo-coretextfontmap.c +++ b/pango/pangocairo-coretextfontmap.c @@ -34,12 +34,23 @@ struct _PangoCairoCoreTextFontMapClass PangoCoreTextFontMapClass parent_class; }; +static guint +pango_cairo_core_text_font_map_get_serial (PangoFontMap *fontmap) +{ + PangoCairoCoreTextFontMap *cafontmap = PANGO_CAIRO_CORE_TEXT_FONT_MAP (fontmap); + + return cafontmap->serial; +} + static void pango_cairo_core_text_font_map_set_resolution (PangoCairoFontMap *cfontmap, double dpi) { PangoCairoCoreTextFontMap *cafontmap = PANGO_CAIRO_CORE_TEXT_FONT_MAP (cfontmap); + cafontmap->serial++; + if (cafontmap->serial == 0) + cafontmap->serial++; cafontmap->dpi = dpi; } @@ -144,10 +155,13 @@ static void pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class) { PangoCoreTextFontMapClass *ctfontmapclass = (PangoCoreTextFontMapClass *)class; + PangoFontMapClass *fontmap_class = PANGO_FONT_MAP_CLASS (class); GObjectClass *object_class = (GObjectClass *)class; object_class->finalize = pango_cairo_core_text_font_map_finalize; + fontmap_class->get_serial = pango_cairo_core_text_font_map_get_serial; + ctfontmapclass->get_resolution = pango_cairo_core_text_font_map_get_resolution_core_text; ctfontmapclass->create_font = pango_cairo_core_text_font_map_create_font; ctfontmapclass->context_key_get = pango_cairo_core_text_font_map_context_key_get; @@ -160,5 +174,6 @@ pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class static void pango_cairo_core_text_font_map_init (PangoCairoCoreTextFontMap *cafontmap) { + cafontmap->serial = 1; cafontmap->dpi = 72.; } |