summaryrefslogtreecommitdiff
path: root/pango/pangocairo-render.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-02-02 10:52:49 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-02-02 10:52:49 +0000
commitda58dbfdea113caa46448c0bb3bf945b4a18f502 (patch)
treebd04c2e6d5d4f74ee5eef9a3dd8a1c2bdaeb5f7e /pango/pangocairo-render.c
parent93be594100f783b409cba98f6c9d58060c4ef433 (diff)
downloadpango-da58dbfdea113caa46448c0bb3bf945b4a18f502.tar.gz
Use PANGO_GLYPH_NULL for when no glyph should be drawn. Use
2006-02-02 Behdad Esfahbod <behdad@gnome.org> * modules/arabic/arabic-fc.c, modules/basic/basic-atsui.c, modules/basic/basic-fc.c, modules/basic/basic-win32.c, modules/basic/basic-x.c, modules/hangul/hangul-fc.c, modules/hebrew/hebrew-fc.c, modules/indic/indic-fc.c, modules/khmer/khmer-fc.c, modules/syriac/syriac-fc.c, modules/thai/thai-fc.c, modules/tibetan/tibetan-fc.c, pango/fonts.c, pango/pango-engine-private.h pango/pango-types.h, pango/pangocairo-fcfont.c, pango/pangocairo-font.c, pango/pangocairo-private.h, pango/pangocairo-render.c, pango/pangofc-decoder.c, pango/pangofc-font.c, pango/pangoft2-render.c, pango/pangoft2.c pango/pangowin32.c, pango/pangox.c, pango/pangoxft-font.c pango/pangoxft-private.h, pango/pangoxft-render.c, pango/shape.c: Use PANGO_GLYPH_NULL for when no glyph should be drawn. Use PANGO_GLYPH_UNKNOWN_FLAG for all backends to mark unknown flags. There's no need for pango_font_get_unknown_glyph() anymore, since all backends know how to handle PANGO_GLYPH_UNKNOWN_FLAG gracefully. We may add that in the future however. (fixes bug #73147, closes bug #329524)
Diffstat (limited to 'pango/pangocairo-render.c')
-rw-r--r--pango/pangocairo-render.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 9d539260..ae2d853e 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -21,6 +21,7 @@
#include <config.h>
+#include "pango-engine-private.h"
#include "pangocairo-private.h"
typedef struct _PangoCairoRendererClass PangoCairoRendererClass;
@@ -74,17 +75,33 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
PangoCairoHexBoxInfo *hbi;
gunichar ch;
+ cairo_save (crenderer->cr);
+ cairo_get_current_point (crenderer->cr, &temp_x, &temp_y);
+
hbi = _pango_cairo_get_hex_box_info ((PangoCairoFont *)font);
+ if (!hbi)
+ {
+ cairo_rectangle (crenderer->cr,
+ cx + 1.5,
+ cy - 1.5,
+ (double)gi->geometry.width / PANGO_SCALE - 3.0,
+ PANGO_UNKNOWN_GLYPH_HEIGHT - 3.0);
+
+ if (!crenderer->do_path)
+ {
+ cairo_set_line_width (crenderer->cr, 1.0);
+ cairo_stroke (crenderer->cr);
+ }
- ch = gi->glyph & ~PANGO_CAIRO_UNKNOWN_FLAG;
+ goto done;
+ }
+
+ ch = gi->glyph & ~PANGO_GLYPH_UNKNOWN_FLAG;
rows = hbi->rows;
cols = (ch > 0xffff ? 6 : 4) / rows;
g_snprintf (buf, sizeof(buf), (ch > 0xffff) ? "%06X" : "%04X", ch);
- cairo_save (crenderer->cr);
- cairo_get_current_point (crenderer->cr, &temp_x, &temp_y);
-
cairo_rectangle (crenderer->cr,
cx + hbi->pad_x * 1.5,
cy + hbi->box_descent - hbi->pad_y * 0.5,
@@ -93,10 +110,8 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
if (!crenderer->do_path)
{
- cairo_save (crenderer->cr);
cairo_set_line_width (crenderer->cr, hbi->line_width);
cairo_stroke (crenderer->cr);
- cairo_restore (crenderer->cr);
}
_pango_cairo_font_install (PANGO_CAIRO_FONT (hbi->font), crenderer->cr);
@@ -122,6 +137,7 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
}
}
+done:
cairo_move_to (crenderer->cr, temp_x, temp_y);
cairo_restore (crenderer->cr);
}
@@ -160,12 +176,12 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer,
{
PangoGlyphInfo *gi = &glyphs->glyphs[i];
- if (gi->glyph)
+ if (gi->glyph != PANGO_GLYPH_NULL)
{
double cx = crenderer->x_offset + (double)(x + x_position + gi->geometry.x_offset) / PANGO_SCALE;
double cy = crenderer->y_offset + (double)(y + gi->geometry.y_offset) / PANGO_SCALE;
- if (gi->glyph & PANGO_CAIRO_UNKNOWN_FLAG)
+ if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
_pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
else
{