Repository: matplotlib/matplotlib
File: galleries/users_explain/text/fonts.py (Python)

Code before:
---------------------------

Fonts have a long (and sometimes incompatible) history in computing, leading to
different platforms supporting different types of fonts.  In practice,
Matplotlib supports three font specifications (in addition to pdf 'core fonts',
which are explained later in the guide):

.. 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 <https://github.com/fonttools/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

Other font specifications which Matplotlib supports:

- Type 42 fonts (PS):

  - PostScript wrapper around TrueType fonts
  - 42 is the `Answer to Life, the Universe, and Everything!
    <https://en.wikipedia.org/wiki/Answer_to_Life,_the_Universe,_and_Everything>`_
  - Matplotlib uses the external library
    `fontTools <https://github.com/fonttools/fonttools>`__ to subset these types of
    fonts

- OpenType fonts:

Review comment (suggestion):
```suggestion
  +--------------------------+----------------------------+----------------------------+
  | Supports font | Does not support font hinting| Supports font hinting (virtual |
  | hinting                  |                            | machine processes the      |
  |                          |                            | "hints")                   |
  +--------------------------+----------------------------+----------------------------+
```
Should probably use parallel language

Code after:
---------------------------

Fonts have a long (and sometimes incompatible) history in computing, leading to
different platforms supporting different types of fonts.  In practice,
Matplotlib supports three font specifications (in addition to pdf 'core fonts',
which are explained later in the guide):

.. 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,  | Includes a virtual machine |
  | PostScript, charstrings  | allows embedding arbitrary | that can execute code!     |
  | are in bytecode          | code (in theory, even      |                            |
  |                          | render fractals when       |                            |
  |                          | rasterizing!)              |                            |
  +--------------------------+----------------------------+----------------------------+
  | 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 <https://github.com/fonttools/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

Other font specifications which Matplotlib supports:

- Type 42 fonts (PS):

  - PostScript wrapper around TrueType fonts
  - 42 is the `Answer to Life, the Universe, and Everything!
    <https://en.wikipedia.org/wiki/Answer_to_Life,_the_Universe,_and_Everything>`_
  - Matplotlib uses the external library
    `fontTools <https://github.com/fonttools/fonttools>`__ to subset these types of
    fonts

- OpenType fonts: