multiple consults fail after 1 letter
Pomax opened this issue · comments
The following code fails after the first letter is retrieved:
$text = "After all this time...";
$letters = str_split($text);
print_r($letters);
foreach($letters as $letter) {
$json = false;
while($json === false && count($fonts)>0) {
$font = new OTTTFont(array_pop($fonts));
echo "font header data:\n" . $font->toString() . "\n";
$data = $font->get_glyph($letter);
if($data!==false) {
$json = $data->toJSON();
}
}
}
The first letter is found, then the parser reports the font does not support "f". Splitting the string "fter all this time..." then finds the "f" but reports the font does not support "t", etc.
turns out the caching logic wasn't very logical. Instead of caching the toplevel get_glyph the caching happened inside the glyph fetcher.
fix merged in.