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

Function test_ft2font_stix_bold_attrs

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

Source from the content-addressed store, hash-verified

103
104
105def test_ft2font_stix_bold_attrs():
106 file = fm.findfont('STIXSizeTwoSym:bold')
107 font = ft2font.FT2Font(file)
108 assert font.fname == file
109 # Names extracted from FontForge: Font Information → PS Names tab.
110 assert font.postscript_name == 'STIXSizeTwoSym-Bold'
111 assert font.family_name == 'STIXSizeTwoSym'
112 assert font.style_name == 'Bold'
113 assert font.num_faces == 1 # Single TTF.
114 assert font.num_named_instances == 0 # Not a variable font.
115 assert font.num_glyphs == 20 # From compact encoding view in FontForge.
116 assert font.num_fixed_sizes == 0 # All glyphs are scalable.
117 assert font.num_charmaps == 3
118 # Other internal flags are set, so only check the ones we're allowed to test.
119 expected_flags = (ft2font.FaceFlags.SCALABLE | ft2font.FaceFlags.SFNT |
120 ft2font.FaceFlags.HORIZONTAL | ft2font.FaceFlags.GLYPH_NAMES)
121 assert expected_flags in font.face_flags
122 assert font.style_flags == ft2font.StyleFlags.BOLD
123 assert font.scalable
124 # From FontForge: Font Information → General tab → entry name below.
125 assert font.units_per_EM == 1000 # Em Size.
126 assert font.underline_position == -133 # Underline position.
127 assert font.underline_thickness == 20 # Underline height.
128 # From FontForge: Font Information → OS/2 tab → Metrics tab → entry name below.
129 assert font.ascender == 2095 # HHead Ascent.
130 assert font.descender == -404 # HHead Descent.
131 # Unconfirmed values.
132 assert font.height == 2499
133 assert font.max_advance_width == 1130
134 assert font.max_advance_height == 2499
135 assert font.bbox == (4, -355, 1185, 2095)
136
137
138def test_ft2font_valid_args():

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…