How to get characters using their glyph indices
I'm working on a GUI application that renders rich edit text to an image. The rendering itself is done by means of drawGlyphRun method of QPainter. I also have to collect some statistics over the rendered characters (using character themselves and the bounding rectangles of their glyphs).
The problem is that I cannot find a way to calculate character(s) using its(their) glyph index. GlyphRuns for rendering are got using QTextLayout::glyphRuns method. I can get the text from richedit widget to build a map, but the problem is that the glyph indices calculated for that text (Text Glyph Indices) differ from what QTextLayout::glyphRuns gives (Richedit Glyph Indices).
Text Glyph Indices are calculated using QRawFont::glyphIndexesForString method. The instance of QRawFont is a property of QGlyphRun object (returned by QTextLayout::glyphRuns). So it appears to me that the indices have to be the same (the order might differ). But in reality they differ for the languages when one glyph might correspont to multiple characters (Kannada, for example).
Does anybody know how to get characters from glyph indices? I could use Richedit Glyph Indices for the calculation in this case.
Any help is appreciated.