Byte-level pre-check: Hebrew UTF-8 lead bytes 0xD6-0xD7, Arabic/Syriac 0xD8-0xDB.
| 28 | |
| 29 | // Byte-level pre-check: Hebrew UTF-8 lead bytes 0xD6-0xD7, Arabic/Syriac 0xD8-0xDB. |
| 30 | bool mayContainRtlBytes(const char* str) { |
| 31 | for (const auto* p = reinterpret_cast<const unsigned char*>(str); *p; ++p) { |
| 32 | if (*p >= 0xD6 && *p <= 0xDB) return true; |
| 33 | } |
| 34 | return false; |
| 35 | } |
| 36 | |
| 37 | // Returns the first rendered codepoint of a word (skipping leading soft hyphens). |
| 38 | uint32_t firstCodepoint(const std::string& word) { |