You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug in font_manager.FontManager.score_family() #4607
and the issue I'm having occurs when idx is 0. The previous commit addressed the right multiplicand, changing i to i+1 so that it would never be 0, but the overall result is still 0 when the left side is 0.
I could make a PR, but I'm still not sure the right way to fix this scoring algorithm. I think it's broken in more ways than just changing to (idx + 1) would fix.
For example, assume I have a font family list of ['font1', 'font2', 'sans-serif'], then any font that is part of the sans-serif alias will score at most 0.1, which is lower (better) than font2.
Activity
chadawagner commentedon Jul 8, 2015
The code for the returned score is currently
and the issue I'm having occurs when idx is 0. The previous commit addressed the right multiplicand, changing
itoi+1so that it would never be 0, but the overall result is still 0 when the left side is 0.mdboom commentedon Jul 9, 2015
Yeah -- I think changing to (idx + 1) makes sense here.
tacaswell commentedon Jul 10, 2015
@chadawagner Would you like to put in a PR to fix this?
chadawagner commentedon Jul 10, 2015
I could make a PR, but I'm still not sure the right way to fix this scoring algorithm. I think it's broken in more ways than just changing to
(idx + 1)would fix.For example, assume I have a font family list of
['font1', 'font2', 'sans-serif'], then any font that is part of the sans-serif alias will score at most 0.1, which is lower (better) than font2.chadawagner commentedon Jul 11, 2015
How about
That way the returned score is always in the half-open interval
[ i/len(families), (i+1)/len(families) )mdboom commentedon Mar 21, 2016
Fixed by #4689