diff src/gfx.cpp @ 20676:7e084f1014bd draft

-Fix: Textbuf caret rendering for complex scripts (e.g. Tamil).
author Michael Lutz <michi@icosahedron.de>
date Wed, 17 Jul 2013 22:46:06 +0200 (2013-07-17)
parents e98038d83f05
children 42bd8405a50c
line wrap: on
line diff
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -708,6 +708,20 @@
 }
 
 /**
+ * Get the leading corner of a character in a single-line string relative
+ * to the start of the string.
+ * @param str String containing the character.
+ * @param ch Pointer to the character in the string.
+ * @param start_fontsize Font size to start the text with.
+ * @return Upper left corner of the glyph associated with the character.
+ */
+Point GetCharPosInString(const char *str, const char *ch, FontSize start_fontsize)
+{
+	Layouter layout(str, INT32_MAX, TC_FROMSTRING, start_fontsize);
+	return layout.GetCharPosition(ch);
+}
+
+/**
  * Draw single character horizontally centered around (x,y)
  * @param c           Character (glyph) to draw
  * @param x           X position to draw character