Binary Search in gtk_font_selection_find_font()



Am I wrong in thinking it's busted?  Specifically, it's never
going to match only the "family" attribute, if the foundry can't be
found also.  In my case, I'm passing "*" for the foundry (it's 
unknown) and "times" for my family name, and it's always failing.  
Stepping through the binary search, I see that when the family name
matches (as it does on my system, "times" is available), the 
foundries are then compared.  

This will fail, since I've got "*" for the foundry, but that 
_should_ be OK.  As soon as the foundry compare fails, the 
upper counter is incremented and we fall through the loop again.
Is this a mistake?  When the loop goes through again, the middle
position (the one that pointed to "times") is clobbered (in my
case it now points to "terminal"), and that very last chance
test at the end of the function will never test against "times"
(only "terminal").  Perhaps this would work if "times" was the
last item in the list, just by accident.

It seems it is not incorrect to continue the loop on a failed
foundry match, since you might have the font in multiple
foundries.  However, doing this will clobber that middle variable,
which points to the correct family.  Is a second search in order,
or just some more conditional exits within the first?

-- 
Shaw Terwilliger



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]