SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: <jk...@ik...> - 2007年09月04日 20:44:35
Hi,
I have continued my work on supporting text.usetex for the PDF backend
by parsing dvi files. It "sort of" works now, with the following
caveats:
 - Your TeX distribution must have a kpsewhich command and a correctly
 configured pdftex.map file. This is true for modern distributions on
 Unix; I have no idea about Windows.
 - TeX "virtual fonts" are not supported yet; Computer Modern should
 work, but Times will usually not. Truetype fonts also are not yet
 supported (for usetex; they are for ordinary text).
 - Re-encoded fonts (in pdftex.map) probably do not work properly, and
 "font effects" such as slanting do not work.
 - Bounding boxes are not quite right.
 - The embedded Type 1 fonts are not subsetted, so output files are
 unnecessarily big.
 - The resulting PDF files sometimes crash Preview.app on OS X, and even
 if it doesn't crash, it doesn't show the fonts. There is probably
 some problem in the embedding, but xpdf, gv, and Adobe Reader seem to
 show the files just fine.
To enable, rename _draw_tex to draw_tex in backend_pdf.py and set
text.usetex to True.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: <jk...@ik...> - 2007年09月13日 06:38:38
The usetex support in pdf is now a little better, so I am enabling it
now. At least it is more entertaining than NotImplementedError...
I have fixed some of the biggest problems (the broken font embedding
causing crashes of Preview.app, and the lack of virtual font support).
It still makes some assumptions about the TeX distribution: you need
kpsewhich and pdftex.map, so on TeX Live or (I presume) teTeX you are
fine, but I have no idea about Windows.
Transformations of Type-1 fonts are not implemented, so if you try to
use $\alpha$ with Times, TeX typesets an alpha from Symbol and slants
it, but you get the non-slanted version. Fixing this (and adding
subsetting support) probably requires a complete Type-1 parser.
There is support for baseline alignment, but it is based on finding the
baseline of the lowest character, so subscripts will throw it off. A
good solution will require some TeX magic.
Reports of bugs (or successes) are welcome.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Darren D. <dd...@co...> - 2007年09月28日 13:25:21
Hi Jouni,
On Thursday 13 September 2007 02:38:25 am Jouni K. Sepp=E4nen wrote:
> The usetex support in pdf is now a little better, so I am enabling it
> now. At least it is more entertaining than NotImplementedError...
>
> I have fixed some of the biggest problems (the broken font embedding
> causing crashes of Preview.app, and the lack of virtual font support).
> It still makes some assumptions about the TeX distribution: you need
> kpsewhich and pdftex.map, so on TeX Live or (I presume) teTeX you are
> fine, but I have no idea about Windows.
>
> Transformations of Type-1 fonts are not implemented, so if you try to
> use $\alpha$ with Times, TeX typesets an alpha from Symbol and slants
> it, but you get the non-slanted version. Fixing this (and adding
> subsetting support) probably requires a complete Type-1 parser.
>
> There is support for baseline alignment, but it is based on finding the
> baseline of the lowest character, so subscripts will throw it off. A
> good solution will require some TeX magic.
>
> Reports of bugs (or successes) are welcome.
I tried the following, with the latest svn checkout and usetex=3DTrue:
plot([1,2])
savefig('test.pdf')
and I get an error, the tail end is:
/usr/lib64/python2.5/site-packages/matplotlib/backends/backend_pdf.py in=20
writeFonts(self)
 468 elif filename.endswith('.pfb') or=20
filename.endswith('.pfa'):
 469 # a Type 1 font; limited support for now
=2D-> 470 fontdictObject =3D self.embedType1(filename,=20
self.fontInfo[Fx])
 471 else:
 472 realpath, stat_key =3D get_realpath_and_stat(filena=
me)
/usr/lib64/python2.5/site-packages/matplotlib/backends/backend_pdf.py in=20
embedType1(self, filename, fontinfo)
 501 fh.close()
 502
=2D-> 503 fh =3D open(fontinfo.afmfile, 'rb')
 504 matplotlib.verbose.report(
 505 'Reading metrics from ' + fontinfo.afmfile, 'debug')
IOError: [Errno 2] No such file or directory: ''
Darren
From: <jk...@ik...> - 2007年09月28日 16:03:03
Darren Dale <dd...@co...> writes:
> I tried the following, with the latest svn checkout and usetex=True:
> plot([1,2])
> savefig('test.pdf')
> and I get an error, the tail end is:
[...]
> --> 503 fh = open(fontinfo.afmfile, 'rb')
> IOError: [Errno 2] No such file or directory: ''
Could you update from svn, set verbose.level to debug, run your example
again, and email me the output? Also, which TeX distribution do you
have?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: <jk...@ik...> - 2007年09月30日 20:16:35
It turns out (thanks to Darren for the debug info) that AFM files do not
exist for all fonts in all current TeX distributions, so I have modified
the pdf backend to not use them. This loses some information that is
required by the pdf spec (such as the x-height and stem widths of the
embedded font) but at least in some tests Preview.app and Adobe Reader
don't seem to mind.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Darren D. <dd...@co...> - 2007年10月02日 18:26:09
Attachments: dviread.pdf epstopdf.pdf
On Sunday 30 September 2007 04:16:08 pm Jouni K. Sepp=E4nen wrote:
> It turns out (thanks to Darren for the debug info) that AFM files do not
> exist for all fonts in all current TeX distributions, so I have modified
> the pdf backend to not use them. This loses some information that is
> required by the pdf spec (such as the x-height and stem widths of the
> embedded font) but at least in some tests Preview.app and Adobe Reader
> don't seem to mind.
Jouni, I just ran tex_demo.py, which I modified to yield a pdf. The result=
s=20
are really impressive. In an earlier post you mentioned that transformation=
s=20
of Type-1 fonts probably requires a complete type-1 parser. Do you mean=20
matplotlib's ft2font is missing some functionality?
Darren
From: <jk...@ik...> - 2007年10月02日 19:18:11
Darren Dale <dd...@co...> writes:
> In an earlier post you mentioned that transformations of Type-1 fonts
> probably requires a complete type-1 parser. Do you mean matplotlib's
> ft2font is missing some functionality?
I don't think freetype has any support for modifying and outputting
fonts. Actually the transformations are probably just a matter of
locating and modifying the FontMatrix entry in the cleartext part of the
pfb file, but subsetting (to reduce file sizes) is more involved.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /