(self, xref: int, bfname: str, ext: str, ordering: int, limit: int, idx: int = 0)
| 3826 | del self._page_refs[pid] |
| 3827 | |
| 3828 | def _get_char_widths(self, xref: int, bfname: str, ext: str, ordering: int, limit: int, idx: int = 0): |
| 3829 | pdf = _as_pdf_document(self) |
| 3830 | mylimit = limit |
| 3831 | if mylimit < 256: |
| 3832 | mylimit = 256 |
| 3833 | if ordering >= 0: |
| 3834 | data, size, index = mupdf.fz_lookup_cjk_font(ordering) |
| 3835 | font = mupdf.fz_new_font_from_memory(None, data, size, index, 0) |
| 3836 | else: |
| 3837 | data, size = mupdf.fz_lookup_base14_font(bfname) |
| 3838 | if data: |
| 3839 | font = mupdf.fz_new_font_from_memory(bfname, data, size, 0, 0) |
| 3840 | else: |
| 3841 | buf = JM_get_fontbuffer(pdf, xref) |
| 3842 | if not buf.m_internal: |
| 3843 | raise Exception(f"font at xref {xref:d} is not supported") |
| 3844 | |
| 3845 | font = mupdf.fz_new_font_from_buffer(None, buf, idx, 0) |
| 3846 | wlist = [] |
| 3847 | for i in range(mylimit): |
| 3848 | glyph = mupdf.fz_encode_character(font, i) |
| 3849 | adv = mupdf.fz_advance_glyph(font, glyph, 0) |
| 3850 | if ordering >= 0: |
| 3851 | glyph = i |
| 3852 | if glyph > 0: |
| 3853 | wlist.append( (glyph, adv)) |
| 3854 | else: |
| 3855 | wlist.append( (glyph, 0.0)) |
| 3856 | return wlist |
| 3857 | |
| 3858 | def _get_page_labels(self): |
| 3859 | pdf = _as_pdf_document(self) |
no test coverage detected