(left, right, unscaled, unfitted, default)
| 801 | ('X', 'C', -149, -647, -640), ('-', 'J', 114, 495, 512), |
| 802 | ]) |
| 803 | def test_ft2font_get_kerning(left, right, unscaled, unfitted, default): |
| 804 | file = fm.findfont('DejaVu Sans') |
| 805 | # With unscaled, these settings should produce exact values found in FontForge. |
| 806 | font = ft2font.FT2Font(file) |
| 807 | font.set_size(100, 100) |
| 808 | assert font.get_kerning(font.get_char_index(ord(left)), |
| 809 | font.get_char_index(ord(right)), |
| 810 | ft2font.Kerning.UNSCALED) == unscaled |
| 811 | assert font.get_kerning(font.get_char_index(ord(left)), |
| 812 | font.get_char_index(ord(right)), |
| 813 | ft2font.Kerning.UNFITTED) == unfitted |
| 814 | assert font.get_kerning(font.get_char_index(ord(left)), |
| 815 | font.get_char_index(ord(right)), |
| 816 | ft2font.Kerning.DEFAULT) == default |
| 817 | with pytest.warns(mpl.MatplotlibDeprecationWarning, |
| 818 | match='Use Kerning.UNSCALED instead'): |
| 819 | k = ft2font.KERNING_UNSCALED |
| 820 | with pytest.warns(mpl.MatplotlibDeprecationWarning, |
| 821 | match='Use Kerning enum values instead'): |
| 822 | assert font.get_kerning(font.get_char_index(ord(left)), |
| 823 | font.get_char_index(ord(right)), |
| 824 | int(k)) == unscaled |
| 825 | with pytest.warns(mpl.MatplotlibDeprecationWarning, |
| 826 | match='Use Kerning.UNFITTED instead'): |
| 827 | k = ft2font.KERNING_UNFITTED |
| 828 | with pytest.warns(mpl.MatplotlibDeprecationWarning, |
| 829 | match='Use Kerning enum values instead'): |
| 830 | assert font.get_kerning(font.get_char_index(ord(left)), |
| 831 | font.get_char_index(ord(right)), |
| 832 | int(k)) == unfitted |
| 833 | with pytest.warns(mpl.MatplotlibDeprecationWarning, |
| 834 | match='Use Kerning.DEFAULT instead'): |
| 835 | k = ft2font.KERNING_DEFAULT |
| 836 | with pytest.warns(mpl.MatplotlibDeprecationWarning, |
| 837 | match='Use Kerning enum values instead'): |
| 838 | assert font.get_kerning(font.get_char_index(ord(left)), |
| 839 | font.get_char_index(ord(right)), |
| 840 | int(k)) == default |
| 841 | |
| 842 | |
| 843 | def test_ft2font_set_text(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…