Skip to main content

pymupdf-fonts

Collection of optional fonts for PyMuPDF

Release date: December 27, 2021

Author

  • Jorj X. McKie

Introduction

This is a collection of fonts that can be used by PyMuPDF applications for writing text to PDFs.

The fonts are provided encoded in compressed base64 format, wrapped as Python variables.

The primary motivation for this approach is two-fold:

  1. keep the PyMuPDF binary module size within reasonable limits by not adding more fonts to it, and
  2. enable the inclusion of arbitrary fonts that are not contained in the MuPDF library. We also may extend this repository with selected fonts.

Currently the following fonts are provided:

  • FiraGO font family made by Mozilla.org. These are sans-serif proportional fonts with support for 68 languages and the following scripts: Latin, Cyrillic, Greek, Arabic, Hebrew, Thai, Georgian and Devanagari. They support the weights Regular, Bold, Ialic and Bold-Italic. If you do not need Asian script support (CJK), use it as a viable "universal" alternative to the "Droid Sans Fallback Regular" font (which is part of PyMuPDF's binary).
  • FiraMono font family made by Mozilla.org, sans serif mono-spaced fonts with support for dozens of languages and the scripts Latin, Cyrillic, Greek. Supports the weights Regular and Bold, but no italics. Can be used instead of Courier for a nicer look.
  • Space Mono (my personal favorite) a nice and small-sized mono-spaced font family. It is an original fixed-width type family designed by Colophon Foundry for Google Design. It supports a Latin Extended glyph set, enables typesetting for English and other Western European languages. Part of Google Fonts and also licensed under the Open Font License. Supports Regular, Bold, Italic and Bold-Italic. Can be used instead of Courier for a nicer look.
  • Noto Sans Math Regular a NOTO font from Google providing mathematical symbols.
  • Noto Music Regular a NOTO font from Google providing musical symbols.
  • Noto Sans Symbols Regular a Google NOTO replacement for the Base-14 Symbol font.
  • Noto Sans Symbols2 Regular an extension for the previous.
  • Noto Sans a Google NOTO font family replacement for Helvetica / Arial, which support all four weights regular, bold, italics and bold-italics.
  • Ubuntu font families of sans-serif proportional and mono-spaced fonts, that provide a look familiar to Ubuntu users. They are licensed under a slightly different license - see below - which nonetheless offers a similar degree of freedom as the OFL.
  • Cascadia Mono mono-spaced font family made by Microsoft. Supports Regular, Bold, Italic and Bold-Italic. Can be used instead of Courier for a nicer look. License SIL OFL v1.1.

Installation

pymupdf_fonts is a pure Python package provided as a wheel. As such it is Python version independent and can be installed via python -m pip install pymupdf-fonts.

Usage and Documentation

If the package is installed, PyMuPDF supports all the fonts automatically. To use one of these fonts, simply execute font = fitz.Font("code"), where code is a value from the first table column below. So this works as if the list of standard font codes ""helv", "tiro", "cour", etc. had been extended by new codes.

You can then either use the font object directly in PyMuPDF's TextWriter class, or use its buffer in the conventional Page.insert_font() / Page.insert_text() / Page.insert_textbox() methods like this:

page.insert_font(fontname="F0", fontbuffer=font.buffer)
page.insert_text(point, text, fontname="F0", ...)
# or similarly:
page.insert_textbox(rect, text, fontname="F0", ...)

For more detail consult the PyMuPDF documentation of the Font class.

code font version comment
figo FiraGO_Regular 1.0.0
figbo FiraGO_Bold 1.0.0
figit FiraGO_Italic 1.0.0
figbi FiraGO_BoldItalic 1.0.0
fimo FiraMono_Regular 1.0.0
fimbo FiraMono_Bold 1.0.0
spacemo SpaceMono_Regular 1.0.1 mono-spaced
spacembo SpaceMono_Bold 1.0.1 mono bold
spacemit SpaceMono_Italic 1.0.1 mono italic
spacembi SpaceMono_BoldItalic 1.0.1 mono bold-italic
math Noto Sans Math Regular 1.0.2 math symbols
music Noto Music Regular 1.0.2 musical symbols
symbol1 Noto Sans Symbols Regular 1.0.2 replaces "symb"
symbol2 Noto Sans Symbols2 Regular 1.0.2 extended symbols
notos Noto Sans Regular 1.0.3 similar to Arial
notosbi Noto Sans Italic 1.0.3
notosbo Noto Sans Bold 1.0.3
notosbi Noto Sans Bold Italic 1.0.3
ubuntu Ubuntu Regular 1.0.4 sans-serif, for texts in Ubuntu look
ubuntubo Ubuntu Bold 1.0.4
ubuntubi Ubuntu Bold Italic 1.0.4
ubuntuit Ubuntu Italic 1.0.4
ubuntm Ubuntu Mono Regular 1.0.4 mono-spaced version of Ubuntu fonts
ubuntmbo Ubuntu Mono Bold 1.0.4
ubuntmbi Ubuntu Mono Bold Italic 1.0.4
ubuntmit Ubuntu Mono Italic 1.0.4
cascadia Cascadia Mono Regular 1.0.5
cascadiab Cascadia Mono Bold 1.0.5
cascadiai Cascadia Mono Italic 1.0.5
cascadiabi Cascadia Mono BoldItalic 1.0.5

License

Most of the fonts above are licensed under the SIL OFL v1.1 license, which is stored as file LICENSE.txt in this repository. The Ubuntu fonts are available under a similar free license, to be found here: Ubuntu Font License.

Metadata

Release files for pymupdf-fonts 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymupdf-fonts 1.0.5
File Size Uploaded Provenance
pymupdf_fonts-1.0.5.tar.gz 4.2 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pymupdf-fonts 1.0.5
File Interpreter ABI Platform
pymupdf_fonts-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 8.5 MB

Release files / pymupdf_fonts-1.0.5.tar.gz

Download URL pymupdf_fonts-1.0.5.tar.gz
Size 4.2 MB
Tags Source
SHA-256 checksum
How to use checksums
ac12e3ec4affa35e9a0aca29135ef41c23bdbe5758c3355dac236986309e6bc6
BLAKE2b-256 checksum
How to use checksums
e715e4f3b2acecf4209ff593e85b3646f224093a08f6e9824230a3d11885407d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release files / pymupdf_fonts-1.0.5-py3-none-any.whl

Download URL pymupdf_fonts-1.0.5-py3-none-any.whl
Size 4.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8e4bb70a4a8f6bb895ef8f3b77b98f6c43e2f39c31cfdec5fd21c3d512c38b25
BLAKE2b-256 checksum
How to use checksums
80a31701c6109a1cf31f4c24156f3242db0afe669fecedf4d27c72e3b7e67591
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Security for pymupdf-fonts 1.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page