| 1048 | */ |
| 1049 | |
| 1050 | int 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 | |
| 1080 | const uint8_t *PocoBMFGlyphFromUTF8(uint8_t **src, const uint8_t *chars, int charCount) |
| 1081 | { |
no outgoing calls
no test coverage detected