Browse Source

Text: properly compute glyph count in FreeTypeFont layouter.

It was the same as byte count, thus working only for pure ASCII, not
UTF-8.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
06971775cd
  1. 2
      src/Text/FreeTypeFont.cpp

2
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<Rectangle, Rectangle, Vector2> FreeTypeLayouter::renderGlyph(const Vector2& cursorPosition, const UnsignedInt i) {

Loading…
Cancel
Save