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

Function test_ft2font_cm_attrs

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

Source from the content-addressed store, hash-verified

70
71
72def test_ft2font_cm_attrs():
73 file = fm.findfont('cmtt10')
74 font = ft2font.FT2Font(file)
75 assert font.fname == file
76 # Names extracted from FontForge: Font Information → PS Names tab.
77 assert font.postscript_name == 'Cmtt10'
78 assert font.family_name == 'cmtt10'
79 assert font.style_name == 'Regular'
80 assert font.num_faces == 1 # Single TTF.
81 assert font.num_named_instances == 0 # Not a variable font.
82 assert font.num_glyphs == 133 # From compact encoding view in FontForge.
83 assert font.num_fixed_sizes == 0 # All glyphs are scalable.
84 assert font.num_charmaps == 2
85 # Other internal flags are set, so only check the ones we're allowed to test.
86 expected_flags = (ft2font.FaceFlags.SCALABLE | ft2font.FaceFlags.SFNT |
87 ft2font.FaceFlags.HORIZONTAL | ft2font.FaceFlags.GLYPH_NAMES)
88 assert expected_flags in font.face_flags
89 assert font.style_flags == ft2font.StyleFlags.NORMAL
90 assert font.scalable
91 # From FontForge: Font Information → General tab → entry name below.
92 assert font.units_per_EM == 2048 # Em Size.
93 assert font.underline_position == -143 # Underline position.
94 assert font.underline_thickness == 20 # Underline height.
95 # From FontForge: Font Information → OS/2 tab → Metrics tab → entry name below.
96 assert font.ascender == 1276 # HHead Ascent.
97 assert font.descender == -489 # HHead Descent.
98 # Unconfirmed values.
99 assert font.height == 1765
100 assert font.max_advance_width == 1536
101 assert font.max_advance_height == 1765
102 assert font.bbox == (-12, -477, 1280, 1430)
103
104
105def test_ft2font_stix_bold_attrs():

Callers

nothing calls this directly

Calls 1

findfontMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…