diff --git a/examples/10-font/font.cpp b/examples/10-font/font.cpp index d8c1d7ea..689a0bcc 100644 --- a/examples/10-font/font.cpp +++ b/examples/10-font/font.cpp @@ -59,7 +59,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) TrueTypeHandle fontFiles[fontCount]; FontHandle fonts[fontCount]; - for (int32_t ii = 0; ii < fontCount; ++ii) + for (uint32_t ii = 0; ii < fontCount; ++ii) { //instantiate a usable font fontFiles[ii] = fontManager->loadTrueTypeFromFile(fontNames[ii]); @@ -83,7 +83,7 @@ int _main_(int /*_argc*/, char** /*_argv*/) //the pen position represent the top left of the box of the first line of text textBufferManager->setPenPosition(staticText, 24.0f, 100.0f); - for (int32_t ii = 0; ii < fontCount; ++ii) + for (uint32_t ii = 0; ii < fontCount; ++ii) { //add some text to the buffer textBufferManager->appendText(staticText, fonts[ii], L"The quick brown fox jumps over the lazy dog\n"); diff --git a/examples/common/font/text_buffer_manager.cpp b/examples/common/font/text_buffer_manager.cpp index 97ae4050..0f9cbd64 100644 --- a/examples/common/font/text_buffer_manager.cpp +++ b/examples/common/font/text_buffer_manager.cpp @@ -278,16 +278,16 @@ void TextBuffer::appendText(FontHandle _fontHandle, const char* _string) m_lineAscender = 0; //font.m_ascender; } - uint32_t codepoint; + CodePoint_t codepoint = 0; uint32_t state = 0; for (; *_string; ++_string) { - if (!utf8_decode(&state, &codepoint, *_string) ) + if (!utf8_decode(&state, (uint32_t*)&codepoint, *_string) ) { - if (m_fontManager->getGlyphInfo(_fontHandle, (CodePoint_t)codepoint, glyph) ) + if (m_fontManager->getGlyphInfo(_fontHandle, codepoint, glyph) ) { - appendGlyph( (CodePoint_t)codepoint, font, glyph); + appendGlyph(codepoint, font, glyph); } else { @@ -296,8 +296,6 @@ void TextBuffer::appendText(FontHandle _fontHandle, const char* _string) } } - //printf("U+%04X\n", codepoint); - if (state != UTF8_ACCEPT) { // assert(false && "The string is not well-formed"); @@ -558,7 +556,9 @@ void TextBuffer::verticalCenterLastLine(float _dy, float _top, float _bottom) } } -TextBufferManager::TextBufferManager(FontManager* _fontManager) : m_fontManager(_fontManager), m_textBufferHandles(MAX_TEXT_BUFFER_COUNT) +TextBufferManager::TextBufferManager(FontManager* _fontManager) + : m_textBufferHandles(MAX_TEXT_BUFFER_COUNT) + , m_fontManager(_fontManager) { m_textBuffers = new BufferCache[MAX_TEXT_BUFFER_COUNT];