MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_3933

Function test_3933

tests/test_font.py:163–185  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

161
162
163def test_3933():
164 path = os.path.normpath(f'{__file__}/../../tests/resources/test_3933.pdf')
165 with pymupdf.open(path) as document:
166 page = document[0]
167 print(f'{len(page.get_fonts())=}')
168
169 expected = {
170 'BCDEEE+Calibri': 39,
171 'BCDFEE+SwissReSan-Regu': 53,
172 'BCDGEE+SwissReSan-Ital': 20,
173 'BCDHEE+SwissReSan-Bold': 20,
174 'BCDIEE+SwissReSan-Regu': 53,
175 'BCDJEE+Calibri': 39,
176 }
177
178 for xref, _, _, name, _, _ in page.get_fonts():
179 _, _, _, content = document.extract_font(xref)
180
181 if content:
182 font = pymupdf.Font(fontname=name, fontbuffer=content)
183 supported_symbols = font.valid_codepoints()
184 print(f'Font {name}: {len(supported_symbols)=}.', flush=1)
185 assert len(supported_symbols) == expected.get(name)
186
187
188def test_3780():

Callers

nothing calls this directly

Calls 4

valid_codepointsMethod · 0.95
get_fontsMethod · 0.80
extract_fontMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…