From 08cdd1add5513ccf39c782e749d89a1656ac26ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=2E=20Sepp=C3=A4nen?= Date: Sat, 7 Jun 2025 18:05:57 +0300 Subject: [PATCH 1/7] 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. --- galleries/users_explain/text/fonts.py | 52 ++++++++++++++------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/galleries/users_explain/text/fonts.py b/galleries/users_explain/text/fonts.py index 7efb9a00aa09..ef1d611157ad 100644 --- a/galleries/users_explain/text/fonts.py +++ b/galleries/users_explain/text/fonts.py @@ -27,30 +27,35 @@ Matplotlib supports three font specifications (in addition to pdf 'core fonts', which are explained later in the guide): -.. list-table:: Type of Fonts - :header-rows: 1 - - * - Type 1 (PDF) - - Type 3 (PDF/PS) - - TrueType (PDF) - * - One of the oldest types, introduced by Adobe - - Similar to Type 1 in terms of introduction - - Newer than previous types, used commonly today, introduced by Apple - * - Restricted subset of PostScript, charstrings are in bytecode - - Full PostScript language, allows embedding arbitrary code - (in theory, even render fractals when rasterizing!) - - Include a virtual machine that can execute code! - * - These fonts support font hinting - - Do not support font hinting - - Hinting supported (virtual machine processes the "hints") - * - Non-subsetted through Matplotlib - - Subsetted via external module ttconv - - Subsetted via external module - `fontTools `__ +.. table:: Type of Fonts + + +--------------------------+----------------------------+----------------------------+ + | Type 1 (PDF with usetex) | Type 3 (PDF/PS) | TrueType (PDF) | + +==========================+============================+============================+ + | One of the oldest types, | Similar to Type 1 in | Newer than previous types, | + | introduced by Adobe | terms of introduction | used commonly today, | + | | | introduced by Apple | + +--------------------------+----------------------------+----------------------------+ + | Restricted subset of | Full PostScript language, | Include a virtual machine | + | PostScript, charstrings | allows embedding arbitrary | that can execute code! | + | are in bytecode | code (in theory, even | | + | | render fractals when | | + | | rasterizing!) | | + +--------------------------+----------------------------+----------------------------+ + | These fonts support font | Do not support font hinting| Hinting supported (virtual | + | hinting | | machine processes the | + | | | "hints") | + +--------------------------+----------------------------+----------------------------+ + | Subsetted by code in | Subsetted via external module | + | `matplotlib._type1font` | `fontTools `__ | + +--------------------------+----------------------------+----------------------------+ .. note:: Adobe disabled__ support for authoring with Type 1 fonts in January 2023. + Matplotlib uses Type 1 fonts for compatibility with TeX: when the usetex + feature is used with the PDF backend, Matplotlib reads the fonts used by + the TeX engine, which are usually Type 1. __ https://helpx.adobe.com/fonts/kb/postscript-type-1-fonts-end-of-support.html @@ -86,11 +91,8 @@ The solution to this problem is to subset the fonts used in the document and only embed the glyphs actually used. This gets both vector text and small files sizes. Computing the subset of the font required and writing the new -(reduced) font are both complex problem and thus Matplotlib relies on -`fontTools `__ and a vendored fork -of ttconv. - -Currently Type 3, Type 42, and TrueType fonts are subsetted. Type 1 fonts are not. +(reduced) font are both complex problems and thus Matplotlib relies in most cases +on `fontTools `__. Core Fonts ^^^^^^^^^^ From c3ed0c9e36248ad8aa87a3b8a8a1b6a183eee495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=2E=20Sepp=C3=A4nen?= Date: Wed, 11 Jun 2025 13:33:41 +0300 Subject: [PATCH 2/7] Update galleries/users_explain/text/fonts.py Co-authored-by: hannah --- galleries/users_explain/text/fonts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/users_explain/text/fonts.py b/galleries/users_explain/text/fonts.py index ef1d611157ad..5ea5d29a259d 100644 --- a/galleries/users_explain/text/fonts.py +++ b/galleries/users_explain/text/fonts.py @@ -90,7 +90,7 @@ The solution to this problem is to subset the fonts used in the document and only embed the glyphs actually used. This gets both vector text and small -files sizes. Computing the subset of the font required and writing the new +files sizes. Computing the font subset and writing the new (reduced) font are both complex problems and thus Matplotlib relies in most cases on `fontTools `__. From 153e2541d8f14003eec148a33795b958811f0bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=2E=20Sepp=C3=A4nen?= Date: Wed, 11 Jun 2025 13:33:53 +0300 Subject: [PATCH 3/7] Update galleries/users_explain/text/fonts.py Co-authored-by: hannah --- galleries/users_explain/text/fonts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/users_explain/text/fonts.py b/galleries/users_explain/text/fonts.py index 5ea5d29a259d..75420321b071 100644 --- a/galleries/users_explain/text/fonts.py +++ b/galleries/users_explain/text/fonts.py @@ -42,7 +42,7 @@ | | render fractals when | | | | rasterizing!) | | +--------------------------+----------------------------+----------------------------+ - | These fonts support font | Do not support font hinting| Hinting supported (virtual | + | Supports font | Does not support font hinting| Supports font hinting (virtual | | hinting | | machine processes the | | | | "hints") | +--------------------------+----------------------------+----------------------------+ From 867cf9fa634cccf227d311ea61d8fc4a4e73ce55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=2E=20Sepp=C3=A4nen?= Date: Wed, 11 Jun 2025 13:34:04 +0300 Subject: [PATCH 4/7] Update galleries/users_explain/text/fonts.py Co-authored-by: hannah --- galleries/users_explain/text/fonts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/users_explain/text/fonts.py b/galleries/users_explain/text/fonts.py index 75420321b071..868fa298c989 100644 --- a/galleries/users_explain/text/fonts.py +++ b/galleries/users_explain/text/fonts.py @@ -36,7 +36,7 @@ | introduced by Adobe | terms of introduction | used commonly today, | | | | introduced by Apple | +--------------------------+----------------------------+----------------------------+ - | Restricted subset of | Full PostScript language, | Include a virtual machine | + | Restricted subset of | Full PostScript language, | Includes a virtual machine | | PostScript, charstrings | allows embedding arbitrary | that can execute code! | | are in bytecode | code (in theory, even | | | | render fractals when | | From 2da93075e85ef1fe3736fdf8c5585ac7eef9a3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=2E=20Sepp=C3=A4nen?= Date: Wed, 11 Jun 2025 13:34:17 +0300 Subject: [PATCH 5/7] Update galleries/users_explain/text/fonts.py Co-authored-by: hannah --- galleries/users_explain/text/fonts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galleries/users_explain/text/fonts.py b/galleries/users_explain/text/fonts.py index 868fa298c989..6d3a6e947985 100644 --- a/galleries/users_explain/text/fonts.py +++ b/galleries/users_explain/text/fonts.py @@ -53,7 +53,7 @@ .. note:: Adobe disabled__ support for authoring with Type 1 fonts in January 2023. - Matplotlib uses Type 1 fonts for compatibility with TeX: when the usetex + Matplotlib uses Type 1 fonts for compatibility with TeX; when the usetex feature is used with the PDF backend, Matplotlib reads the fonts used by the TeX engine, which are usually Type 1. From b2e64515303417e1bc4047c307d7217400563b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=2E=20Sepp=C3=A4nen?= Date: Wed, 11 Jun 2025 13:41:21 +0300 Subject: [PATCH 6/7] Reword paragraph on subsetting --- galleries/users_explain/text/fonts.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/galleries/users_explain/text/fonts.py b/galleries/users_explain/text/fonts.py index 6d3a6e947985..7e5d2acec655 100644 --- a/galleries/users_explain/text/fonts.py +++ b/galleries/users_explain/text/fonts.py @@ -36,7 +36,7 @@ | introduced by Adobe | terms of introduction | used commonly today, | | | | introduced by Apple | +--------------------------+----------------------------+----------------------------+ - | Restricted subset of | Full PostScript language, | Includes a virtual machine | + | Restricted subset of | Full PostScript language, | Includes a virtual machine | | PostScript, charstrings | allows embedding arbitrary | that can execute code! | | are in bytecode | code (in theory, even | | | | render fractals when | | @@ -88,11 +88,12 @@ files, particularly with fonts with many glyphs such as those that support CJK (Chinese/Japanese/Korean). -The solution to this problem is to subset the fonts used in the document and -only embed the glyphs actually used. This gets both vector text and small -files sizes. Computing the font subset and writing the new -(reduced) font are both complex problems and thus Matplotlib relies in most cases -on `fontTools `__. +To keep the output size reasonable while using vector fonts, +Matplotlib embeds only the glyphs that are actually used in the document. +This is known as font subsetting. +Computing the font subset and writing the reduced font are both complex problems, +which Matplotlib solves in most cases by using the +`fontTools `__ library. Core Fonts ^^^^^^^^^^ From dfab32110248bbdee6b47deb7b7c9b79c5a5e258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jouni=20K=2E=20Sepp=C3=A4nen?= Date: Wed, 11 Jun 2025 13:43:54 +0300 Subject: [PATCH 7/7] Realign grid table --- galleries/users_explain/text/fonts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/galleries/users_explain/text/fonts.py b/galleries/users_explain/text/fonts.py index 7e5d2acec655..067ed2f3932a 100644 --- a/galleries/users_explain/text/fonts.py +++ b/galleries/users_explain/text/fonts.py @@ -42,9 +42,9 @@ | | render fractals when | | | | rasterizing!) | | +--------------------------+----------------------------+----------------------------+ - | Supports font | Does not support font hinting| Supports font hinting (virtual | - | hinting | | machine processes the | - | | | "hints") | + | Supports font | Does not support font | Supports font hinting | + | hinting | hinting | (virtual machine processes | + | | | the "hints") | +--------------------------+----------------------------+----------------------------+ | Subsetted by code in | Subsetted via external module | | `matplotlib._type1font` | `fontTools `__ | pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy