MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / lookupKernClass

Function lookupKernClass

lib/EpdFont/EpdFont.cpp:83–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83static 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
103int8_t EpdFont::getKerning(const uint32_t leftCp, const uint32_t rightCp) const {
104 if (utf8IsCjkBreakable(leftCp) || utf8IsCjkBreakable(rightCp)) {

Callers 1

getKerningMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected