()
| 775 | |
| 776 | |
| 777 | def test_subset_fonts(): |
| 778 | if os.environ.get('PYODIDE_ROOT'): |
| 779 | print('test_subset_fonts(): not running on Pyodide - ValueError: No font code \'ubuntu\' found in pymupdf-fonts.') |
| 780 | return |
| 781 | """Confirm subset_fonts is working.""" |
| 782 | if not hasattr(pymupdf, "mupdf"): |
| 783 | print("Not testing 'test_subset_fonts' in classic.") |
| 784 | return |
| 785 | text = "Just some arbitrary text." |
| 786 | arch = pymupdf.Archive() |
| 787 | css = pymupdf.css_for_pymupdf_font("ubuntu", archive=arch) |
| 788 | css += "* {font-family: ubuntu;}" |
| 789 | doc = pymupdf.open() |
| 790 | page = doc.new_page() |
| 791 | page.insert_htmlbox(page.rect, text, css=css, archive=arch) |
| 792 | doc.subset_fonts(verbose=True) |
| 793 | found = False |
| 794 | for xref in range(1, doc.xref_length()): |
| 795 | if "+Ubuntu#20Regular" in doc.xref_object(xref): |
| 796 | found = True |
| 797 | break |
| 798 | assert found is True |
| 799 | |
| 800 | |
| 801 | def test_2957_1(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…