summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--pango/pangocairo-fcfont.c9
-rw-r--r--pango/pangocairo-private.h2
-rw-r--r--pango/pangocairo-render.c32
4 files changed, 39 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 6ad37bd9..d3495b54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2005-12-05 Behdad Esfahbod <behdad@gnome.org>
+ * pango/pangocairo-fcfont.c, pango/pangocairo-private.h,
+ pango/pangocairo-render.c: Draw an empty dashed box on missing glyphs
+ for cairo-fc backend.
+
+2005-12-05 Behdad Esfahbod <behdad@gnome.org>
+
* pango/mini-fribidi/fribidi.c, pango/mini-fribidi/fribidi_config.h,
pango/mini-fribidi/fribidi.patch: Use new g_slice API for TypeLink
allocation, instead of GMemChunks.
diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c
index 89d6a189..290966ce 100644
--- a/pango/pangocairo-fcfont.c
+++ b/pango/pangocairo-fcfont.c
@@ -38,8 +38,6 @@
#define PANGO_CAIRO_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_CAIRO_FC_FONT))
#define PANGO_CAIRO_FC_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_CAIRO_FC_FONT, PangoCairoFcFontClass))
-#define PANGO_CAIRO_UNKNOWN_FLAG 0x10000000
-
typedef struct _PangoCairoFcFont PangoCairoFcFont;
typedef struct _PangoCairoFcFontClass PangoCairoFcFontClass;
@@ -351,7 +349,7 @@ static PangoGlyph
pango_cairo_fc_font_real_get_unknown_glyph (PangoFcFont *font,
gunichar wc)
{
- return 0;
+ return wc | PANGO_CAIRO_UNKNOWN_FLAG;
}
static void
@@ -364,8 +362,9 @@ pango_cairo_fc_font_glyph_extents_cache_init (PangoCairoFcFont *cffont)
cffont->font_extents.x = 0;
cffont->font_extents.y = - font_extents.ascent * PANGO_SCALE;
- cffont->font_extents.width = 0;
cffont->font_extents.height = (font_extents.ascent + font_extents.descent) * PANGO_SCALE;
+ /* The width is only used for the width of box drawn for glyph-not-found */
+ cffont->font_extents.width = (font_extents.ascent - font_extents.descent) * PANGO_SCALE;
cffont->glyph_extents_cache = g_new0 (GlyphExtentsCacheEntry, GLYPH_CACHE_NUM_ENTRIES);
/* Make sure all cache entries are invalid initially */
@@ -447,7 +446,7 @@ pango_cairo_fc_font_get_glyph_extents (PangoFont *font,
pango_cairo_fc_font_glyph_extents_cache_init (cffont);
- if (glyph == 0)
+ if (glyph & PANGO_CAIRO_UNKNOWN_FLAG)
{
if (ink_rect)
*ink_rect = cffont->font_extents;
diff --git a/pango/pangocairo-private.h b/pango/pangocairo-private.h
index d0caea56..75be37ec 100644
--- a/pango/pangocairo-private.h
+++ b/pango/pangocairo-private.h
@@ -27,6 +27,8 @@
G_BEGIN_DECLS
+#define PANGO_CAIRO_UNKNOWN_FLAG 0x10000000
+
#define PANGO_CAIRO_FONT_MAP_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PANGO_TYPE_CAIRO_FONT_MAP, PangoCairoFontMapIface))
typedef struct _PangoCairoFontMapIface PangoCairoFontMapIface;
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index ea0a800e..16c8054c 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -92,11 +92,33 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer,
if (gi->glyph)
{
- cairo_glyphs[count].index = gi->glyph;
- cairo_glyphs[count].x = crenderer->x_offset + (double)(x + x_position + gi->geometry.x_offset) / PANGO_SCALE;
- cairo_glyphs[count].y = crenderer->y_offset + (double)(y + gi->geometry.y_offset) / PANGO_SCALE;
-
- count++;
+ if (gi->glyph & PANGO_CAIRO_UNKNOWN_FLAG)
+ {
+ int mini_pad = gi->geometry.width / 10;
+ /* draw an empty dashed box, no hexbox for now */
+ cairo_rectangle (crenderer->cr,
+ crenderer->x_offset + (double)(x + x_position + mini_pad) / PANGO_SCALE,
+ crenderer->y_offset + (double)(y - mini_pad) / PANGO_SCALE,
+ (double)(gi->geometry.width - 2 * mini_pad) / PANGO_SCALE,
+ -(double)(gi->geometry.width - 2 * mini_pad) / PANGO_SCALE);
+ if (!crenderer->do_path)
+ {
+ double dash = (double)mini_pad * 2 / PANGO_SCALE;
+ cairo_save (crenderer->cr);
+ cairo_set_line_width (crenderer->cr, (double)mini_pad / PANGO_SCALE);
+ cairo_set_dash (crenderer->cr, &dash, 1, 0);
+ cairo_stroke (crenderer->cr);
+ cairo_restore (crenderer->cr);
+ }
+ }
+ else
+ {
+ cairo_glyphs[count].index = gi->glyph;
+ cairo_glyphs[count].x = crenderer->x_offset + (double)(x + x_position + gi->geometry.x_offset) / PANGO_SCALE;
+ cairo_glyphs[count].y = crenderer->y_offset + (double)(y + gi->geometry.y_offset) / PANGO_SCALE;
+
+ count++;
+ }
}
x_position += gi->geometry.width;