summaryrefslogtreecommitdiff
path: root/modules/basic/basic-x.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-03-07 02:02:15 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-03-07 02:02:15 +0000
commitdd0b4a5064c6f60adcfd2ea02e2d61fb60254d20 (patch)
tree39a121f4bd40300bcd67521104db86c12bd33165 /modules/basic/basic-x.c
parent6278d373c1a564ae4233a2e4b6d428a9f6202728 (diff)
downloadpango-dd0b4a5064c6f60adcfd2ea02e2d61fb60254d20.tar.gz
Convert log_clusters[] use from char offsets to byte offset - should make
Mon Mar 6 20:55:32 2000 Owen Taylor <otaylor@redhat.com> * libpango/mapping.c example/viewer.c: * modules/hangul/hangul.c modules/basic/basic.c modules/tamil/tamil.c: Convert log_clusters[] use from char offsets to byte offset - should make it easier to have all interface deal with stuff in byte offsets. * libpango/mapping.c libpango/pango-glyph.h: Rename x_to_cp and cp_to_x to make them "member functions" of glyph_string. * libpango/pango-types.h: Add a rectangle type for use in storing glyph/glyph-string extents, plus macros for extracting ascent/descent. * libpango/fonts.c libpango/pango-font.h libpango/pangox.c: Virtualize glyph extents function into the font. * libpango/pangox.c modules/*/*.c examples/viewer.c: Convert over to new rationalized unit system - everything in 1000ths of a point or 1000ths of a glyph unit. * libpango/pango-glyph.h libpango/glyphstring.c: Add function to get extents of a glyph string. (We may want to fastpath the width in the future, since getting the width seems to be a very common and time-critical operation)
Diffstat (limited to 'modules/basic/basic-x.c')
-rw-r--r--modules/basic/basic-x.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c
index acd4a947..5e524f72 100644
--- a/modules/basic/basic-x.c
+++ b/modules/basic/basic-x.c
@@ -278,20 +278,19 @@ find_char (CharCache *cache, PangoFont *font, GUChar4 wc, const char *input)
}
static void
-set_glyph (PangoFont *font, PangoGlyphString *glyphs, gint i, PangoGlyph glyph)
+set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGlyph glyph)
{
- gint width;
+ PangoRectangle logical_rect;
glyphs->glyphs[i].glyph = glyph;
glyphs->glyphs[i].geometry.x_offset = 0;
glyphs->glyphs[i].geometry.y_offset = 0;
- glyphs->log_clusters[i] = i;
+ glyphs->log_clusters[i] = offset;
- pango_x_glyph_extents (font, glyphs->glyphs[i].glyph,
- NULL, NULL, &width, NULL, NULL, NULL, NULL);
- glyphs->glyphs[i].geometry.width = width * 72;
+ pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
+ glyphs->glyphs[i].geometry.width = logical_rect.width;
}
static iconv_t
@@ -445,7 +444,7 @@ basic_engine_shape (PangoFont *font,
index = find_char (cache, font, wc, p);
if (index)
{
- set_glyph (font, glyphs, i, index);
+ set_glyph (font, glyphs, i, p - text, index);
if (unicode_type (wc) == UNICODE_NON_SPACING_MARK)
{
@@ -459,7 +458,7 @@ basic_engine_shape (PangoFont *font,
}
}
else
- set_glyph (font, glyphs, i, pango_x_get_unknown_glyph (font));
+ set_glyph (font, glyphs, i, p - text, pango_x_get_unknown_glyph (font));
p = next;
}