score_family in font_manager


I'm trying to use a custom font that is set dynamically at runtime, if available. (I don't want this font to be the default in the config file.) But matplotlib keeps defaulting to the generic sans-serif font if I include that as an option later in the font family list.

In the process of troubleshooting, I found there was a commit which already addressed this issue (, although unfortunately it didn't solve it in my particular case, when the font being scored is first in the rcParams font alias list.

Seems like it could be an easy fix for someone familiar with the scoring algorithm. I don't see quite what the expected scores *should* be (the docstring for that function looks to be out of sync) but it shouldn't be 0 for default fonts not explicitly named first in the family list. I'll put this in the bug tracker and try to workaround for now.