summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-12-07 04:21:10 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-12-07 04:21:10 +0000
commit5aa7dd3136efec76b577b65cbc6962728f3f66bf (patch)
treebede1a2ae813b6bda2b771053142a2ad150f0193
parent15fd900199bde756a7d3779549c24e971919e4da (diff)
downloadpango-5aa7dd3136efec76b577b65cbc6962728f3f66bf.tar.gz
Roughly clip glyphs into the X coordinate area to avoid wrap-around.
Fri Dec 6 23:07:58 2002 Owen Taylor <otaylor@redhat.com> * pango/pangoxft-font.c (pango_xft_real_render) pango/pangox.c (pango_x_render): Roughly clip glyphs into the X coordinate area to avoid wrap-around. (#73199)
-rw-r--r--ChangeLog12
-rw-r--r--ChangeLog.pre-1-1012
-rw-r--r--ChangeLog.pre-1-212
-rw-r--r--ChangeLog.pre-1-412
-rw-r--r--ChangeLog.pre-1-612
-rw-r--r--ChangeLog.pre-1-812
-rw-r--r--pango/pangox.c40
-rw-r--r--pango/pangoxft-font.c28
8 files changed, 116 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f8c763b..28d5a7f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Fri Dec 6 23:07:58 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render)
+ pango/pangox.c (pango_x_render): Roughly clip glyphs
+ into the X coordinate area to avoid wrap-around. (#73199)
+
+Fri Dec 6 22:30:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render):
+ pango/pangox.c (pango_x_render): Truncate rendering
+ after 32768 pixels to avoid the possiblity of wrapping.
+
Fri Dec 6 19:42:33 2002 Owen Taylor <otaylor@redhat.com>
* pango/modules.c (map_get_submap): Dynamically allocate
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index 5f8c763b..28d5a7f5 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,15 @@
+Fri Dec 6 23:07:58 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render)
+ pango/pangox.c (pango_x_render): Roughly clip glyphs
+ into the X coordinate area to avoid wrap-around. (#73199)
+
+Fri Dec 6 22:30:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render):
+ pango/pangox.c (pango_x_render): Truncate rendering
+ after 32768 pixels to avoid the possiblity of wrapping.
+
Fri Dec 6 19:42:33 2002 Owen Taylor <otaylor@redhat.com>
* pango/modules.c (map_get_submap): Dynamically allocate
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index 5f8c763b..28d5a7f5 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,15 @@
+Fri Dec 6 23:07:58 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render)
+ pango/pangox.c (pango_x_render): Roughly clip glyphs
+ into the X coordinate area to avoid wrap-around. (#73199)
+
+Fri Dec 6 22:30:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render):
+ pango/pangox.c (pango_x_render): Truncate rendering
+ after 32768 pixels to avoid the possiblity of wrapping.
+
Fri Dec 6 19:42:33 2002 Owen Taylor <otaylor@redhat.com>
* pango/modules.c (map_get_submap): Dynamically allocate
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index 5f8c763b..28d5a7f5 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,15 @@
+Fri Dec 6 23:07:58 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render)
+ pango/pangox.c (pango_x_render): Roughly clip glyphs
+ into the X coordinate area to avoid wrap-around. (#73199)
+
+Fri Dec 6 22:30:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render):
+ pango/pangox.c (pango_x_render): Truncate rendering
+ after 32768 pixels to avoid the possiblity of wrapping.
+
Fri Dec 6 19:42:33 2002 Owen Taylor <otaylor@redhat.com>
* pango/modules.c (map_get_submap): Dynamically allocate
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index 5f8c763b..28d5a7f5 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,15 @@
+Fri Dec 6 23:07:58 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render)
+ pango/pangox.c (pango_x_render): Roughly clip glyphs
+ into the X coordinate area to avoid wrap-around. (#73199)
+
+Fri Dec 6 22:30:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render):
+ pango/pangox.c (pango_x_render): Truncate rendering
+ after 32768 pixels to avoid the possiblity of wrapping.
+
Fri Dec 6 19:42:33 2002 Owen Taylor <otaylor@redhat.com>
* pango/modules.c (map_get_submap): Dynamically allocate
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index 5f8c763b..28d5a7f5 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,15 @@
+Fri Dec 6 23:07:58 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render)
+ pango/pangox.c (pango_x_render): Roughly clip glyphs
+ into the X coordinate area to avoid wrap-around. (#73199)
+
+Fri Dec 6 22:30:17 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangoxft-font.c (pango_xft_real_render):
+ pango/pangox.c (pango_x_render): Truncate rendering
+ after 32768 pixels to avoid the possiblity of wrapping.
+
Fri Dec 6 19:42:33 2002 Owen Taylor <otaylor@redhat.com>
* pango/modules.c (map_get_submap): Dynamically allocate
diff --git a/pango/pangox.c b/pango/pangox.c
index d45f9780..cca2e278 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -491,21 +491,35 @@ pango_x_render (Display *display,
for (i=0; i<glyphs->num_glyphs; i++)
{
- if (glyphs->glyphs[i].glyph &
- PANGO_X_UNKNOWN_FLAG)
+ PangoGlyph glyph = glyphs->glyphs[i].glyph;
+ int glyph_x = x + PANGO_PIXELS (x_off + glyphs->glyphs[i].geometry.x_offset);
+ int glyph_y = y + PANGO_PIXELS (glyphs->glyphs[i].geometry.y_offset);
+
+ /* Clip glyphs into the X coordinate range; we really
+ * want to clip glyphs with an ink rect outside the
+ * [0,32767] x [0,32767] rectangle but looking up
+ * the ink rect here would be a noticeable speed hit.
+ * This is close enough.
+ */
+ if (!(glyph &&
+ glyph_x >= -16384 && glyph_x <= 32767 &&
+ glyph_y >= -16384 && glyph_y <= 32767))
+ goto next_glyph;
+
+ if (glyph & PANGO_X_UNKNOWN_FLAG)
{
PangoFontMetrics *metrics = pango_font_get_metrics (font, NULL);
int x1, y1, x2, y2; /* rectangle the character should go inside. */
int baseline;
gunichar wc;
- x1 = x + (x_off + glyphs->glyphs[i].geometry.x_offset) / PANGO_SCALE;
- y1 = y + (glyphs->glyphs[i].geometry.y_offset - metrics->ascent) / PANGO_SCALE;
- x2 = x1 + glyphs->glyphs[i].geometry.width / PANGO_SCALE;
- y2 = y1 + (metrics->ascent + metrics->descent) / PANGO_SCALE;
- baseline = y1 + metrics->ascent / PANGO_SCALE;
+ x1 = glyph_x;
+ y1 = glyph_y - PANGO_PIXELS (metrics->ascent);
+ x2 = x1 + PANGO_PIXELS (glyphs->glyphs[i].geometry.width);
+ y2 = y1 + PANGO_PIXELS (metrics->ascent + metrics->descent);
+ baseline = glyph_y;
- wc = glyphs->glyphs[i].glyph & (~PANGO_X_UNKNOWN_FLAG);
+ wc = glyph & (~PANGO_X_UNKNOWN_FLAG);
switch (wc)
{
@@ -576,10 +590,10 @@ pango_x_render (Display *display,
pango_font_metrics_unref (metrics);
}
- else if (glyphs->glyphs[i].glyph)
+ else
{
- guint16 index = PANGO_X_GLYPH_INDEX (glyphs->glyphs[i].glyph);
- guint16 subfont_index = PANGO_X_GLYPH_SUBFONT (glyphs->glyphs[i].glyph);
+ guint16 index = PANGO_X_GLYPH_INDEX (glyph);
+ guint16 subfont_index = PANGO_X_GLYPH_SUBFONT (glyph);
PangoXSubfontInfo *subfont;
XChar2b c;
@@ -601,12 +615,12 @@ pango_x_render (Display *display,
}
XDrawString16 (display, d, gc,
- x + (x_off + glyphs->glyphs[i].geometry.x_offset) / PANGO_SCALE,
- y + glyphs->glyphs[i].geometry.y_offset / PANGO_SCALE,
+ glyph_x, glyph_y,
&c, 1);
}
}
+ next_glyph:
x_off += glyphs->glyphs[i].geometry.width;
}
}
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
index f2d799d0..addc27e4 100644
--- a/pango/pangoxft-font.c
+++ b/pango/pangoxft-font.c
@@ -281,18 +281,24 @@ pango_xft_real_render (Display *display,
} \
} G_STMT_END
- /* Slow initial implementation. For speed, it should really
- * collect the characters into runs, and draw multiple
- * characters with each XftDrawString32 call.
- */
if (!display)
_pango_xft_font_map_get_info (xfont->fontmap, &display, NULL);
-
+
for (i=0; i<glyphs->num_glyphs; i++)
{
PangoGlyph glyph = glyphs->glyphs[i].glyph;
-
- if (glyph)
+ int glyph_x = x + PANGO_PIXELS (x_off + glyphs->glyphs[i].geometry.x_offset);
+ int glyph_y = y + PANGO_PIXELS (glyphs->glyphs[i].geometry.y_offset);
+
+ /* Clip glyphs into the X coordinate range; we really
+ * want to clip glyphs with an ink rect outside the
+ * [0,32767] x [0,32767] rectangle but looking up
+ * the ink rect here would be a noticeable speed hit.
+ * This is close enough.
+ */
+ if (glyph &&
+ glyph_x >= -16384 && glyph_x <= 32767 &&
+ glyph_y >= -16384 && glyph_y <= 32767)
{
if (glyph & PANGO_XFT_UNKNOWN_FLAG)
{
@@ -306,11 +312,11 @@ pango_xft_real_render (Display *display,
glyph &= ~PANGO_XFT_UNKNOWN_FLAG;
- ys[0] = y + PANGO_PIXELS (glyphs->glyphs[i].geometry.y_offset) - xft_font->ascent + (xft_font->ascent + xft_font->descent - xfont->mini_height * 2 - xfont->mini_pad * 5) / 2;
+ ys[0] = glyph_y - xft_font->ascent + (xft_font->ascent + xft_font->descent - xfont->mini_height * 2 - xfont->mini_pad * 5) / 2;
ys[1] = ys[0] + 2 * xfont->mini_pad + xfont->mini_height;
ys[2] = ys[1] + xfont->mini_height + xfont->mini_pad;
- xs[0] = x + PANGO_PIXELS (x_off + glyphs->glyphs[i].geometry.x_offset);
+ xs[0] = glyph_x;
xs[1] = xs[0] + 2 * xfont->mini_pad;
xs[2] = xs[1] + xfont->mini_width + xfont->mini_pad;
@@ -343,8 +349,8 @@ pango_xft_real_render (Display *display,
if (n_xft_glyph == N_XFT_LOCAL)
FLUSH_GLYPHS ();
- xft_glyphs[n_xft_glyph].x = x + PANGO_PIXELS (x_off + glyphs->glyphs[i].geometry.x_offset);
- xft_glyphs[n_xft_glyph].y = y + PANGO_PIXELS (glyphs->glyphs[i].geometry.y_offset);
+ xft_glyphs[n_xft_glyph].x = glyph_x;
+ xft_glyphs[n_xft_glyph].y = glyph_y;
xft_glyphs[n_xft_glyph].glyph = glyph;
n_xft_glyph++;
}