summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-05-16 18:00:22 +0000
committerOwen Taylor <otaylor@src.gnome.org>2005-05-16 18:00:22 +0000
commita1d091f8b9fa18792c6d989a5eb7c8bad1c87258 (patch)
tree07faa7897569c0196b7774af26a5fdfdbdfd92b6
parent774df2fe97bc6180fe55659ccff10c349976a022 (diff)
downloadpango-a1d091f8b9fa18792c6d989a5eb7c8bad1c87258.tar.gz
pango/pangocairo-render.c (pango_cairo_renderer_draw_glyphs): Handle glyph
2005-05-16 Owen Taylor <otaylor@redhat.com> * pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_glyph_extents): pango/pangocairo-render.c (pango_cairo_renderer_draw_glyphs): Handle glyph == 0. * modules/indic/indic-ot.h modules/basic/basic-common.h: Treat LINE SEPARATOR as a zero-width character.
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.pre-1-109
-rw-r--r--modules/basic/basic-common.h3
-rw-r--r--modules/indic/indic-ot.h3
-rw-r--r--pango/pangocairo-fcfont.c55
-rw-r--r--pango/pangocairo-render.c18
6 files changed, 70 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index c2a3ad75..e09e9586 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2005-05-16 Owen Taylor <otaylor@redhat.com>
+ * pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_glyph_extents):
+ pango/pangocairo-render.c (pango_cairo_renderer_draw_glyphs):
+ Handle glyph == 0.
+
+ * modules/indic/indic-ot.h modules/basic/basic-common.h:
+ Treat LINE SEPARATOR as a zero-width character.
+
+2005-05-16 Owen Taylor <otaylor@redhat.com>
+
* examples/cairoview.c: Include Xlib.h explicitely before
include Xutil.h, since Xutil.h doesn't include Xlib.h on
some platforms. (#304317, Damien Carbery)
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index c2a3ad75..e09e9586 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,5 +1,14 @@
2005-05-16 Owen Taylor <otaylor@redhat.com>
+ * pango/pangocairo-fcfont.c (pango_cairo_fc_font_get_glyph_extents):
+ pango/pangocairo-render.c (pango_cairo_renderer_draw_glyphs):
+ Handle glyph == 0.
+
+ * modules/indic/indic-ot.h modules/basic/basic-common.h:
+ Treat LINE SEPARATOR as a zero-width character.
+
+2005-05-16 Owen Taylor <otaylor@redhat.com>
+
* examples/cairoview.c: Include Xlib.h explicitely before
include Xutil.h, since Xutil.h doesn't include Xlib.h on
some platforms. (#304317, Damien Carbery)
diff --git a/modules/basic/basic-common.h b/modules/basic/basic-common.h
index 2932e383..8c1d739e 100644
--- a/modules/basic/basic-common.h
+++ b/modules/basic/basic-common.h
@@ -10,6 +10,7 @@ G_BEGIN_DECLS
* 200D ZERO WIDTH JOINER
* 200E LEFT-TO-RIGHT MARK
* 200F RIGHT-TO-LEFT MARK
+ * 2028 LINE SEPARATOR
* 202A LEFT-TO-RIGHT EMBEDDING
* 202B RIGHT-TO-LEFT EMBEDDING
* 202C POP DIRECTIONAL FORMATTING
@@ -19,7 +20,7 @@ G_BEGIN_DECLS
*/
#define ZERO_WIDTH_CHAR(wc)\
-(((wc) >= 0x200B && (wc) <= 0x200F) || ((wc) >= 0x202A && (wc) <= 0x202E) || ((wc) == 0xFEFF))
+(((wc) >= 0x200B && (wc) <= 0x200F) || (wc == 0x2028) || ((wc) >= 0x202A && (wc) <= 0x202E) || ((wc) == 0xFEFF))
G_END_DECLS
diff --git a/modules/indic/indic-ot.h b/modules/indic/indic-ot.h
index d4c37a8b..96b358c4 100644
--- a/modules/indic/indic-ot.h
+++ b/modules/indic/indic-ot.h
@@ -188,6 +188,7 @@ enum indic_glyph_property_
* 200D ZERO WIDTH JOINER
* 200E LEFT-TO-RIGHT MARK
* 200F RIGHT-TO-LEFT MARK
+ * 2028 LINE SEPARATOR
* 202A LEFT-TO-RIGHT EMBEDDING
* 202B RIGHT-TO-LEFT EMBEDDING
* 202C POP DIRECTIONAL FORMATTING
@@ -196,7 +197,7 @@ enum indic_glyph_property_
* FEFF ZERO WIDTH NO-BREAK SPACE
*/
#define ZERO_WIDTH_CHAR(wc) \
- (((wc) >= 0x200B && (wc) <= 0x200F) || ((wc) >= 0x202A && (wc) <= 0x202E) || ((wc) == 0xFEFF))
+ (((wc) >= 0x200B && (wc) <= 0x200F) || (wc == 0x2028) || ((wc) >= 0x202A && (wc) <= 0x202E) || ((wc) == 0xFEFF))
struct _IndicOTClassTable
{
diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c
index f14e8e9a..cde571bf 100644
--- a/pango/pangocairo-fcfont.c
+++ b/pango/pangocairo-fcfont.c
@@ -152,40 +152,57 @@ pango_cairo_fc_font_get_glyph_extents (PangoFont *font,
PangoRectangle *logical_rect)
{
cairo_scaled_font_t *scaled_font;
- cairo_text_extents_t extents;
- cairo_glyph_t cairo_glyph;
scaled_font = pango_cairo_fc_font_get_scaled_font (PANGO_CAIRO_FONT (font));
- cairo_glyph.index = glyph;
- cairo_glyph.x = 0;
- cairo_glyph.y = 0;
-
- cairo_scaled_font_glyph_extents (scaled_font,
- &cairo_glyph, 1, &extents);
-
- if (ink_rect)
- {
- ink_rect->x = extents.x_bearing * PANGO_SCALE;
- ink_rect->y = extents.y_bearing * PANGO_SCALE;
- ink_rect->width = extents.width * PANGO_SCALE;
- ink_rect->height = extents.height * PANGO_SCALE;
- }
-
if (logical_rect)
{
/* It may well be worth caching the font_extents here, since getting them
* is pretty expensive.
*/
cairo_font_extents_t font_extents;
-
+
cairo_scaled_font_extents (scaled_font, &font_extents);
logical_rect->x = 0;
logical_rect->y = - font_extents.ascent * PANGO_SCALE;
- logical_rect->width = extents.x_advance * PANGO_SCALE;
+ logical_rect->width = 0;
logical_rect->height = (font_extents.ascent + font_extents.descent) * PANGO_SCALE;
}
+
+ if (glyph)
+ {
+ cairo_text_extents_t extents;
+ cairo_glyph_t cairo_glyph;
+
+ cairo_glyph.index = glyph;
+ cairo_glyph.x = 0;
+ cairo_glyph.y = 0;
+
+ cairo_scaled_font_glyph_extents (scaled_font,
+ &cairo_glyph, 1, &extents);
+
+ if (ink_rect)
+ {
+ ink_rect->x = extents.x_bearing * PANGO_SCALE;
+ ink_rect->y = extents.y_bearing * PANGO_SCALE;
+ ink_rect->width = extents.width * PANGO_SCALE;
+ ink_rect->height = extents.height * PANGO_SCALE;
+ }
+
+ if (logical_rect)
+ logical_rect->width = extents.x_advance * PANGO_SCALE;
+ }
+ else
+ {
+ if (ink_rect)
+ {
+ ink_rect->x = 0;
+ ink_rect->y = 0;
+ ink_rect->width = 0;
+ ink_rect->height = 0;
+ }
+ }
}
static FT_Face
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 9a1048ce..68ae4981 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -68,7 +68,7 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer,
/* cairo_glyph_t is 24 bytes */
#define MAX_STACK 40
- int i;
+ int i, count;
int x_position = 0;
cairo_glyph_t *cairo_glyphs;
cairo_glyph_t stack_glyphs[MAX_STACK];
@@ -85,23 +85,29 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer,
else
cairo_glyphs = stack_glyphs;
+ count = 0;
for (i = 0; i < glyphs->num_glyphs; i++)
{
PangoGlyphInfo *gi = &glyphs->glyphs[i];
- cairo_glyphs[i].index = gi->glyph;
- cairo_glyphs[i].x = crenderer->x_offset + (double)(x + x_position + gi->geometry.x_offset) / PANGO_SCALE;
- cairo_glyphs[i].y = crenderer->y_offset + (double)(y + gi->geometry.y_offset) / PANGO_SCALE;
+ 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++;
+ }
+
x_position += gi->geometry.width;
}
_pango_cairo_font_install (PANGO_CAIRO_FONT (font), crenderer->cr);
if (crenderer->do_path)
- cairo_glyph_path (crenderer->cr, cairo_glyphs, glyphs->num_glyphs);
+ cairo_glyph_path (crenderer->cr, cairo_glyphs, count);
else
- cairo_show_glyphs (crenderer->cr, cairo_glyphs, glyphs->num_glyphs);
+ cairo_show_glyphs (crenderer->cr, cairo_glyphs, count);
if (glyphs->num_glyphs > MAX_STACK)
g_free (cairo_glyphs);