Commit cc4a8a3
committed
Support {lua,xe}tex as alternative usetex engine.
Currently, this PR is mostly a proof of concept; only the svg backend
is supported (under rcParams["svg.fonttype"] = "none", the default).
However, there is a companion branch on the mplcairo repository, also
named "luadvi", which implements support for all output formats.
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. Try e.g. DejaVu Sans instead.
r"\usepackage{fontspec}\setmainfont{TeX Gyre Pagella}")
plt.figtext(.5, .5, r"\textrm{gff\textwon}", usetex=True)
plt.show()
```
Font effects are supported by mplcairo, e.g.
`\fontspec{DejaVu Sans}[FakeSlant=0.2] abc`.
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 a635671 commit cc4a8a3
File tree
4 files changed
+35
-9
lines changed- lib/matplotlib
- mpl-data
4 files changed
+35
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| 330 | + | |
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1038 | 1038 | | |
1039 | 1039 | | |
1040 | 1040 | | |
| 1041 | + | |
1041 | 1042 | | |
1042 | 1043 | | |
1043 | 1044 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| 207 | + | |
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
213 | | - | |
| 214 | + | |
| 215 | + | |
214 | 216 | | |
215 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
216 | 233 | | |
217 | 234 | | |
218 | 235 | | |
| |||
282 | 299 | | |
283 | 300 | | |
284 | 301 | | |
285 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
286 | 305 | | |
287 | 306 | | |
288 | 307 | | |
| |||
297 | 316 | | |
298 | 317 | | |
299 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
300 | 324 | | |
301 | | - | |
| 325 | + | |
302 | 326 | | |
303 | 327 | | |
304 | 328 | | |
| |||
0 commit comments