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

Function test_ft2font_dejavu_attrs

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

Source from the content-addressed store, hash-verified

36
37
38def test_ft2font_dejavu_attrs():
39 file = fm.findfont('DejaVu Sans')
40 font = ft2font.FT2Font(file)
41 assert font.fname == file
42 # Names extracted from FontForge: Font Information → PS Names tab.
43 assert font.postscript_name == 'DejaVuSans'
44 assert font.family_name == 'DejaVu Sans'
45 assert font.style_name == 'Book'
46 assert font.num_faces == 1 # Single TTF.
47 assert font.num_named_instances == 0 # Not a variable font.
48 assert font.num_glyphs == 6241 # From compact encoding view in FontForge.
49 assert font.num_fixed_sizes == 0 # All glyphs are scalable.
50 assert font.num_charmaps == 5
51 # Other internal flags are set, so only check the ones we're allowed to test.
52 expected_flags = (ft2font.FaceFlags.SCALABLE | ft2font.FaceFlags.SFNT |
53 ft2font.FaceFlags.HORIZONTAL | ft2font.FaceFlags.KERNING |
54 ft2font.FaceFlags.GLYPH_NAMES)
55 assert expected_flags in font.face_flags
56 assert font.style_flags == ft2font.StyleFlags.NORMAL
57 assert font.scalable
58 # From FontForge: Font Information → General tab → entry name below.
59 assert font.units_per_EM == 2048 # Em Size.
60 assert font.underline_position == -175 # Underline position.
61 assert font.underline_thickness == 90 # Underline height.
62 # From FontForge: Font Information → OS/2 tab → Metrics tab → entry name below.
63 assert font.ascender == 1901 # HHead Ascent.
64 assert font.descender == -483 # HHead Descent.
65 # Unconfirmed values.
66 assert font.height == 2384
67 assert font.max_advance_width == 3838
68 assert font.max_advance_height == 2384
69 assert font.bbox == (-2090, -948, 3673, 2524)
70
71
72def test_ft2font_cm_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…