Skip to content
Back to formatted view

Raw Message

Message-ID: <AANLkTinFyt=G36XUw861a0=-qy-vOUk8ABkWPZdPx+ZP@mail.gmail.com>
Date: 2011-01-15T01:21:09Z
From: Kohske Takahashi
Subject: Truetype and Opentype font in pdf device

Deal all,

I want to know if truetype or opentype fonts are available in pdf
device (i.e., pdf() or dev.copy2pdf()), and if so, how to do it?

Now I can do as followings:

1. convert ttf to afm using ttf2afm, e.g.: $ ttf2afm Impact.ttf > Impact.afm
2. put the afm file in $R_HOME/library/grDevices/afm
3. register a new type1 font: pdfFonts(Impact=Type1Font("Impact",
rep("Impact.afm", 4), encoding = "TeXtext.enc"))
4. specify the fontfamily in gpar: grid.text('hello grid world',
gp=gpar(fontfamily="Impact"))

but obviously, it is better if truetype or opentype fonts are directly
available without conversion to type1 font.

Also, I found that Cairo package can handle truetype or opnetype font.
However, the package seems not to support fontfamily, hence I cannot
use it through gpar.

Does anyone know about this topic?

Thank you in advance.

--
Kohske Takahashi <takahashi.kohske at gmail.com>

Research Center for Advanced Science and Technology,
The University of ?Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html