From f55d4bed0d3c14e4c537ee2b103b465b84b6d955 Mon Sep 17 00:00:00 2001 From: mrwastl Date: Fri, 3 Jun 2011 20:45:27 +0200 Subject: fix another (minor) bug with utf8 and encodedCharAdjustCounter() --- glcdgraphics/font.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/glcdgraphics/font.c b/glcdgraphics/font.c index 09d513d..29027d0 100644 --- a/glcdgraphics/font.c +++ b/glcdgraphics/font.c @@ -385,12 +385,13 @@ int cFont::Width(const std::string & str, unsigned int len) const unsigned int symcount=0; uint32_t c; - for (i = 0; i < (unsigned int)str.length() && symcount < len; i++) + i = 0; + while (i < (unsigned int)str.length() && symcount < len) { - unsigned int tmp = i; - encodedCharAdjustCounter(IsUTF8(), str, c, tmp); + encodedCharAdjustCounter(IsUTF8(), str, c, i); symcount++; sum += Width(c); + i++; } sum += spaceBetween * (symcount - 1); -- cgit v1.2.3