|
From: shuhua <shu...@gm...> - 2010-05-08 12:21:02
|
The pdf terminal, which depends on libpdf, was great to me because I regularly produce vector plots in the pdf format to be included in my papers generated by pdflatex. However, one thing was frustrating me all the time: I was not able to select fonts using the pdf term and I needed to use the latex fonts in my plots for consistency with the rest of my papers. The font selection method for the pdf term seemed to be radically different to that for, say, the png term. After a long time of frustration and found the newly released gnuplot 4.4.0 did not advance in this respect, I decided to tackle this problem myself. With the help of the documentations of the pdflib (Lite, version 7.0.4p4, free), I modified a small part of the file 'pdf.trm' and now the modified gnuplot supports font selection like that of the png term. With this patch (attached, 'patch pdf.trm < pdf.trm.patch'), you can select a font by an absolute path, for example, 'font "/usr/local/share/gnuplot/fonts/Vera.ttf, 12" or set the environmental variable PDFFONTPATH, export PDFFONTPATH=/usr/local/share/gnuplot/fonts, then use 'font "Vera.ttf, 12"'. But due to the restriction of pdflib Lite, Unicode is not supported. Hope this patch http://old.nabble.com/file/p28495448/pdf.trm.patch pdf.trm.patch helpful:) The following is the font part of the modified pdf term online help, for your convienience: where is the name of the default font to use (default Helvetica) and is the font size (in points, default 12). Currently, The general form of is `[fontname][:encoding][:option]`, in which `fontname` may be the name of a font or font file; `encoding` may be "host", "builtin", empty (equivalent to "host"), or other encodings ("unicode" is not supported due to the restriction of pdflib lite); `option` may be "embedding" and empty (no embedding). OpenType, TrueType and Type1 fonts are supported, but CJK fonts are not supported. Subsetting is not supported, and embedding is always set for custom fonts. There are 14 Latin core fonts directly supported by the pdflib: Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique, Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique, Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic, Symbol, ZapfDingbats. To support custom fonts, you may define the environment variable PDFFONTPATH for font search or use a full path, for example, font "/usr/local/share/gnuplot/fonts/Vera.ttf, 12", Within `fontname`, the following font file suffixes can be omitted: .ttf .otf .afm .pfm .ttc .tte .pfa .pfb. -- View this message in context: http://old.nabble.com/a-patch-of-pdf.trm-tp28495448p28495448.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: shuhua <shu...@gm...> - 2010-05-08 12:32:56
|
Here I attached a gnuplot script ( http://old.nabble.com/file/p28495517/test_font.plt test_font.plt ) thats draws a letter table using a computer modern font from LaTeX and the generated table in pdf format ( http://old.nabble.com/file/p28495517/test_font.pdf test_font.pdf ). Enjory:) shuhua wrote: > > The pdf terminal, which depends on libpdf, was great to me because I > regularly produce vector plots in the pdf format to be included in my > papers generated by pdflatex. > > However, one thing was frustrating me all the time: I was not able to > select fonts using the pdf term and I needed to use the latex fonts in my > plots for consistency with the rest of my papers. The font selection > method for the pdf term seemed to be radically different to that for, say, > the png term. > > After a long time of frustration and found the newly released gnuplot > 4.4.0 did not advance in this respect, I decided to tackle this problem > myself. With the help of the documentations of the pdflib (Lite, version > 7.0.4p4, free), I modified a small part of the file 'pdf.trm' and now the > modified gnuplot supports font selection like that of the png term. > > With this patch (attached, 'patch pdf.trm < pdf.trm.patch'), you can > select a font by an absolute path, for example, 'font > "/usr/local/share/gnuplot/fonts/Vera.ttf, 12" or set the environmental > variable PDFFONTPATH, export PDFFONTPATH=/usr/local/share/gnuplot/fonts, > then use 'font "Vera.ttf, 12"'. But due to the restriction of pdflib Lite, > Unicode is not supported. > > Hope this patch http://old.nabble.com/file/p28495448/pdf.trm.patch > pdf.trm.patch helpful:) > > > The following is the font part of the modified pdf term online help, for > your convienience: > where is the name of the default font to use (default Helvetica) > and <fontsize> is the font size (in points, default 12). Currently, > The general form of is `[fontname][:encoding][:option]`, in which > `fontname` may be the name of a font or font file; `encoding` may be > "host", "builtin", empty (equivalent to "host"), or other > encodings ("unicode" is not supported due to the restriction of pdflib > lite); `option` may be "embedding" and empty (no embedding). > > OpenType, TrueType and Type1 fonts are supported, but CJK fonts are not > supported. Subsetting is not supported, and embedding is always set for > custom fonts. There are 14 Latin core fonts directly supported by the > pdflib: > Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique, > Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique, > Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic, > Symbol, ZapfDingbats. > To support custom fonts, you may define the environment variable > PDFFONTPATH for font search or use a full path, for example, > font "/usr/local/share/gnuplot/fonts/Vera.ttf, 12", > Within `fontname`, the following font file suffixes can be omitted: > .ttf .otf .afm .pfm .ttc .tte .pfa .pfb. > > > > > > -- View this message in context: http://old.nabble.com/a-patch-of-pdf.trm-tp28495448p28495517.html Sent from the Gnuplot - User mailing list archive at Nabble.com. |