Skip to content

Commit

Permalink
Only fallback mode needs the fontTools package
Browse files Browse the repository at this point in the history
  • Loading branch information
cbm755 authored and jamie-lemon committed Oct 28, 2024
1 parent 9c5fa84 commit 43a95cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5539,7 +5539,7 @@ def recover_char_quad(line_dir: tuple, span: dict, char: dict) -> pymupdf.Quad:
# Building font subsets using fontTools
# -------------------------------------------------------------------
def subset_fonts(doc: pymupdf.Document, verbose: bool = False, fallback: bool = False) -> None:
"""Build font subsets of a PDF. Requires package 'fontTools'.
"""Build font subsets in a PDF.
Eligible fonts are potentially replaced by smaller versions. Page text is
NOT rewritten and thus should retain properties like being hidden or
Expand All @@ -5548,6 +5548,7 @@ def subset_fonts(doc: pymupdf.Document, verbose: bool = False, fallback: bool =
This method by default uses MuPDF's own internal feature to create subset
fonts. As this is a new function, errors may still occur. In this case,
please fall back to using the previous version by using "fallback=True".
Fallback mode requires the external package 'fontTools'.
"""
# Font binaries: - "buffer" -> (names, xrefs, (unicodes, glyphs))
# An embedded font is uniquely defined by its fontbuffer only. It may have
Expand Down

0 comments on commit 43a95cb

Please sign in to comment.