Skip to main content

Collection of font binaries for use in PyMuPDF

Project description

Release date: September 19, 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 and (2) enable inclusion of fonts not supported as part of PyMuPDF itself. We may extend this package with more Google’s NOTO fonts and others over time.

Currently the following fonts are provided:

  • FiraGO – font family, sans serif proportional fonts with support for 68 languages and the following scripts: Latin, Cyrillic, Greek, Arabic, Hebrew, Thai, Georgian and Devanagari. Support for the variants Regular, Bold, Ialic and Bold-Italic. Use this font as a viable “universal” alternative to the “Droid Sans Fallback Regular” font, which is included in the PyMuPDF package (embedded in the binary extension module).

  • FiraMono – font family, sans serif mono-spaced fonts with support for dozens of languages and the scripts Latin, Cyrillic, Greek. Supports the weights Regular and Bold (no Italic). Can be used instead of Courier for a nicer look.

  • Space Mono – a nice and small-sized mono-spaced font family. Space Mono is an original fixed-width type family designed by Colophon Foundry for Google Design. It supports a Latin Extended glyph set, enabling typesetting for English and other Western European languages. Part of Google Fonts and also licensed under SIL OFL v1.1. Supports Regular, Bold, Italic and Bold-Italic.

  • NOTO Sans – Google font family similar to Helvetica. Supports Regular, Bold, Italic and Bold-Italic.

  • NOTO Music – Google font for musical symbols.

  • NOTO SANS Math – Google font for mathematical symbols.

  • NOTO Symbols and NOTO Symbols2 – Google symbol fonts.

  • Ubuntu font families, which provide sans-serif proportional and mono-spaced fonts with 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.

Installation

pymupdf-fonts is a pure Python package provided as a wheel. As such it is Python version independent.

Usage and Documentation

How to use fonts in general is described in detail in the PyMuPDF documentation. The basic instruction is font = fitz.Font("key"), where “key” is one of the Base-14 or CJK font codes, like “helv”, “cour” or “cjk”.

Once this package is installed, PyMuPDF makes these fonts automatically and seamlessly available as additional font codes, for example font = fitz.Font("figo") for “FiraGO Regular”. You do not need to import this package separately yourself. To see a list of additionally available font codes, type print(fitz.fitz_fontdescriptors.keys()).

But you can access font information of this package also without PyMuPDF: just import pymupdf_fonts. Its dictionary fontdescriptors equals fitz_fontdescriptors above. For example, to access the fontfile’s binary content of “FiraGO Regular”, execute fontbuffer = pymupdf_fonts.fontbuffers["figo"]() (a bytes object).

License

SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007, Open Font License. The Ubuntu fonts are licensed under the Ubuntu Font License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymupdf_fonts-1.0.4.tar.gz (3.7 MB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page