{"id":28089,"library":"pymupdf-fonts","title":"PyMuPDF Fonts","description":"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.","status":"active","version":"1.0.5","language":"python","source_language":"en","source_url":"https://github.com/pymupdf/pymupdf-fonts","tags":["pdf","fonts","pymupdf","fitz"],"install":[{"cmd":"pip install pymupdf-fonts","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Fonts are loaded via fitz.Font in PyMuPDF.","package":"PyMuPDF","optional":false}],"imports":[{"note":"The fonts are not imported directly; they are embedded in the pymupdf-fonts package and accessed by font name string.","wrong":"","symbol":"fitz.Font","correct":"import fitz\n# then: font = fitz.Font('notosans')"}],"quickstart":{"code":"import fitz\n# Register fonts (only needed once per session)\nfitz.Font.set_fontconfig(False)  # optional, to prefer system fonts\n# Use a bundled font by name\nfont = fitz.Font('notosans')\n# Use the font in a PDF page\ndoc = fitz.open()\npage = doc.new_page()\npage.insert_text((72, 72), \"Hello World\", font=font, fontsize=12)\ndoc.save(\"output.pdf\")\ndoc.close()","lang":"python","description":"After installing pymupdf-fonts, font names like 'notosans', 'ubuntu', 'cantarell' become available to fitz.Font(). No explicit import is required."},"warnings":[{"fix":"Use lowercase strings and verify with get_font_names() before use.","message":"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.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure pymupdf-fonts is installed (pip list) and restart your Python interpreter if you installed it after starting a session.","message":"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.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade PyMuPDF to >=1.18.0 and use fitz.Font('name') syntax.","message":"In older versions of pymupdf (pre-1.18.0), fonts were referenced differently. The current recommended API is fitz.Font(name).","severity":"deprecated","affected_versions":"pymupdf < 1.18.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"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'.","cause":"pymupdf-fonts not installed or font name is incorrect.","error":"RuntimeError: font 'notosans' not found"},{"fix":"Run: pip install PyMuPDF. Then install pymupdf-fonts for additional fonts.","cause":"PyMuPDF (fitz) is not installed.","error":"ModuleNotFoundError: No module named 'pymupdf'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}