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

Function test_ft2font_set_text

lib/matplotlib/tests/test_ft2font.py:843–862  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

841
842
843def test_ft2font_set_text():
844 file = fm.findfont('DejaVu Sans')
845 font = ft2font.FT2Font(file)
846 font.set_size(12, 72)
847 xys = font.set_text('')
848 np.testing.assert_array_equal(xys, np.empty((0, 2)))
849 assert font.get_width_height() == (0, 0)
850 assert font.get_num_glyphs() == 0
851 assert font.get_descent() == 0
852 assert font.get_bitmap_offset() == (0, 0)
853 # This string uses all the kerning pairs defined for test_ft2font_get_kerning.
854 xys = font.set_text('AADAT.XC-J')
855 np.testing.assert_array_equal(
856 xys,
857 [(0, 0), (533, 0), (1045, 0), (1608, 0), (2060, 0), (2417, 0), (2609, 0),
858 (3065, 0), (3577, 0), (3940, 0)])
859 assert font.get_width_height() == (4196, 768)
860 assert font.get_num_glyphs() == 10
861 assert font.get_descent() == 192
862 assert font.get_bitmap_offset() == (6, 0)
863
864
865@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

findfontMethod · 0.80
get_width_heightMethod · 0.80
set_sizeMethod · 0.45
set_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…