From dd0b4a5064c6f60adcfd2ea02e2d61fb60254d20 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 7 Mar 2000 02:02:15 +0000 Subject: Convert log_clusters[] use from char offsets to byte offset - should make Mon Mar 6 20:55:32 2000 Owen Taylor * 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) --- pango/pango-glyph.h | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'pango/pango-glyph.h') diff --git a/pango/pango-glyph.h b/pango/pango-glyph.h index b19cc782..cd9b84f9 100644 --- a/pango/pango-glyph.h +++ b/pango/pango-glyph.h @@ -22,6 +22,8 @@ #ifndef __PANGO_GLYPH_H__ #define __PANGO_GLYPH_H__ +#include + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -31,12 +33,8 @@ typedef struct _PangoGlyphVisAttr PangoGlyphVisAttr; typedef struct _PangoGlyphInfo PangoGlyphInfo; typedef struct _PangoGlyphString PangoGlyphString; -/* 64'ths of a point - 1/4608 in, 5.51 * 10^-5 in. */ -typedef guint32 PangoGlyphUnit; - -/* A index of a glyph into a font. Rendering system dependent - */ -typedef guint32 PangoGlyph; +/* 1000ths of a device unit */ +typedef gint32 PangoGlyphUnit; /* Positioning information about a glyph */ @@ -85,21 +83,25 @@ PangoGlyphString *pango_glyph_string_new (void); void pango_glyph_string_set_size (PangoGlyphString *string, gint new_len); void pango_glyph_string_free (PangoGlyphString *string); - -void pango_cp_to_x (gchar *text, - gint length, - PangoAnalysis *analysis, - PangoGlyphString *glyphs, - gint char_pos, - gboolean trailing, - gint *x_pos); -void pango_x_to_cp (gchar *text, - gint length, - PangoAnalysis *analysis, - PangoGlyphString *glyphs, - gint x_pos, - gint *char_pos, - gint *trailing); +void pango_glyph_string_extents (PangoGlyphString *glyphs, + PangoFont *font, + PangoRectangle *ink_rect, + PangoRectangle *logical_rect); + +void pango_glyph_string_index_to_x (PangoGlyphString *glyphs, + char *text, + int length, + PangoAnalysis *analysis, + int index, + gboolean trailing, + int *x_pos); +void pango_glyph_string_x_to_index (PangoGlyphString *glyphs, + char *text, + int length, + PangoAnalysis *analysis, + int x_pos, + int *index, + int *trailing); void pango_justify (PangoGlyphString *glyphs, gint new_line_width, -- cgit v1.2.1