summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2013-02-26 10:46:28 +0100
committerAlexander Larsson <alexl@redhat.com>2013-02-26 10:49:55 +0100
commitc5f43d1869373d9e05588c9a13841b5416583e29 (patch)
treeda3b0a3e3066178abd7d7534d34a82f46dcd35c5 /pango
parent6de9b3b340e30856daefc418dc59545afbe62bf0 (diff)
downloadpango-c5f43d1869373d9e05588c9a13841b5416583e29.tar.gz
Add pango_font_map_changed()
This is needed as a base class sometimes needs to invalidate the fontmap. https://bugzilla.gnome.org/show_bug.cgi?id=694626
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-fontmap.c23
-rw-r--r--pango/pango-fontmap.h3
-rw-r--r--pango/pangocairo-coretextfontmap.c11
-rw-r--r--pango/pangocairo-fcfontmap.c11
-rw-r--r--pango/pangocairo-win32fontmap.c11
-rw-r--r--pango/pangocoretext-fontmap.c11
-rw-r--r--pango/pangoft2-fontmap.c12
-rw-r--r--pango/pangoxft-fontmap.c12
8 files changed, 93 insertions, 1 deletions
diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c
index e1d6bb0f..83a0c75a 100644
--- a/pango/pango-fontmap.c
+++ b/pango/pango-fontmap.c
@@ -314,3 +314,26 @@ pango_font_map_get_serial (PangoFontMap *fontmap)
else
return 1;
}
+
+/**
+ * pango_font_map_changed:
+ * @fontmap: a #PangoFontMap
+ *
+ * Forces a change in the context, which will cause any #PangoContext
+ * using this fontmap to change.
+ *
+ * This function is only useful when implementing a new backend
+ * for Pango, something applications won't do. Backends should
+ * call this function if they have attached extra data to the context
+ * and such data is changed.
+ *
+ * Since: 1.34.0
+ **/
+void
+pango_font_map_changed (PangoFontMap *fontmap)
+{
+ g_return_if_fail (PANGO_IS_FONT_MAP (fontmap));
+
+ if (PANGO_FONT_MAP_GET_CLASS (fontmap)->changed)
+ return PANGO_FONT_MAP_GET_CLASS (fontmap)->changed (fontmap);
+}
diff --git a/pango/pango-fontmap.h b/pango/pango-fontmap.h
index d5ba166e..9f31801c 100644
--- a/pango/pango-fontmap.h
+++ b/pango/pango-fontmap.h
@@ -46,6 +46,7 @@ void pango_font_map_list_families (PangoFontMap *fontma
PangoFontFamily ***families,
int *n_families);
guint pango_font_map_get_serial (PangoFontMap *fontmap);
+void pango_font_map_changed (PangoFontMap *fontmap);
#ifdef PANGO_ENABLE_BACKEND
@@ -80,13 +81,13 @@ struct _PangoFontMapClass
const char *shape_engine_type;
guint (*get_serial) (PangoFontMap *fontmap);
+ void (*changed) (PangoFontMap *fontmap);
/*< private >*/
/* Padding for future expansion */
void (*_pango_reserved1) (void);
void (*_pango_reserved2) (void);
- void (*_pango_reserved3) (void);
};
const char *pango_font_map_get_shape_engine_type (PangoFontMap *fontmap);
diff --git a/pango/pangocairo-coretextfontmap.c b/pango/pangocairo-coretextfontmap.c
index 5561358b..ba5dcec0 100644
--- a/pango/pangocairo-coretextfontmap.c
+++ b/pango/pangocairo-coretextfontmap.c
@@ -43,6 +43,16 @@ pango_cairo_core_text_font_map_get_serial (PangoFontMap *fontmap)
}
static void
+pango_cairo_core_text_font_map_changed (PangoFontMap *fontmap)
+{
+ PangoCairoCoreTextFontMap *cafontmap = PANGO_CAIRO_CORE_TEXT_FONT_MAP (fontmap);
+
+ cafontmap->serial++;
+ if (cafontmap->serial == 0)
+ cafontmap->serial++;
+}
+
+static void
pango_cairo_core_text_font_map_set_resolution (PangoCairoFontMap *cfontmap,
double dpi)
{
@@ -161,6 +171,7 @@ pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class
object_class->finalize = pango_cairo_core_text_font_map_finalize;
fontmap_class->get_serial = pango_cairo_core_text_font_map_get_serial;
+ fontmap_class->changed = pango_cairo_core_text_font_map_changed;
ctfontmapclass->get_resolution = pango_cairo_core_text_font_map_get_resolution_core_text;
ctfontmapclass->create_font = pango_cairo_core_text_font_map_create_font;
diff --git a/pango/pangocairo-fcfontmap.c b/pango/pangocairo-fcfontmap.c
index 69fe4929..f7b337d5 100644
--- a/pango/pangocairo-fcfontmap.c
+++ b/pango/pangocairo-fcfontmap.c
@@ -42,6 +42,16 @@ pango_cairo_fc_font_map_get_serial (PangoFontMap *fontmap)
}
static void
+pango_cairo_fc_font_map_changed (PangoFontMap *fontmap)
+{
+ PangoCairoFcFontMap *cffontmap = (PangoCairoFcFontMap *) (fontmap);
+
+ cffontmap->serial++;
+ if (cffontmap->serial == 0)
+ cffontmap->serial++;
+}
+
+static void
pango_cairo_fc_font_map_set_resolution (PangoCairoFontMap *cfontmap,
double dpi)
{
@@ -182,6 +192,7 @@ pango_cairo_fc_font_map_class_init (PangoCairoFcFontMapClass *class)
gobject_class->finalize = pango_cairo_fc_font_map_finalize;
fontmap_class->get_serial = pango_cairo_fc_font_map_get_serial;
+ fontmap_class->changed = pango_cairo_fc_font_map_changed;
fcfontmap_class->fontset_key_substitute = pango_cairo_fc_font_map_fontset_key_substitute;
fcfontmap_class->get_resolution = pango_cairo_fc_font_map_get_resolution_fc;
diff --git a/pango/pangocairo-win32fontmap.c b/pango/pangocairo-win32fontmap.c
index cd4e12ee..d64e9a99 100644
--- a/pango/pangocairo-win32fontmap.c
+++ b/pango/pangocairo-win32fontmap.c
@@ -42,6 +42,16 @@ pango_cairo_win32_font_map_get_serial (PangoFontMap *fontmap)
}
static void
+pango_cairo_win32_font_map_changed (PangoFontMap *fontmap)
+{
+ PangoCairoWin32FontMap *cwfontmap = PANGO_CAIRO_WIN32_FONT_MAP (fontmap);
+
+ cwfontmap->serial++;
+ if (cwfontmap->serial == 0)
+ cwfontmap->serial++;
+}
+
+static void
pango_cairo_win32_font_map_set_resolution (PangoCairoFontMap *cfontmap,
double dpi)
{
@@ -105,6 +115,7 @@ pango_cairo_win32_font_map_class_init (PangoCairoWin32FontMapClass *class)
gobject_class->finalize = pango_cairo_win32_font_map_finalize;
fontmap_class->get_serial = pango_cairo_win32_font_map_get_serial;
+ fontmap_class->changed = pango_cairo_win32_font_map_changed;
win32fontmap_class->find_font = pango_cairo_win32_font_map_find_font;
}
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index 7993d59e..bcbb1734 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -1199,6 +1199,16 @@ pango_core_text_font_map_get_serial (PangoFontMap *fontmap)
return ctfontmap->serial;
}
+static void
+pango_core_text_font_map_changed (PangoFontMap *fontmap)
+{
+ PangoCoreTextFontMap *ctfontmap = PANGO_CORE_TEXT_FONT_MAP (fontmap);
+
+ ctfontmap->serial++;
+ if (ctfontmap->serial == 0)
+ ctfontmap->serial++;
+}
+
static PangoFont *
pango_core_text_font_map_load_font (PangoFontMap *fontmap,
PangoContext *context,
@@ -1471,6 +1481,7 @@ pango_core_text_font_map_class_init (PangoCoreTextFontMapClass *class)
fontmap_class->load_fontset = pango_core_text_font_map_load_fontset;
fontmap_class->shape_engine_type = PANGO_RENDER_TYPE_CORE_TEXT;
fontmap_class->get_serial = pango_core_text_font_map_get_serial;
+ fontmap_class->changed = pango_core_text_font_map_changed;
}
/*
diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c
index 46808889..aed5a234 100644
--- a/pango/pangoft2-fontmap.c
+++ b/pango/pangoft2-fontmap.c
@@ -68,6 +68,7 @@ static PangoFcFont * pango_ft2_font_map_new_font (PangoFcFontMap
static double pango_ft2_font_map_get_resolution (PangoFcFontMap *fcfontmap,
PangoContext *context);
static guint pango_ft2_font_map_get_serial (PangoFontMap *fontmap);
+static void pango_ft2_font_map_changed (PangoFontMap *fontmap);
static PangoFT2FontMap *pango_ft2_global_fontmap = NULL; /* MT-safe */
@@ -82,6 +83,7 @@ pango_ft2_font_map_class_init (PangoFT2FontMapClass *class)
gobject_class->finalize = pango_ft2_font_map_finalize;
fontmap_class->get_serial = pango_ft2_font_map_get_serial;
+ fontmap_class->changed = pango_ft2_font_map_changed;
fcfontmap_class->default_substitute = _pango_ft2_font_map_default_substitute;
fcfontmap_class->new_font = pango_ft2_font_map_new_font;
fcfontmap_class->get_resolution = pango_ft2_font_map_get_resolution;
@@ -154,6 +156,16 @@ pango_ft2_font_map_get_serial (PangoFontMap *fontmap)
return ft2fontmap->serial;
}
+static void
+pango_ft2_font_map_changed (PangoFontMap *fontmap)
+{
+ PangoFT2FontMap *ft2fontmap = PANGO_FT2_FONT_MAP (fontmap);
+
+ ft2fontmap->serial++;
+ if (ft2fontmap->serial == 0)
+ ft2fontmap->serial++;
+}
+
/**
* pango_ft2_font_map_set_default_substitute:
* @fontmap: a #PangoFT2FontMap
diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c
index 803dc186..4976890c 100644
--- a/pango/pangoxft-fontmap.c
+++ b/pango/pangoxft-fontmap.c
@@ -62,6 +62,7 @@ struct _PangoXftFontMapClass
};
static guint pango_xft_font_map_get_serial (PangoFontMap *fontmap);
+static void pango_xft_font_map_changed (PangoFontMap *fontmap);
static void pango_xft_font_map_default_substitute (PangoFcFontMap *fcfontmap,
FcPattern *pattern);
static PangoFcFont * pango_xft_font_map_new_font (PangoFcFontMap *fcfontmap,
@@ -83,6 +84,7 @@ pango_xft_font_map_class_init (PangoXftFontMapClass *class)
gobject_class->finalize = pango_xft_font_map_finalize;
fontmap_class->get_serial = pango_xft_font_map_get_serial;
+ fontmap_class->changed = pango_xft_font_map_changed;
fcfontmap_class->default_substitute = pango_xft_font_map_default_substitute;
fcfontmap_class->new_font = pango_xft_font_map_new_font;
@@ -121,6 +123,16 @@ pango_xft_font_map_get_serial (PangoFontMap *fontmap)
return xftfontmap->serial;
}
+static void
+pango_xft_font_map_changed (PangoFontMap *fontmap)
+{
+ PangoXftFontMap *xftfontmap = PANGO_XFT_FONT_MAP (fontmap);
+
+ xftfontmap->serial++;
+ if (xftfontmap->serial == 0)
+ xftfontmap->serial++;
+}
+
static PangoFontMap *
pango_xft_find_font_map (Display *display,
int screen)