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

Function JM_make_text_block

src/__init__.py:20703–20723  ·  view source on GitHub ↗
(block, block_dict, raw, buff, tp_rect)

Source from the content-addressed store, hash-verified

20701
20702
20703def JM_make_text_block(block, block_dict, raw, buff, tp_rect):
20704 if 1 or g_use_extra:
20705 return extra.JM_make_text_block(block.m_internal, block_dict, raw, buff.m_internal, tp_rect.m_internal)
20706 line_list = []
20707 block_rect = mupdf.FzRect(mupdf.FzRect.Fixed_EMPTY)
20708 #log(f'{block=}')
20709 for line in block:
20710 #log(f'{line=}')
20711 if (mupdf.fz_is_empty_rect(mupdf.fz_intersect_rect(tp_rect, mupdf.FzRect(line.m_internal.bbox)))
20712 and not mupdf.fz_is_infinite_rect(tp_rect)
20713 ):
20714 continue
20715 line_dict = dict()
20716 line_rect = JM_make_spanlist(line_dict, line, raw, buff, tp_rect)
20717 block_rect = mupdf.fz_union_rect(block_rect, line_rect)
20718 line_dict[dictkey_wmode] = line.m_internal.wmode
20719 line_dict[dictkey_dir] = JM_py_from_point(line.m_internal.dir)
20720 line_dict[dictkey_bbox] = JM_py_from_rect(line_rect)
20721 line_list.append(line_dict)
20722 block_dict[dictkey_bbox] = JM_py_from_rect(block_rect)
20723 block_dict[dictkey_lines] = line_list
20724
20725
20726def JM_make_textpage_dict(tp, page_dict, raw):

Callers 1

JM_make_textpage_dictFunction · 0.85

Calls 4

JM_make_spanlistFunction · 0.85
JM_py_from_pointFunction · 0.85
JM_py_from_rectFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…