Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d810e68

Browse filesBrowse files
authored
Merge pull request #30150 from jkseppan/doc-type1-subsetting
Update font-related documentation
2 parents c44ae00 + dfab321 commit d810e68
Copy full SHA for d810e68

File tree

Expand file treeCollapse file tree

1 file changed

+31
-28
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+31
-28
lines changed

‎galleries/users_explain/text/fonts.py

Copy file name to clipboardExpand all lines: galleries/users_explain/text/fonts.py
+31-28Lines changed: 31 additions & 28 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, | 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+
+--------------------------+----------------------------+----------------------------+
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
@@ -83,14 +88,12 @@
8388
files, particularly with fonts with many glyphs such as those that support CJK
8489
(Chinese/Japanese/Korean).
8590
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.
9497
9598
Core Fonts
9699
^^^^^^^^^^

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.