| @@ -364,15 +364,14 @@ public: | |||||
| { | { | ||||
| const CharPointer_UTF16 utf16 (text.toUTF16()); | const CharPointer_UTF16 utf16 (text.toUTF16()); | ||||
| const size_t numChars = utf16.length(); | const size_t numChars = utf16.length(); | ||||
| HeapBlock<int16> results (numChars + 1); | |||||
| results[numChars] = -1; | |||||
| HeapBlock<uint16> results (numChars); | |||||
| float x = 0; | float x = 0; | ||||
| if (GetGlyphIndices (dc, utf16, (int) numChars, reinterpret_cast<WORD*> (results.getData()), | if (GetGlyphIndices (dc, utf16, (int) numChars, reinterpret_cast<WORD*> (results.getData()), | ||||
| GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR) | GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR) | ||||
| { | { | ||||
| for (size_t i = 0; i < numChars; ++i) | for (size_t i = 0; i < numChars; ++i) | ||||
| x += getKerning (dc, results[i], results[i + 1]); | |||||
| x += getKerning (dc, results[i], (i + 1) < numChars ? results[i + 1] : -1); | |||||
| } | } | ||||
| return x; | return x; | ||||
| @@ -382,8 +381,7 @@ public: | |||||
| { | { | ||||
| const CharPointer_UTF16 utf16 (text.toUTF16()); | const CharPointer_UTF16 utf16 (text.toUTF16()); | ||||
| const size_t numChars = utf16.length(); | const size_t numChars = utf16.length(); | ||||
| HeapBlock<int16> results (numChars + 1); | |||||
| results[numChars] = -1; | |||||
| HeapBlock<uint16> results (numChars); | |||||
| float x = 0; | float x = 0; | ||||
| if (GetGlyphIndices (dc, utf16, (int) numChars, reinterpret_cast<WORD*> (results.getData()), | if (GetGlyphIndices (dc, utf16, (int) numChars, reinterpret_cast<WORD*> (results.getData()), | ||||
| @@ -396,7 +394,7 @@ public: | |||||
| { | { | ||||
| resultGlyphs.add (results[i]); | resultGlyphs.add (results[i]); | ||||
| xOffsets.add (x); | xOffsets.add (x); | ||||
| x += getKerning (dc, results[i], results[i + 1]); | |||||
| x += getKerning (dc, results[i], (i + 1) < numChars ? results[i + 1] : -1); | |||||
| } | } | ||||
| } | } | ||||