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

Function test_ft2font_loading

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

Source from the content-addressed store, hash-verified

894
895
896def test_ft2font_loading():
897 file = fm.findfont('DejaVu Sans')
898 font = ft2font.FT2Font(file)
899 font.set_size(12, 72)
900 for glyph in [font.load_char(ord('M')),
901 font.load_glyph(font.get_char_index(ord('M')))]:
902 assert glyph is not None
903 assert glyph.width == 576
904 assert glyph.height == 576
905 assert glyph.horiBearingX == 0
906 assert glyph.horiBearingY == 576
907 assert glyph.horiAdvance == 640
908 assert glyph.linearHoriAdvance == 678528
909 assert glyph.vertBearingX == -384
910 assert glyph.vertBearingY == 64
911 assert glyph.vertAdvance == 832
912 assert glyph.bbox == (54, 0, 574, 576)
913 assert font.get_num_glyphs() == 2 # Both count as loaded.
914 # But neither has been placed anywhere.
915 assert font.get_width_height() == (0, 0)
916 assert font.get_descent() == 0
917 assert font.get_bitmap_offset() == (0, 0)
918
919
920def test_ft2font_drawing():

Callers

nothing calls this directly

Calls 4

findfontMethod · 0.80
get_char_indexMethod · 0.80
get_width_heightMethod · 0.80
set_sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…