Package: pymupdf-fonts
pymupdf-fontsCollection of optional fonts for PyMuPDFRelease date: December 27, 2021AuthorJorj X. McKieIntroductionThis 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:keep the PyMuPDF binary module size within reasonable limits by not adding more fonts to it, andenable 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:FiraGOfont family made by Mozilla.org. These are sans-serifproportionalfonts with support for 68 languages and the following scripts: Latin, Cyrillic, Greek, Arabic, Hebrew, Thai, Georgian and Devanagari. They support the weightsRegular,Bold,IalicandBold-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).FiraMonofont family made by Mozilla.org, sans serifmono-spacedfonts with support for dozens of languages and the scripts Latin, Cyrillic, Greek. Supports the weightsRegularandBold, but no italics. Can be used instead of Courier for a nicer look.Space Mono(my personal favorite) a nice and small-sizedmono-spacedfont 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 theOpen Font License. SupportsRegular,Bold,ItalicandBold-Italic. Can be used instead of Courier for a nicer look.Noto Sans Math Regulara NOTO font from Google providing mathematical symbols.Noto Music Regulara NOTO font from Google providing musical symbols.Noto Sans Symbols Regulara Google NOTO replacement for the Base-14 Symbol font.Noto Sans Symbols2 Regularan extension for the previous.Noto Sansa Google NOTO font family replacement for Helvetica / Arial, which support all four weights regular, bold, italics and bold-italics.Ubuntufont 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 Monomono-spaced font family made by Microsoft. SupportsRegular,Bold,ItalicandBold-Italic. Can be used instead of Courier for a nicer look. License SIL OFL v1.1.Installationpymupdf_fonts is a pure Python package provided as a wheel. As such it is Python version independent and can be installed viapython -m pip install pymupdf-fonts.Usage and DocumentationIf the package is installed, PyMuPDF supports all the fonts automatically. To use one of these fonts, simply executefont = fitz.Font("code"), wherecodeis 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 thefontobject directly in PyMuPDF'sTextWriterclass, oruse its bufferin the conventionalPage.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 theFontclass.codefontversioncommentfigoFiraGO_Regular1.0.0figboFiraGO_Bold1.0.0figitFiraGO_Italic1.0.0figbiFiraGO_BoldItalic1.0.0fimoFiraMono_Regular1.0.0fimboFiraMono_Bold1.0.0spacemoSpaceMono_Regular1.0.1mono-spacedspacemboSpaceMono_Bold1.0.1mono boldspacemitSpaceMono_Italic1.0.1mono italicspacembiSpaceMono_BoldItalic1.0.1mono bold-italicmathNoto Sans Math Regular1.0.2math symbolsmusicNoto Music Regular1.0.2musical symbolssymbol1Noto Sans Symbols Regular1.0.2replaces "symb"symbol2Noto Sans Symbols2 Regular1.0.2extended symbolsnotosNoto Sans Regular1.0.3similar to ArialnotosbiNoto Sans Italic1.0.3notosboNoto Sans Bold1.0.3notosbiNoto Sans Bold Italic1.0.3ubuntuUbuntu Regular1.0.4sans-serif, for texts in Ubuntu lookubuntuboUbuntu Bold1.0.4ubuntubiUbuntu Bold Italic1.0.4ubuntuitUbuntu Italic1.0.4ubuntmUbuntu Mono Regular1.0.4mono-spaced version of Ubuntu fontsubuntmboUbuntu Mono Bold1.0.4ubuntmbiUbuntu Mono Bold Italic1.0.4ubuntmitUbuntu Mono Italic1.0.4cascadiaCascadia Mono Regular1.0.5cascadiabCascadia Mono Bold1.0.5cascadiaiCascadia Mono Italic1.0.5cascadiabiCascadia Mono BoldItalic1.0.5LicenseMost of the fonts above are licensed under the SIL OFL v1.1 license, which is stored as fileLICENSE.txtin this repository.
The Ubuntu fonts are available under a similar free license, to be found here:Ubuntu Font License.