There is an end-of-values marker in the sizes array, aka -1. The
old search loop wasn't detecting that, so consequently could just
walk off the end of the sizes array.
It also meant that searching for a size > the biggest size in the
array would end up matching 0, because the sizes array in loader is
padded with zeros.
I noticed this using QED's Font dialog, which calls out to
Teradesk's font selector in my config - I was unable to choose any
font size for a TTF apart from 10, and Aranym's stderr was filled
with "Attempt to load metrics with bad point size!" messages.
With the fix, searching for ptsize will return the nearest size
<= it. Searching for sizes smaller than sizes[0] will just return
sizes[0]. This seems to match NVDI.
There is an end-of-values marker in the sizes array, aka -1. The old search loop wasn't detecting that, so consequently could just walk off the end of the sizes array.
It also meant that searching for a size > the biggest size in the array would end up matching 0, because the sizes array in loader is padded with zeros.
I noticed this using QED's Font dialog, which calls out to Teradesk's font selector in my config - I was unable to choose any font size for a TTF apart from 10, and Aranym's stderr was filled with "Attempt to load metrics with bad point size!" messages.
With the fix, searching for ptsize will return the nearest size <= it. Searching for sizes smaller than sizes[0] will just return sizes[0]. This seems to match NVDI.