MCPcopy
hub / github.com/matplotlib/matplotlib / test__layout

Function test__layout

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

Source from the content-addressed store, hash-verified

1017
1018
1019def test__layout():
1020 fonts, test_str = _gen_multi_font_text()
1021 # Add some glyphs that don't exist in either font to check the Last Resort fallback.
1022 missing_glyphs = '\n几个汉字'
1023 test_str += missing_glyphs
1024
1025 ft = fm.get_font(
1026 fm.fontManager._find_fonts_by_props(fm.FontProperties(family=fonts))
1027 )
1028 for substr in test_str.split('\n'):
1029 for item in ft._layout(substr, ft2font.LoadFlags.DEFAULT):
1030 if item.char in missing_glyphs:
1031 assert Path(item.ft_object.fname).name == 'LastResortHE-Regular.ttf'
1032 elif ord(item.char) > 127:
1033 assert Path(item.ft_object.fname).name == 'DejaVuSans.ttf'
1034 else:
1035 assert Path(item.ft_object.fname).name == 'cmr10.ttf'

Callers

nothing calls this directly

Calls 4

_gen_multi_font_textFunction · 0.90
PathClass · 0.85
get_fontMethod · 0.80
_find_fonts_by_propsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…