summaryrefslogtreecommitdiff
path: root/pango/mapping.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-05-18 16:04:40 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-05-18 16:04:40 +0000
commit676359dce7d33d1b999888d1a33a5c96f9091a88 (patch)
treef36b096a9c9d279b905a145f7aff0acd86760e74 /pango/mapping.c
parente6858b1b195339b72f61f6818657bd6b24a2cfc6 (diff)
downloadpango-676359dce7d33d1b999888d1a33a5c96f9091a88.tar.gz
Use ISO C99 varargs when available.
Fri May 18 11:30:57 2001 Owen Taylor <otaylor@redhat.com> * pango/opentype/disasm.c: Use ISO C99 varargs when available. Thu May 17 11:16:23 2001 Owen Taylor <otaylor@redhat.com> * pango/mapping.c: Fixup docs, remove some FIXMEs that are no longer applicable. * pango/pango-layout.c: Move by graphemes, not characters. * pango/pango-layout.c (pango_layout_line_x_to_index): Position at the closest grapheme boundary, not at character boundaries. * pango/pango-layout.c (pango_layout_line_index_to_x): Return positions of grapheme boundaries, not character boundaries.
Diffstat (limited to 'pango/mapping.c')
-rw-r--r--pango/mapping.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/pango/mapping.c b/pango/mapping.c
index f632cb61..a5e6a872 100644
--- a/pango/mapping.c
+++ b/pango/mapping.c
@@ -38,12 +38,12 @@
* @analysis: the analysis information return from pango_itemize()
* @index: the byte index within @text
* @trailing: whether we should compute the result for the beginning
- * or end of the character (or cluster - the decision
- * for which may be script dependent).
+ * or end of the character.
* @x_pos: location to store result
*
* Converts from character position to x position. (X position
- * is measured from the left edge of the run)
+ * is measured from the left edge of the run). Character positions
+ * are computed by dividing up each cluster into equal portions.
*/
void
@@ -145,10 +145,6 @@ pango_glyph_string_index_to_x (PangoGlyphString *glyphs,
p = g_utf8_next_char (p);
}
- /* Now interpolate the result. For South Asian languages
- * we actually shouldn't iterpolate
- */
-
if (trailing)
cluster_offset += 1;
@@ -166,13 +162,15 @@ pango_glyph_string_index_to_x (PangoGlyphString *glyphs,
* @x_pos: the x offset (in thousands of a device unit)
* @index: location to store calculated byte index within @text
* @trailing: location to store a integer indicating where
- * in the cluster the user clicked. If the script
- * allows positioning within the cluster, it is either
- * 0 or 1; otherwise it is either 0 or the number
- * of characters in the cluster. In either case
- * 0 represents the trailing edge of the cluster.
+ * whether the user clicked on the leading or trailing
+ * edge of the character.
*
- * Convert from x offset to position.
+ * Convert from x offset to character position. Character positions
+ * are computed by dividing up each cluster into equal portions.
+ * In scripts where positioning within a cluster is not allowed
+ * (such as Thai), the returned value may not be a valid cursor
+ * position; the caller must combine the result with the logical
+ * attributes for the text to compute the valid cursor position.
*/
void
pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
@@ -181,7 +179,7 @@ pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
PangoAnalysis *analysis,
int x_pos,
int *index,
- int *trailing)
+ gboolean *trailing)
{
int i;
int start_xpos = 0;
@@ -293,8 +291,6 @@ pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
*index = (p - text);
}
- /* FIXME: Handle multiple character clusters better
- */
if (trailing)
*trailing = (cp - (int)cp > 0.5) ? 1 : 0;
}