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

Function test_3780

tests/test_font.py:188–209  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

186
187
188def test_3780():
189 path = os.path.normpath(f'{__file__}/../../tests/resources/test_3780.pdf')
190 with pymupdf.open(path) as document:
191 for page_i, page in enumerate(document):
192 for itm in page.get_fonts():
193 buff=document.extract_font(itm[0])[-1]
194 font=pymupdf.Font(fontbuffer=buff)
195 print(f'{page_i=}: xref {itm[0]} {font.name=} {font.ascender=} {font.descender=}.')
196 if page_i == 0:
197 d = page.get_text('dict')
198 #for n, v in d.items():
199 # print(f' {n}: {v!r}')
200 for i, block in enumerate(d['blocks']):
201 print(f'block {i}:')
202 if block['type'] != 0:
203 continue
204 for j, line in enumerate(block['lines']):
205 print(f' line {j}:')
206 for k, span in enumerate(line['spans']):
207 print(f' span {k}:')
208 for n, v in span.items():
209 print(f' {n}: {v!r}')
210
211
212def test_3887():

Callers

nothing calls this directly

Calls 3

get_fontsMethod · 0.80
extract_fontMethod · 0.80
get_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…