Browse Source

Win32: Fixed a bug where certain unicode characters (> 0x8000) would not be displayed correctly on Windows

tags/2021-05-28
hogliux 7 years ago
parent
commit
269c1f27fd
1 changed files with 4 additions and 6 deletions
  1. +4
    -6
      modules/juce_graphics/native/juce_win32_Fonts.cpp

+ 4
- 6
modules/juce_graphics/native/juce_win32_Fonts.cpp View File

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


Loading…
Cancel
Save