MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / score_stretch

Method score_stretch

lib/matplotlib/font_manager.py:1402–1418  ·  view source on GitHub ↗

Return a match score between *stretch1* and *stretch2*. The result is the absolute value of the difference between the CSS numeric values of *stretch1* and *stretch2*, normalized between 0.0 and 1.0.

(self, stretch1, stretch2)

Source from the content-addressed store, hash-verified

1400 return 1.0
1401
1402 def score_stretch(self, stretch1, stretch2):
1403 """
1404 Return a match score between *stretch1* and *stretch2*.
1405
1406 The result is the absolute value of the difference between the
1407 CSS numeric values of *stretch1* and *stretch2*, normalized
1408 between 0.0 and 1.0.
1409 """
1410 try:
1411 stretchval1 = int(stretch1)
1412 except ValueError:
1413 stretchval1 = stretch_dict.get(stretch1, 500)
1414 try:
1415 stretchval2 = int(stretch2)
1416 except ValueError:
1417 stretchval2 = stretch_dict.get(stretch2, 500)
1418 return abs(stretchval1 - stretchval2) / 1000.0
1419
1420 def score_weight(self, weight1, weight2):
1421 """

Callers 1

_findfont_cachedMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected