isUnicodeWhitespace function
Unicode whitespace in CommonMark's sense: the Zs category plus tab, line
feed, form feed and carriage return. -1 (outside the text) counts as
whitespace, so the start and end of a run behave like a space.
Implementation
bool isUnicodeWhitespace(int codePoint) {
if (codePoint < 0) {
return true;
}
if (codePoint < 0x80) {
return codePoint == _space ||
codePoint == _tab ||
codePoint == 0x0A ||
codePoint == 0x0C ||
codePoint == 0x0D;
}
return codePoint == 0xA0 ||
codePoint == 0x1680 ||
(codePoint >= 0x2000 && codePoint <= 0x200A) ||
codePoint == 0x202F ||
codePoint == 0x205F ||
codePoint == 0x3000;
}