Skip to content

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 4, 2025

TeX MetaFont (.mf) fonts (e.g., from \usepackage{concmath}) need to be converted to raster (.pk) fonts before usage. In dvipng or pdftex this is done by invoking mktexpk via kpsewhich.

This patch ensures that our calls to kpsewhich likewise also generate and finds the raster files (in Matplotlib's own temporary cache) when needed. The resolution (600dpi) is the documented default (see e.g. the -D option in man kpsewhich). Note that this is only a preliminary step towards full MF/PK font support, which would also require parsing the PK file (which I have implemented elsewhere) and embedding the glyphs into our final output (for which I have a preliminary version in mplcairo).

Work towards fixing #20469.

PR summary

PR checklist

@anntzer anntzer force-pushed the dvipkparse branch 3 times, most recently from 3fee17f to 76d704f Compare September 4, 2025 14:26
TeX MetaFont (.mf) fonts (e.g., from `\usepackage{concmath}`) need to be
converted to raster (.pk) fonts before usage.  In dvipng or pdftex this
is done by invoking mktexpk via kpsewhich.

This patch ensures that our calls to kpsewhich likewise also generate
and finds the raster files (in Matplotlib's own temporary cache) when
needed.  The resolution (600dpi) is the documented default (see e.g. the
-D option in `man kpsewhich`).  Note that this is only a preliminary
step towards full MF/PK font support, which would also require parsing
the PK file and embedding the glyphs into our final output.
@timhoffm timhoffm merged commit c80e8ae into matplotlib:main Sep 10, 2025
38 of 40 checks passed
@anntzer anntzer deleted the dvipkparse branch September 10, 2025 19:52
@QuLogic QuLogic added this to the v3.11.0 milestone Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants