summaryrefslogtreecommitdiff
path: root/pango/pango-engine.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-06-05 02:04:56 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-06-05 02:04:56 +0000
commit78059d83ba56f36c874cdf71dcb07a6724bf355f (patch)
treed9026b55a0a3a5a6478fd66f9cca8357ce52316b /pango/pango-engine.c
parent9df621b3fa0a1e49c75eac8fc239138f8991b536 (diff)
downloadpango-78059d83ba56f36c874cdf71dcb07a6724bf355f.tar.gz
Zero glyphs->num_glyphs before calling into shape engine.
2007-06-04 Behdad Esfahbod <behdad@gnome.org> * pango/shape.c (pango_shape): Zero glyphs->num_glyphs before calling into shape engine. * pango/pango-engine.c (fallback_engine_shape): Improve, to support clusters and what not. * pango/pangocairo-font.c (_pango_cairo_font_get_hex_box_info): Use "pango_script_get_sample_language (PANGO_SCRIPT_LATIN)" instead of hardcoding "en". Handle cairo_scaled_font_extents() failure. svn path=/trunk/; revision=2332
Diffstat (limited to 'pango/pango-engine.c')
-rw-r--r--pango/pango-engine.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/pango/pango-engine.c b/pango/pango-engine.c
index c8461892..a21e5d84 100644
--- a/pango/pango-engine.c
+++ b/pango/pango-engine.c
@@ -103,8 +103,9 @@ fallback_engine_shape (PangoEngineShape *engine,
PangoGlyphString *glyphs)
{
int n_chars;
- int i;
const char *p;
+ int cluster = 0;
+ int i;
n_chars = text ? g_utf8_strlen (text, length) : 0;
@@ -113,8 +114,19 @@ fallback_engine_shape (PangoEngineShape *engine,
p = text;
for (i = 0; i < n_chars; i++)
{
+ gunichar wc;
+ PangoGlyph glyph;
PangoRectangle logical_rect;
- PangoGlyph glyph = g_utf8_get_char (p) | PANGO_GLYPH_UNKNOWN_FLAG;
+
+ wc = g_utf8_get_char (p);
+
+ if (g_unichar_type (wc) != G_UNICODE_NON_SPACING_MARK)
+ cluster = p - text;
+
+ if (pango_is_zero_width (wc))
+ glyph = PANGO_GLYPH_EMPTY;
+ else
+ glyph = PANGO_GET_UNKNOWN_GLYPH (wc);
pango_font_get_glyph_extents (analysis->font, glyph, NULL, &logical_rect);
@@ -124,7 +136,7 @@ fallback_engine_shape (PangoEngineShape *engine,
glyphs->glyphs[i].geometry.y_offset = 0;
glyphs->glyphs[i].geometry.width = logical_rect.width;
- glyphs->log_clusters[i] = p - text;
+ glyphs->log_clusters[i] = cluster;
p = g_utf8_next_char (p);
}