for (i = 0;((bytes_left = *maxlen - (text - text_start)) > 0) && *text;)
{
nextch = ch = u8_getnchar(text, &text, bytes_left);
- //i = text - text_start;
+ i = text - text_start;
if (!ch)
break;
if (snap)
if(x + fnt->width_of[(int) ' '] * w > maxwidth)
break; // oops, can't draw this
x += fnt->width_of[(int) ' '] * w;
- ++i;
continue;
}
- if (ch == STRING_COLOR_TAG && !ignorecolorcodes && i + 1 < *maxlen)
+ // i points to the char after ^
+ if (ch == STRING_COLOR_TAG && !ignorecolorcodes && i < *maxlen)
{
- ++i;
ch = *text; // colors are ascii, so no u8_ needed
if (ch <= '9' && ch >= '0') // ^[0-9] found
{
++i;
continue;
}
+ // i points to the char after ^...
+ // i+3 points to 3 in ^x123
+ // i+3 == *maxlen would mean that char is missing
else if (ch == STRING_COLOR_RGB_TAG_CHAR && i + 3 < *maxlen ) // ^x found
{
// building colorindex...
i--;
}
ch = nextch;
- ++i;
if (!fontmap || (ch <= 0xFF && fontmap->glyphs[ch].image) || (ch >= 0xE000 && ch <= 0xE0FF))
{