summaryrefslogtreecommitdiff
path: root/pango/pango-fontmap.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2012-12-05 13:29:48 +0100
committerAlexander Larsson <alexl@redhat.com>2012-12-06 16:36:19 +0100
commit3f3a095a1809375ef600dc3a947b3ff2df08f22c (patch)
tree5d7d2cb3ada7f3fe92fb4525eea7907f185165e1 /pango/pango-fontmap.c
parentb359bb484bc7d27a835cfd6d9ffcaed582ebf2ae (diff)
downloadpango-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/pango-fontmap.c')
-rw-r--r--pango/pango-fontmap.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c
index 6e90ada1..e1d6bb0f 100644
--- a/pango/pango-fontmap.c
+++ b/pango/pango-fontmap.c
@@ -284,3 +284,33 @@ pango_font_map_get_shape_engine_type (PangoFontMap *fontmap)
return PANGO_FONT_MAP_GET_CLASS (fontmap)->shape_engine_type;
}
+/**
+ * pango_font_map_get_serial:
+ * @fontmap: a #PangoFontMap
+ *
+ * Returns the current serial number of @fontmap. The serial number is
+ * initialized to an small number larger than zero when a new fontmap
+ * is created and is increased whenever the fontmap is changed. It may
+ * wrap, but will never have the value 0. Since it can wrap, never compare
+ * it with "less than", always use "not equals".
+ *
+ * The fontmap can only be changed using backend-specific API, like changing
+ * fontmap resolution.
+ *
+ * This can be used to automatically detect changes to a #PangoFontMap, like
+ * in #PangoContext.
+ *
+ * Return value: The current serial number of @fontmap.
+ *
+ * Since: 1.32.4
+ **/
+guint
+pango_font_map_get_serial (PangoFontMap *fontmap)
+{
+ g_return_val_if_fail (PANGO_IS_FONT_MAP (fontmap), 0);
+
+ if (PANGO_FONT_MAP_GET_CLASS (fontmap)->get_serial)
+ return PANGO_FONT_MAP_GET_CLASS (fontmap)->get_serial (fontmap);
+ else
+ return 1;
+}