|
27 | 27 | Matplotlib supports three font specifications (in addition to pdf 'core fonts', |
28 | 28 | which are explained later in the guide): |
29 | 29 |
|
30 | | -.. list-table:: Type of Fonts |
31 | | - :header-rows: 1 |
32 | | -
|
33 | | - * - Type 1 (PDF) |
34 | | - - Type 3 (PDF/PS) |
35 | | - - TrueType (PDF) |
36 | | - * - One of the oldest types, introduced by Adobe |
37 | | - - Similar to Type 1 in terms of introduction |
38 | | - - Newer than previous types, used commonly today, introduced by Apple |
39 | | - * - Restricted subset of PostScript, charstrings are in bytecode |
40 | | - - Full PostScript language, allows embedding arbitrary code |
41 | | - (in theory, even render fractals when rasterizing!) |
42 | | - - Include a virtual machine that can execute code! |
43 | | - * - These fonts support font hinting |
44 | | - - Do not support font hinting |
45 | | - - Hinting supported (virtual machine processes the "hints") |
46 | | - * - Non-subsetted through Matplotlib |
47 | | - - Subsetted via external module ttconv |
48 | | - - Subsetted via external module |
49 | | - `fontTools <https://github.com/fonttools/fonttools>`__ |
| 30 | +.. table:: Type of Fonts |
| 31 | +
|
| 32 | + +--------------------------+----------------------------+----------------------------+ |
| 33 | + | Type 1 (PDF with usetex) | Type 3 (PDF/PS) | TrueType (PDF) | |
| 34 | + +==========================+============================+============================+ |
| 35 | + | One of the oldest types, | Similar to Type 1 in | Newer than previous types, | |
| 36 | + | introduced by Adobe | terms of introduction | used commonly today, | |
| 37 | + | | | introduced by Apple | |
| 38 | + +--------------------------+----------------------------+----------------------------+ |
| 39 | + | Restricted subset of | Full PostScript language, | Includes a virtual machine | |
| 40 | + | PostScript, charstrings | allows embedding arbitrary | that can execute code! | |
| 41 | + | are in bytecode | code (in theory, even | | |
| 42 | + | | render fractals when | | |
| 43 | + | | rasterizing!) | | |
| 44 | + +--------------------------+----------------------------+----------------------------+ |
| 45 | + | Supports font | Does not support font | Supports font hinting | |
| 46 | + | hinting | hinting | (virtual machine processes | |
| 47 | + | | | the "hints") | |
| 48 | + +--------------------------+----------------------------+----------------------------+ |
| 49 | + | Subsetted by code in | Subsetted via external module | |
| 50 | + | `matplotlib._type1font` | `fontTools <https://github.com/fonttools/fonttools>`__ | |
| 51 | + +--------------------------+----------------------------+----------------------------+ |
50 | 52 |
|
51 | 53 | .. note:: |
52 | 54 |
|
53 | 55 | Adobe disabled__ support for authoring with Type 1 fonts in January 2023. |
| 56 | + Matplotlib uses Type 1 fonts for compatibility with TeX; when the usetex |
| 57 | + feature is used with the PDF backend, Matplotlib reads the fonts used by |
| 58 | + the TeX engine, which are usually Type 1. |
54 | 59 |
|
55 | 60 | __ https://helpx.adobe.com/fonts/kb/postscript-type-1-fonts-end-of-support.html |
56 | 61 |
|
|
83 | 88 | files, particularly with fonts with many glyphs such as those that support CJK |
84 | 89 | (Chinese/Japanese/Korean). |
85 | 90 |
|
86 | | -The solution to this problem is to subset the fonts used in the document and |
87 | | -only embed the glyphs actually used. This gets both vector text and small |
88 | | -files sizes. Computing the subset of the font required and writing the new |
89 | | -(reduced) font are both complex problem and thus Matplotlib relies on |
90 | | -`fontTools <https://fonttools.readthedocs.io/en/latest/>`__ and a vendored fork |
91 | | -of ttconv. |
92 | | -
|
93 | | -Currently Type 3, Type 42, and TrueType fonts are subsetted. Type 1 fonts are not. |
| 91 | +To keep the output size reasonable while using vector fonts, |
| 92 | +Matplotlib embeds only the glyphs that are actually used in the document. |
| 93 | +This is known as font subsetting. |
| 94 | +Computing the font subset and writing the reduced font are both complex problems, |
| 95 | +which Matplotlib solves in most cases by using the |
| 96 | +`fontTools <https://fonttools.readthedocs.io/en/latest/>`__ library. |
94 | 97 |
|
95 | 98 | Core Fonts |
96 | 99 | ^^^^^^^^^^ |
|
0 commit comments