Commit 912d5b7
committed
Support {lua,xe}tex as alternative usetex engine.
Currently, this PR is mostly a proof of concept; it only implements the
dvi generation and parsing parts, but does not implement rendering in
any of the builtin backends, except svg (under rcParams["svg.fonttype"]
= "none", the default). However, there is a companion branch on the
mplcairo repository, also named "luadvi", which implements support.
Example (requiring both this PR, and mplcairo installed from its luadvi
branch):
```
import matplotlib as mpl; mpl.use("module://mplcairo.qt")
from matplotlib import pyplot as plt
plt.rcParams["text.latex.engine"] = "lualatex" # or "xelatex"
plt.rcParams["text.latex.preamble"] = (
# {lua,xe}tex can use any font installed on the system, spec'd using its
# "normal" name.
# Some scaling issues currently remain with luatex, e.g. try DejaVu Sans.
r"\usepackage{fontspec}\setmainfont{TeX Gyre Pagella}")
plt.figtext(.5, .5, r"\textrm{gff\textwon}", usetex=True)
plt.show()
```
TODO:
- Fix many likely remaining bugs.
- Rework font selection in texmanager, which is currently very ad-hoc
due to the limited number of fonts supported by latex.
- Implement rendering support in the (other) builtin backends. In
particular, the Agg (and, if we care, cairo) backend will require
significant reworking because dvipng, currently used to rasterize dvi
to png, doesn't support luatex-generated dvi; instead we will need to
proceed as with the other backends, reading the glyphs one at a time
from the dvi file and rasterizing them one at a time to the output
buffer. Working on the other backends is not very high on my priority
list (as I already have mplcairo as playground...) so it would be nice
if others showed some interest for it :-)1 parent a9dc9ac commit 912d5b7
File tree
6 files changed
+280
-122
lines changed- lib/matplotlib
- backends
- mpl-data
6 files changed
+280
-122
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
991 | 991 | | |
992 | 992 | | |
993 | 993 | | |
994 | | - | |
| 994 | + | |
995 | 995 | | |
996 | 996 | | |
997 | 997 | | |
| |||
0 commit comments