| 81 | } |
| 82 | |
| 83 | static uint8_t lookupKernClass(const EpdKernClassEntry* entries, const uint16_t count, const uint32_t cp) { |
| 84 | if (!entries || count == 0 || cp > 0xFFFF) { |
| 85 | return 0; |
| 86 | } |
| 87 | |
| 88 | const auto target = static_cast<uint16_t>(cp); |
| 89 | const auto* end = entries + count; |
| 90 | |
| 91 | // lower_bound: exact-key lookup. Finds the first entry with codepoint >= target, |
| 92 | // then the equality check confirms an exact match exists. |
| 93 | const auto it = std::lower_bound( |
| 94 | entries, end, target, [](const EpdKernClassEntry& entry, uint16_t value) { return entry.codepoint < value; }); |
| 95 | |
| 96 | if (it != end && it->codepoint == target) { |
| 97 | return it->classId; |
| 98 | } |
| 99 | |
| 100 | return 0; |
| 101 | } |
| 102 | |
| 103 | int8_t EpdFont::getKerning(const uint32_t leftCp, const uint32_t rightCp) const { |
| 104 | if (utf8IsCjkBreakable(leftCp) || utf8IsCjkBreakable(rightCp)) { |