Skip to content

Commit 08cdd1a

Browse files
committed
Update font-related documentation
We now subset Type-1 fonts and no longer have a copy of ttconv. Make the font comparison table a grid table so we can use a colspan cell. Clarify that Type-1 fonts get used only in the usetex/pdf combination.
1 parent 7c49d52 commit 08cdd1a

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

galleries/users_explain/text/fonts.py

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,35 @@
2727
Matplotlib supports three font specifications (in addition to pdf 'core fonts',
2828
which are explained later in the guide):
2929
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, | Include 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+
| These fonts support font | Do not support font hinting| Hinting supported (virtual |
46+
| hinting | | machine processes the |
47+
| | | "hints") |
48+
+--------------------------+----------------------------+----------------------------+
49+
| Subsetted by code in | Subsetted via external module |
50+
| `matplotlib._type1font` | `fontTools <https://github.com/fonttools/fonttools>`__ |
51+
+--------------------------+----------------------------+----------------------------+
5052
5153
.. note::
5254
5355
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.
5459
5560
__ https://helpx.adobe.com/fonts/kb/postscript-type-1-fonts-end-of-support.html
5661
@@ -86,11 +91,8 @@
8691
The solution to this problem is to subset the fonts used in the document and
8792
only embed the glyphs actually used. This gets both vector text and small
8893
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.
94+
(reduced) font are both complex problems and thus Matplotlib relies in most cases
95+
on `fontTools <https://fonttools.readthedocs.io/en/latest/>`__.
9496
9597
Core Fonts
9698
^^^^^^^^^^

0 commit comments

Comments
 (0)