Correct KernLookup implementation

This commit is contained in:
Phillip Stephens 2016-03-11 15:19:02 -08:00
parent 0577dde1df
commit b952b80e22
1 changed files with 3 additions and 5 deletions

View File

@ -62,13 +62,11 @@ public:
static s32 KernLookup(const std::vector<CKernPair>& kernTable, s32 kernStart, s32 chr) static s32 KernLookup(const std::vector<CKernPair>& kernTable, s32 kernStart, s32 chr)
{ {
/* FIXME: I think this is mostly wrong */
auto iter = kernTable.cbegin() + kernStart; auto iter = kernTable.cbegin() + kernStart;
for (;iter != kernTable.cend(); ++iter) for (; iter != kernTable.cend() && iter->GetFirst() == kernTable[kernStart].GetFirst() ; ++iter)
{ {
const CKernPair& pair = *iter; if (iter->GetSecond() == chr)
if (pair.GetSecond() == chr) return iter->GetHowMuch();
return pair.GetHowMuch();
} }
return 0; return 0;