MCPcopy Create free account
hub / github.com/axmolengine/axmol / _truncateUTF8String

Function _truncateUTF8String

core/ui/UITextFieldEx.cpp:132–149  ·  view source on GitHub ↗

calculate the UTF-8 string's char count.

Source from the content-addressed store, hash-verified

130
131/// calculate the UTF-8 string's char count.
132static 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
151static void internalSetLableFont(Label* l, std::string_view fontName, float fontSize)
152{

Callers 1

insertTextMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected