From 06971775cd0b5752f7bb718439563a613c52b8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 28 Mar 2013 13:07:02 +0100 Subject: [PATCH] Text: properly compute glyph count in FreeTypeFont layouter. It was the same as byte count, thus working only for pure ASCII, not UTF-8. --- src/Text/FreeTypeFont.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Text/FreeTypeFont.cpp b/src/Text/FreeTypeFont.cpp index f90a33fe4..a5fd3c785 100644 --- a/src/Text/FreeTypeFont.cpp +++ b/src/Text/FreeTypeFont.cpp @@ -194,12 +194,12 @@ namespace { FreeTypeLayouter::FreeTypeLayouter(FreeTypeFont& font, const Float size, const std::string& text): font(font), size(size) { /* Get glyph codes from characters */ glyphs.reserve(text.size()); - _glyphCount = text.size(); for(std::size_t i = 0; i != text.size(); ) { UnsignedInt codepoint; std::tie(codepoint, i) = Corrade::Utility::Unicode::nextChar(text, i); glyphs.push_back(FT_Get_Char_Index(font.font(), codepoint)); } + _glyphCount = glyphs.size(); } std::tuple FreeTypeLayouter::renderGlyph(const Vector2& cursorPosition, const UnsignedInt i) {