MCPcopy
hub / github.com/matplotlib/matplotlib / score_size

Method score_size

lib/matplotlib/font_manager.py:1438–1460  ·  view source on GitHub ↗

Return a match score between *size1* and *size2*. If *size2* (the size specified in the font file) is 'scalable', this function always returns 0.0, since any font size can be generated. Otherwise, the result is the absolute distance between *size1* and *siz

(self, size1, size2)

Source from the content-addressed store, hash-verified

1436 return 0.95 * (abs(w1 - w2) / 1000) + 0.05
1437
1438 def score_size(self, size1, size2):
1439 """
1440 Return a match score between *size1* and *size2*.
1441
1442 If *size2* (the size specified in the font file) is 'scalable', this
1443 function always returns 0.0, since any font size can be generated.
1444
1445 Otherwise, the result is the absolute distance between *size1* and
1446 *size2*, normalized so that the usual range of font sizes (6pt -
1447 72pt) will lie between 0.0 and 1.0.
1448 """
1449 if size2 == 'scalable':
1450 return 0.0
1451 # Size value should have already been
1452 try:
1453 sizeval1 = float(size1)
1454 except ValueError:
1455 sizeval1 = self.default_size * font_scalings[size1]
1456 try:
1457 sizeval2 = float(size2)
1458 except ValueError:
1459 return 1.0
1460 return abs(sizeval1 - sizeval2) / 72
1461
1462 def findfont(self, prop, fontext='ttf', directory=None,
1463 fallback_to_default=True, rebuild_if_missing=True):

Callers 1

_findfont_cachedMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected