From cfb494f815ec9ee1318c8e810dbaf10d3be5112f Mon Sep 17 00:00:00 2001 From: Kyle Sunden Date: Thu, 16 Nov 2023 18:40:44 -0600 Subject: [PATCH] Backport PR #27299: [MNT] swap xkcd script for humor sans --- .circleci/config.yml | 6 +++--- .devcontainer/devcontainer.json | 2 +- doc/devel/dependencies.rst | 3 +-- lib/matplotlib/mpl-data/matplotlibrc | 2 +- lib/matplotlib/mpl-data/stylelib/classic.mplstyle | 2 +- lib/matplotlib/pyplot.py | 12 ++++++------ lib/matplotlib/tests/test_axes.py | 2 +- lib/matplotlib/textpath.py | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f1f3d6e313d..0668f436ddac 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,22 +59,22 @@ commands: graphviz \ fonts-crosextra-carlito \ fonts-freefont-otf \ - fonts-humor-sans \ fonts-noto-cjk \ optipng fonts-install: steps: - restore_cache: - key: fonts-2 + key: fonts-4 - run: name: Install custom fonts command: | mkdir -p ~/.local/share/fonts wget -nc https://github.com/google/fonts/blob/master/ofl/felipa/Felipa-Regular.ttf?raw=true -O ~/.local/share/fonts/Felipa-Regular.ttf || true + wget -nc https://github.com/ipython/xkcd-font/blob/master/xkcd-script/font/xkcd-script.ttf?raw=true -O ~/.local/share/fonts/xkcd-Script.ttf || true fc-cache -f -v - save_cache: - key: fonts-2 + key: fonts-4 paths: - ~/.local/share/fonts/ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 814c066c43b1..ddec2754d03a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "features": { "ghcr.io/devcontainers/features/desktop-lite:1": {}, "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { - "packages": "inkscape,ffmpeg,dvipng,lmodern,cm-super,texlive-latex-base,texlive-latex-extra,texlive-fonts-recommended,texlive-latex-recommended,texlive-pictures,texlive-xetex,fonts-wqy-zenhei,graphviz,fonts-crosextra-carlito,fonts-freefont-otf,fonts-humor-sans,fonts-noto-cjk,optipng" + "packages": "inkscape,ffmpeg,dvipng,lmodern,cm-super,texlive-latex-base,texlive-latex-extra,texlive-fonts-recommended,texlive-latex-recommended,texlive-pictures,texlive-xetex,fonts-wqy-zenhei,graphviz,fonts-crosextra-carlito,fonts-freefont-otf,fonts-comic-neue,fonts-noto-cjk,optipng" } }, "onCreateCommand": ".devcontainer/setup.sh", diff --git a/doc/devel/dependencies.rst b/doc/devel/dependencies.rst index 400bc63d42ac..7c14d90180d6 100644 --- a/doc/devel/dependencies.rst +++ b/doc/devel/dependencies.rst @@ -399,8 +399,7 @@ Optional, but recommended: * `Inkscape `_ * `optipng `_ -* the font "Humor Sans" (aka the "XKCD" font), or the free alternative - `Comic Neue `_ +* the font `xkcd script `_ or `Comic Neue `_ * the font "Times New Roman" .. note:: diff --git a/lib/matplotlib/mpl-data/matplotlibrc b/lib/matplotlib/mpl-data/matplotlibrc index 2c53651da3d6..5014aa448968 100644 --- a/lib/matplotlib/mpl-data/matplotlibrc +++ b/lib/matplotlib/mpl-data/matplotlibrc @@ -269,7 +269,7 @@ #font.serif: DejaVu Serif, Bitstream Vera Serif, Computer Modern Roman, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif #font.sans-serif: DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif #font.cursive: Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, Felipa, Comic Neue, Comic Sans MS, cursive -#font.fantasy: Chicago, Charcoal, Impact, Western, Humor Sans, xkcd, fantasy +#font.fantasy: Chicago, Charcoal, Impact, Western, xkcd script, fantasy #font.monospace: DejaVu Sans Mono, Bitstream Vera Sans Mono, Computer Modern Typewriter, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace diff --git a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle index 09a38df282f1..e1768e5a6145 100644 --- a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle +++ b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle @@ -91,7 +91,7 @@ font.size : 12.0 font.serif : DejaVu Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif font.sans-serif: DejaVu Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, Felipa, cursive -font.fantasy : Comic Sans MS, Chicago, Charcoal, ImpactWestern, Humor Sans, fantasy +font.fantasy : Comic Sans MS, Chicago, Charcoal, ImpactWestern, xkcd script, fantasy font.monospace : DejaVu Sans Mono, Andale Mono, Nimbus Mono L, Courier New, Courier, Fixed, Terminal, monospace ### TEXT diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 42ea405c17cc..62f7eba74eea 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -707,11 +707,12 @@ def xkcd( scale: float = 1, length: float = 100, randomness: float = 2 ) -> ExitStack: """ - Turn on `xkcd `_ sketch-style drawing mode. This will - only have effect on things drawn after this function is called. + Turn on `xkcd `_ sketch-style drawing mode. - For best results, the "Humor Sans" font should be installed: it is - not included with Matplotlib. + This will only have an effect on things drawn after this function is called. + + For best results, install the `xkcd script `_ + font; xkcd fonts are not packaged with Matplotlib. Parameters ---------- @@ -750,8 +751,7 @@ def xkcd( from matplotlib import patheffects rcParams.update({ - 'font.family': ['xkcd', 'xkcd Script', 'Humor Sans', 'Comic Neue', - 'Comic Sans MS'], + 'font.family': ['xkcd', 'xkcd Script', 'Comic Neue', 'Comic Sans MS'], 'font.size': 14.0, 'path.sketch': (scale, length, randomness), 'path.effects': [ diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 6c5dd712b7fd..edc040eff3dd 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -8813,7 +8813,7 @@ def test_tick_param_labelfont(): fig, ax = plt.subplots() ax.plot([1, 2, 3, 4], [1, 2, 3, 4]) ax.set_xlabel('X label in Impact font', fontname='Impact') - ax.set_ylabel('Y label in Humor Sans', fontname='Humor Sans') + ax.set_ylabel('Y label in xkcd script', fontname='xkcd script') ax.tick_params(color='r', labelfontfamily='monospace') plt.title('Title in sans-serif') for text in ax.get_xticklabels(): diff --git a/lib/matplotlib/textpath.py b/lib/matplotlib/textpath.py index de97899f8a72..c00966d6e6c3 100644 --- a/lib/matplotlib/textpath.py +++ b/lib/matplotlib/textpath.py @@ -99,7 +99,7 @@ def get_text_path(self, prop, s, ismath=False): from matplotlib.text import TextToPath from matplotlib.font_manager import FontProperties - fp = FontProperties(family="Humor Sans", style="italic") + fp = FontProperties(family="Comic Neue", style="italic") verts, codes = TextToPath().get_text_path(fp, "ABC") path = Path(verts, codes, closed=False) 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