summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-11-28 21:47:51 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-11-28 21:47:51 +0000
commit5af98dbc8a917665e8b2e7937d8f015cb67f3478 (patch)
treec2db1a6cc22c1efeeeec3502449d628be892da0a /pango
parent730324111fd91f6778a8da8cacb3fe4b2eab64c7 (diff)
downloadpango-5af98dbc8a917665e8b2e7937d8f015cb67f3478.tar.gz
Revert two of the cast changes from last commit, to make sure the
2006-11-28 Behdad Esfahbod <behdad@gnome.org> * pango/pangocairo-font.c (_pango_cairo_font_install), (_pango_cairo_font_get_font_face), (_pango_cairo_font_get_scaled_font): * pango/pangocairo-private.h: * pango/pangocairo-render.c (pango_cairo_renderer_draw_glyphs): Revert two of the cast changes from last commit, to make sure the test-pangocairo-fontmap-mismatch test doesn't crash.
Diffstat (limited to 'pango')
-rw-r--r--pango/pangocairo-font.c15
-rw-r--r--pango/pangocairo-private.h1
-rw-r--r--pango/pangocairo-render.c2
3 files changed, 14 insertions, 4 deletions
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 34b2b639..b72b6e2d 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -72,7 +72,7 @@ gboolean
_pango_cairo_font_install (PangoCairoFont *font,
cairo_t *cr)
{
- if (G_UNLIKELY (!font))
+ if (G_UNLIKELY (!PANGO_IS_CAIRO_FONT (font)))
{
if (!_pango_cairo_warning_history.font_install)
{
@@ -89,7 +89,8 @@ _pango_cairo_font_install (PangoCairoFont *font,
cairo_font_face_t *
_pango_cairo_font_get_font_face (PangoCairoFont *font)
{
- g_return_val_if_fail (font, NULL);
+ g_return_val_if_fail (PANGO_IS_CAIRO_FONT (font), NULL);
+ /* this function will be removed. don't bother with warning history here */
return (* PANGO_CAIRO_FONT_GET_IFACE (font)->get_font_face) (font);
}
@@ -97,7 +98,15 @@ _pango_cairo_font_get_font_face (PangoCairoFont *font)
cairo_scaled_font_t *
_pango_cairo_font_get_scaled_font (PangoCairoFont *font)
{
- g_return_val_if_fail (font, NULL);
+ if (G_UNLIKELY (!PANGO_IS_CAIRO_FONT (font)))
+ {
+ if (!_pango_cairo_warning_history.font_get_scaled_font)
+ {
+ _pango_cairo_warning_history.font_get_scaled_font = TRUE;
+ g_warning ("_pango_cairo_font_get_scaled_font called with bad font, expect ugly output");
+ }
+ return NULL;
+ }
return (* PANGO_CAIRO_FONT_GET_IFACE (font)->get_scaled_font) (font);
}
diff --git a/pango/pangocairo-private.h b/pango/pangocairo-private.h
index 104bac29..7ccd1857 100644
--- a/pango/pangocairo-private.h
+++ b/pango/pangocairo-private.h
@@ -108,6 +108,7 @@ typedef struct _PangoCairoWarningHistory PangoCairoWarningHistory;
struct _PangoCairoWarningHistory {
guint font_install : 1;
+ guint font_get_scaled_font : 1;
};
extern PangoCairoWarningHistory _pango_cairo_warning_history;
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 26be779c..45ff427e 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -177,7 +177,7 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer,
if (!crenderer->do_path)
set_color (crenderer, PANGO_RENDER_PART_FOREGROUND);
- if (!_pango_cairo_font_install (PANGO_CAIRO_FONT (font), crenderer->cr))
+ if (!_pango_cairo_font_install ((PangoCairoFont *) (font), crenderer->cr))
{
for (i = 0; i < glyphs->num_glyphs; i++)
{