Registry / pymupdf-fonts

pymupdf-fonts

JSON →
library1.0.5pypypi✓ verified 82d ago

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
INSTALL
IMPORT
SIG · PYMUPDF-FONTS
P
pymupdf-fonts
pythonv1.0.5
harness data pending
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.
fix
Use 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.
fix
Ensure 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).
fix
Upgrade 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.
Agent activity
2 hits · last 30 days
node
2
Resources
pymupdf-fonts — pip install pymupdf-fonts · libregistry