(self, fontname, bfname, fontfile, fontbuffer, set_simple, idx, wmode, serif, encoding, ordering)
| 10158 | return img_xref, None |
| 10159 | |
| 10160 | def _insertFont(self, fontname, bfname, fontfile, fontbuffer, set_simple, idx, wmode, serif, encoding, ordering): |
| 10161 | page = self._pdf_page() |
| 10162 | pdf = page.doc() |
| 10163 | |
| 10164 | value = JM_insert_font(pdf, bfname, fontfile,fontbuffer, set_simple, idx, wmode, serif, encoding, ordering) |
| 10165 | # get the objects /Resources, /Resources/Font |
| 10166 | resources = mupdf.pdf_dict_get_inheritable(page.obj(), PDF_NAME('Resources')) |
| 10167 | if not resources.pdf_is_dict(): |
| 10168 | resources = mupdf.pdf_dict_put_dict(page.obj(), PDF_NAME("Resources"), 5) |
| 10169 | fonts = mupdf.pdf_dict_get(resources, PDF_NAME('Font')) |
| 10170 | if not fonts.m_internal: # page has no fonts yet |
| 10171 | fonts = mupdf.pdf_new_dict(pdf, 5) |
| 10172 | mupdf.pdf_dict_putl(page.obj(), fonts, PDF_NAME('Resources'), PDF_NAME('Font')) |
| 10173 | # store font in resources and fonts objects will contain named reference to font |
| 10174 | _, xref = JM_INT_ITEM(value, 0) |
| 10175 | if not xref: |
| 10176 | raise RuntimeError( "cannot insert font") |
| 10177 | font_obj = mupdf.pdf_new_indirect(pdf, xref, 0) |
| 10178 | mupdf.pdf_dict_puts(fonts, fontname, font_obj) |
| 10179 | return value |
| 10180 | |
| 10181 | def _load_annot(self, name, xref): |
| 10182 | page = self._pdf_page() |
no test coverage detected