This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
there are 14 Core Font that compliant viewers must ensure are available. If
there are 14 Core Fonts that compliant viewers must ensure are available. If
you restrict your document to only these fonts you do not have to embed any
font information in the document but still get vector text.
This is especially helpful to generate *really lightweight* documents.::
This is especially helpful to generate *really lightweight* documents::
# trigger core fonts for PDF backend
plt.rcParams["pdf.use14corefonts"] = True
Expand All
@@ -109,7 +110,6 @@ This is especially helpful to generate *really lightweight* documents.::
fig.savefig("AFM_PDF.pdf", format="pdf")
fig.savefig("AFM_PS.ps", format="ps)
Fonts in SVG
------------
Expand All
@@ -118,12 +118,11 @@ Text can output to SVG in two ways controlled by :rc:`svg.fonttype`:
- as a path (``'path'``) in the SVG
- as string in the SVG with font styling on the element (``'none'``)
When saving via ``'path'`` Matplotlib will compute the path of the glyphs used
as vector paths and write those to the output. The advantage of this is that
the SVG will look the same on all computers independent of what fonts are
as vector paths and write those to the output. The advantage of doing so is
that the SVG will look the same on all computers independent of what fonts are
installed. However the text will not be editable after the fact.
In contrast saving with ``'none'`` will result in smaller files and the
In contrast, saving with ``'none'`` will result in smaller files and the
text will appear directly in the markup. However, the appearance may vary
based on the SVG viewer and what fonts are available.
Expand All
@@ -135,11 +134,10 @@ To output text to raster formats via Agg, Matplotlib relies on `FreeType
changes between FreeType versions we pin to a specific version for our image
comparison tests.
How Matplotlib selects fonts
----------------------------
Internally using a Font in Matplotlib is a three step process:
Internally, using a font in Matplotlib is a three step process:
1. a `.FontProperties` object is created (explicitly or implicitly)
2. based on the `.FontProperties` object the methods on `.FontManager` are used
Expand All
@@ -153,16 +151,16 @@ specified by the `CSS1 Specifications
<http://www.w3.org/TR/1998/REC-CSS2-19980512/>`_ which is used by web browsers.
This algorithm takes into account the font family name (e.g. "Arial", "Noto
Sans CJK", "Hack", ...), the size, style, and weight. In addition to family
names that map directly to fonts there are five "generic font family names" (
serif, monospace, fantasy, cursive, and sans-serif) that will internally be
names that map directly to fonts there are five "generic font family names"
(serif, monospace, fantasy, cursive, and sans-serif) that will internally be
mapped to any one of a set of fonts.
Currently the public API for doing step 2 is `.FontManager.findfont` (and that
method on the global `.FontManager` instance is aliased at the module level as
`.font_manager.findfont`), which will only find a single font and return the absolute
path to the font on the filesystem.
Font Fallback
Font fallback
-------------
There is no font that covers the entire Unicode space thus it is possible for the
Expand All
@@ -173,7 +171,6 @@ same `.Text` instance (as a web browser does). As of Matplotlib 3.6 the Agg,
SVG, PDF, and PS backends will "fallback" through multiple fonts in a single
`.Text` instance:
.. plot::
:include-source:
:caption: The string "There are 几个汉字 in between!" rendered with 2 fonts.
Expand All
@@ -185,7 +182,6 @@ SVG, PDF, and PS backends will "fallback" through multiple fonts in a single
ha='center'
)
Internally this is implemented by setting The "font family" on
`.FontProperties` objects to a list of font families. A (currently)
private API extracts a list of paths to all of the fonts found and then
Expand Down
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copy-edit fonts docs. #24873
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Copy-edit fonts docs. #24873
Filter by extension
Viewed files
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing