PyX — Example: text/font.py

0.2 KB
11.6 KB
2.8 KB
11.0 KB
5.4 KB

Customize fonts

from pyx import *

text.set(text.LatexRunner)
text.preamble(r"\usepackage{times}")

c = canvas.canvas()
c.text(0, 0, r"\LaTeX{} doesn't need to look like \LaTeX{} all the time.")
c.writeEPSfile("font")
c.writePDFfile("font")
c.writeSVGfile("font")

Description

In LaTeX, there are nice packages allowing to switch fonts. Hence, for a simple example we change the mode of the default texrunner instance to LaTeX and use the preamble method to load the times package.

The times package loads the Times New Roman and the Helvetica fonts, which are part of any valid Acrobat Reader and Ghostscript installation. These fonts are therefore not explicitly included in the output of PyX. This behaviour is <> from LaTeX, where these standard 35 fonts usually are not contained in the standard font-map file psfonts.map. If you say in the PyX configuration file