PyMuPDF Fonts
raw JSON → 1.0.5 verified Sat May 09 auth: no python
A companion package to PyMuPDF that provides a collection of font binaries (e.g., Noto, Ubuntu, Cantarell) for use with fitz.Font. Currently at version 1.0.5; maintained irregularly alongside PyMuPDF releases.
pip install pymupdf-fonts Common errors
error RuntimeError: font 'notosans' not found ↓
cause pymupdf-fonts not installed or font name is incorrect.
fix
Run: pip install pymupdf-fonts. Then verify font names: python -c "import fitz; print(fitz.Font.get_font_names())". Use lowercase, e.g., 'notosans'.
error ModuleNotFoundError: No module named 'pymupdf' ↓
cause PyMuPDF (fitz) is not installed.
fix
Run: pip install PyMuPDF. Then install pymupdf-fonts for additional fonts.
Warnings
gotcha Font 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. ↓
fix Use lowercase strings and verify with get_font_names() before use.
gotcha The 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. ↓
fix Ensure pymupdf-fonts is installed (pip list) and restart your Python interpreter if you installed it after starting a session.
deprecated In older versions of pymupdf (pre-1.18.0), fonts were referenced differently. The current recommended API is fitz.Font(name). ↓
fix Upgrade PyMuPDF to >=1.18.0 and use fitz.Font('name') syntax.
Imports
- fitz.Font
import fitz # then: font = fitz.Font('notosans')
Quickstart
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()