calculate the UTF-8 string's char count.
| 130 | |
| 131 | /// calculate the UTF-8 string's char count. |
| 132 | static int _truncateUTF8String(const char* text, int limit, int& nb) |
| 133 | { |
| 134 | int n = 0; |
| 135 | char ch = 0; |
| 136 | nb = 0; |
| 137 | while ((ch = *text) != 0x0) |
| 138 | { |
| 139 | AX_BREAK_IF(!ch || n > limit); |
| 140 | |
| 141 | if (0x80 != (0xC0 & ch)) |
| 142 | { |
| 143 | ++n; |
| 144 | } |
| 145 | ++nb; |
| 146 | ++text; |
| 147 | } |
| 148 | return n; |
| 149 | } |
| 150 | |
| 151 | static void internalSetLableFont(Label* l, std::string_view fontName, float fontSize) |
| 152 | { |