| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Font kerning factor is deprecated | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Due to internal changes to support complex text rendering, the kerning factor on fonts is | ||
| no longer used. Setting the ``text.kerning_factor`` rcParam (which existed only for | ||
| backwards-compatibility) to any value other than None is deprecated, and the rcParam will | ||
| be removed in the future. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -168,6 +168,12 @@ def test_ft2font_invalid_args(tmp_path): | |
| # kerning_factor argument. | ||
| with pytest.raises(TypeError, match='incompatible constructor arguments'): | ||
| ft2font.FT2Font(file, _kerning_factor=1.3) | ||
| with pytest.warns(mpl.MatplotlibDeprecationWarning, | ||
| match='text.kerning_factor rcParam was deprecated .+ 3.11'): | ||
| mpl.rcParams['text.kerning_factor'] = 0 | ||
| with pytest.warns(mpl.MatplotlibDeprecationWarning, | ||
| match='_kerning_factor parameter was deprecated .+ 3.11'): | ||
| ft2font.FT2Font(file, _kerning_factor=123) | ||
|
|
||
|
|
||
| def test_ft2font_clear(): | ||
| Expand All | @@ -188,7 +194,7 @@ def test_ft2font_clear(): | |
|
|
||
| def test_ft2font_set_size(): | ||
| file = fm.findfont('DejaVu Sans') | ||
| font = ft2font.FT2Font(file, hinting_factor=1, _kerning_factor=1) | ||
|
Comment thread
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis being 1 seems to have been a typo. Since the test checks relative results, it made no difference here.
Sorry, something went wrong.
All reactions
|
||
| font = ft2font.FT2Font(file, hinting_factor=1) | ||
| font.set_size(12, 72) | ||
| font.set_text('ABabCDcd') | ||
| orig = font.get_width_height() | ||
| Expand Down Expand Up | @@ -717,7 +723,7 @@ def test_ft2font_get_sfnt_table(font_name, header): | |
| def test_ft2font_get_kerning(left, right, unscaled, unfitted, default): | ||
| file = fm.findfont('DejaVu Sans') | ||
| # With unscaled, these settings should produce exact values found in FontForge. | ||
| font = ft2font.FT2Font(file, hinting_factor=1, _kerning_factor=0) | ||
| font = ft2font.FT2Font(file, hinting_factor=1) | ||
| font.set_size(100, 100) | ||
| assert font.get_kerning(font.get_char_index(ord(left)), | ||
| font.get_char_index(ord(right)), | ||
| Expand Down Expand Up | @@ -756,7 +762,7 @@ def test_ft2font_get_kerning(left, right, unscaled, unfitted, default): | |
|
|
||
| def test_ft2font_set_text(): | ||
| file = fm.findfont('DejaVu Sans') | ||
| font = ft2font.FT2Font(file, hinting_factor=1, _kerning_factor=0) | ||
| font = ft2font.FT2Font(file, hinting_factor=1) | ||
| font.set_size(12, 72) | ||
| xys = font.set_text('') | ||
| np.testing.assert_array_equal(xys, np.empty((0, 2))) | ||
| Expand All | @@ -778,7 +784,7 @@ def test_ft2font_set_text(): | |
|
|
||
| def test_ft2font_loading(): | ||
| file = fm.findfont('DejaVu Sans') | ||
| font = ft2font.FT2Font(file, hinting_factor=1, _kerning_factor=0) | ||
| font = ft2font.FT2Font(file, hinting_factor=1) | ||
| font.set_size(12, 72) | ||
| for glyph in [font.load_char(ord('M')), | ||
| font.load_glyph(font.get_char_index(ord('M')))]: | ||
| Expand Down Expand Up | @@ -819,13 +825,13 @@ def test_ft2font_drawing(): | |
| ]) | ||
| expected *= 255 | ||
| file = fm.findfont('DejaVu Sans') | ||
| font = ft2font.FT2Font(file, hinting_factor=1, _kerning_factor=0) | ||
| font = ft2font.FT2Font(file, hinting_factor=1) | ||
| font.set_size(12, 72) | ||
| font.set_text('M') | ||
| font.draw_glyphs_to_bitmap(antialiased=False) | ||
| image = font.get_image() | ||
| np.testing.assert_array_equal(image, expected) | ||
| font = ft2font.FT2Font(file, hinting_factor=1, _kerning_factor=0) | ||
| font = ft2font.FT2Font(file, hinting_factor=1) | ||
| font.set_size(12, 72) | ||
| glyph = font.load_char(ord('M')) | ||
| image = np.zeros(expected.shape, np.uint8) | ||
| Expand All | @@ -835,7 +841,7 @@ def test_ft2font_drawing(): | |
|
|
||
| def test_ft2font_get_path(): | ||
| file = fm.findfont('DejaVu Sans') | ||
| font = ft2font.FT2Font(file, hinting_factor=1, _kerning_factor=0) | ||
| font = ft2font.FT2Font(file, hinting_factor=1) | ||
| font.set_size(12, 72) | ||
| vertices, codes = font.get_path() | ||
| assert vertices.shape == (0, 2) | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI decided to remove this plot from the old what's new, as it will no longer show any difference between it and the plot below (with the correct results) once we switch to libraqm, and so it might be misleading.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.