-
Notifications
You must be signed in to change notification settings - Fork 46
Using external fonts with Fontmap
shairontoledo edited this page Sep 13, 2010
·
1 revision
To use external fonts, the font must be in TTF, PFB or PFA font format. Below are the step-by-step instructions.
First, create the directory, in this case foo
shell# mkdir /tmp/foo
Copy the fonts to /tmp/foo dir. Inside foo dir create the file Fontmap(it must be this name); in body of file make the following font map to Trebuchet.ttf and Verdana.ttf.
/Trebuchet (Trebuchet.ttf);
/Verdana (Verdana.ttf);
thus
shairon@hashcode:/tmp/foo$ ls -lh
-rw-r--r-- 1 shairon shairon 57 2008-06-12 17:25 Fontmap
-rw-r--r-- 1 shairon shairon 124K 2008-06-12 17:23 Trebuchet.ttf
-rw-r--r-- 1 shairon shairon 137K 2008-06-12 17:24 Verdana.ttf
Loading the fonts
RGhost::Config::GS[:extensions] << '/tmp/foo'
Now you have to define tags using the method define_tags
d.define_tags do
tag :myfont, :name => 'Verdana', :size => 12, :color => '#ADAD66'
end
Using the tag
doc.show 'Hello using the Verdana font', :tag => :myfont
with method/class Text
doc.text 'Hello using the <myfont>Verdana</myfont>'