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

Function test_get_font_names

lib/matplotlib/tests/test_font_manager.py:391–410  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

389
390@pytest.mark.skipif(sys.platform == 'win32', reason='Linux or OS only')
391def test_get_font_names():
392 paths_mpl = [cbook._get_data_path('fonts', subdir) for subdir in ['ttf']]
393 fonts_mpl = findSystemFonts(paths_mpl, fontext='ttf')
394 fonts_system = findSystemFonts(fontext='ttf')
395 ttf_fonts = set()
396 for path in fonts_mpl + fonts_system:
397 try:
398 font = ft2font.FT2Font(path)
399 prop = ttfFontProperty(font)
400 ttf_fonts.add(prop.name)
401 for face_index in range(1, font.num_faces):
402 font = ft2font.FT2Font(path, face_index=face_index)
403 prop = ttfFontProperty(font)
404 ttf_fonts.add(prop.name)
405 except Exception:
406 pass
407 # fontManager may contain additional entries for alternative family names
408 # (e.g. typographic family, platform-specific Name ID 1) registered by
409 # addfont(), so primary names must be a subset of the manager's names.
410 assert ttf_fonts <= set(fontManager.get_font_names())
411
412
413def test_addfont_alternative_names(tmp_path):

Callers

nothing calls this directly

Calls 4

findSystemFontsFunction · 0.90
ttfFontPropertyFunction · 0.90
get_font_namesMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…