Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
fitzfont
✓ from pymupdf_fonts import fitzfont
✗ import fitz
After installing pymupdf-fonts, font names like 'notosans', 'ubuntu', 'cantarell' become available to fitz.Font(). No explicit import is required.
import fitz
# Register fonts (only needed once per session)
fitz.Font.set_fontconfig(False) # optional, to prefer system fonts
# Use a bundled font by name
font = fitz.Font('notosans')
# Use the font in a PDF page
doc = fitz.open()
page = doc.new_page()
page.insert_text((72, 72), "Hello World", font=font, fontsize=12)
doc.save("output.pdf")
doc.close()
Debug
Known issues
gotchaFont names are case-insensitive but must be exact; e.g., 'notosans' works but 'NotoSans' may not. Check the list of available fonts via fitz.Font.get_font_names() after installing pymupdf-fonts.fixUse lowercase strings and verify with get_font_names() before use.
affects: all
gotchaThe pymupdf-fonts package does not auto-register fonts on import; you must install it alongside PyMuPDF and then font names are available as if built-in.fixEnsure pymupdf-fonts is installed (pip list) and restart your Python interpreter if you installed it after starting a session.
affects: all
deprecatedIn older versions of pymupdf (pre-1.18.0), fonts were referenced differently. The current recommended API is fitz.Font(name).fixUpgrade PyMuPDF to >=1.18.0 and use fitz.Font('name') syntax. affects: pymupdf < 1.18.0
Upgrade
Version history
1.0.5latest on PyPI · released Dec 27, 2021
Audit
Dependencies
PyMuPDFrequiredFonts are loaded via fitz.Font in PyMuPDF.