MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PocoNextFromUTF8

Function PocoNextFromUTF8

modules/commodetto/commodettoPocoBlit.c:1050–1078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1048*/
1049
1050int PocoNextFromUTF8(uint8_t **src)
1051{
1052 int result;
1053 uint8_t *s = *src;
1054 uint8_t c = c_read8(s++);
1055
1056 if (!(c & 0x80)) {
1057 *src = s;
1058 return c;
1059 }
1060
1061 if (0xC0 == (c & 0xE0)) { // 2 byte sequence
1062 result = ((c & 0x1F) << 6) | (c_read8(s) & 0x3F);
1063 s += 1;
1064 }
1065 else if (0xE0 == (c & 0xF0)) { // 3 byte sequence
1066 result = ((c & 0x0F) << 12) | ((c_read8(s) & 0x3F) << 6) | (c_read8(s + 1) & 0x3F);
1067 s += 2;
1068 }
1069 else if (0xF0 == (c & 0xF1)) { // 4 byte sequence
1070 result = ((c & 0x07) << 18) | ((c_read8(s) & 0x3F) << 12) | ((c_read8(s + 1) & 0x3F) << 6) | (c_read8(s + 2) & 0x3F);
1071 s += 3;
1072 }
1073 else
1074 result = 0;
1075
1076 *src = s;
1077 return result;
1078}
1079
1080const uint8_t *PocoBMFGlyphFromUTF8(uint8_t **src, const uint8_t *chars, int charCount)
1081{

Callers 6

CFELayoutRunFunction · 0.85
xs_poco_getTextWidthFunction · 0.85
xs_poco_drawTextFunction · 0.85
CFELayoutRunFunction · 0.85
PocoBMFGlyphFromUTF8Function · 0.85
CFELayoutRunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected