Local copy of EpdFont.cpp's lookupKernClass (that one is file-static there). Returns the 1-based class ID for `cp`, or 0 if the codepoint has no kerning class.
| 244 | // Local copy of EpdFont.cpp's lookupKernClass (that one is file-static there). |
| 245 | // Returns the 1-based class ID for `cp`, or 0 if the codepoint has no kerning class. |
| 246 | static uint8_t miniLookupKernClass(const EpdKernClassEntry* entries, uint16_t count, uint32_t cp) { |
| 247 | if (!entries || count == 0 || cp > 0xFFFF) return 0; |
| 248 | const auto target = static_cast<uint16_t>(cp); |
| 249 | const auto* end = entries + count; |
| 250 | const auto it = |
| 251 | std::lower_bound(entries, end, target, [](const EpdKernClassEntry& e, uint16_t v) { return e.codepoint < v; }); |
| 252 | return (it != end && it->codepoint == target) ? it->classId : 0; |
| 253 | } |
| 254 | |
| 255 | // Build a small per-page kern matrix containing ONLY the (leftClass, rightClass) |
| 256 | // pairs reachable from codepoints in the current text. Class IDs are renumbered |