Return a match score between *weight1* and *weight2*. The result is 0.0 if both weight1 and weight 2 are given as strings and have the same value. Otherwise, the result is the absolute value of the difference between the CSS numeric values of *weight1* and
(self, weight1, weight2)
| 1418 | return abs(stretchval1 - stretchval2) / 1000.0 |
| 1419 | |
| 1420 | def score_weight(self, weight1, weight2): |
| 1421 | """ |
| 1422 | Return a match score between *weight1* and *weight2*. |
| 1423 | |
| 1424 | The result is 0.0 if both weight1 and weight 2 are given as strings |
| 1425 | and have the same value. |
| 1426 | |
| 1427 | Otherwise, the result is the absolute value of the difference between |
| 1428 | the CSS numeric values of *weight1* and *weight2*, normalized between |
| 1429 | 0.05 and 1.0. |
| 1430 | """ |
| 1431 | # exact match of the weight names, e.g. weight1 == weight2 == "regular" |
| 1432 | if cbook._str_equal(weight1, weight2): |
| 1433 | return 0.0 |
| 1434 | w1 = _normalize_weight(weight1) |
| 1435 | w2 = _normalize_weight(weight2) |
| 1436 | return 0.95 * (abs(w1 - w2) / 1000) + 0.05 |
| 1437 | |
| 1438 | def score_size(self, size1, size2): |
| 1439 | """ |