# Pdf-writer Postscript Type 1 font handling problems

**URL:** <https://www.ruby-forum.com/t/pdf-writer-postscript-type-1-font-handling-problems/65443>\
**Category:** Ruby\
**Created:** [August 18, 2006, 6:58am UTC](https://www.ruby-forum.com/t/pdf-writer-postscript-type-1-font-handling-problems/65443 "2006-08-18T06:58:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaySSbiesS\_Smundo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/13edae/32.png) [@RaySSbiesS\_Smundo](https://www.ruby-forum.com/u/RaySSbiesS_Smundo)\
**Post date:** [August 18, 2006, 6:58am UTC](https://www.ruby-forum.com/t/pdf-writer-postscript-type-1-font-handling-problems/65443/1 "2006-08-18T06:58:40Z")

</div>

Folks/Admin, apologies for this cross post. I posted to the wrong group  
previously.

Hi, I am trying to get pdf-writer to load up Postscript Type 1 fonts  
but am encountering a problem. Using the gettysburg.rb example as a  
base for my tests I have implented the following code changes:

PDF::Writer::FONT\_PATH.unshift(File.expand\_path(“Fonts”))  
p PDF::Writer::FONT\_PATH

PDF::Writer::FontMetrics::METRICS\_PATH.unshift(File.expand\_path(“Fonts”))  
p PDF::Writer::FontMetrics::METRICS\_PATH

pdf.select\_font(“GillSan”, :encoding =\> nil)  
pdf.text “The Gettysburg Address\n\n”,  
:font\_size =\> 12,  
:justification =\> :center

When I run the program, my ruby session sends back the following error  
message:  
/opt/local/lib/ruby/site\_ruby/1.8/pdf/writer.rb:1102:in `font_height': undefined method`[]’ for nil:NilClass (NoMethodError)  
from /opt/local/lib/ruby/site\_ruby/1.8/pdf/writer.rb:2436:in  
`text’  
from gettysburg.rb:58

Line 58 is “pdf.text “The Gettysburg Address\n\n”,”… Any idea what’s  
going on?

I am runnng the following:  
Mac: OSX 10.4.7  
Ruby: 1.8.4  
pdf-writer: 1.1.3  
color-tools: 1.3.0  
transaction-simple: 1.3.0

Thanks, Ray

---

<div class="post-metadata">

**Author:** ![RaySSbiesS\_Smundo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/13edae/32.png) [@RaySSbiesS\_Smundo](https://www.ruby-forum.com/u/RaySSbiesS_Smundo)\
**Post date:** [August 18, 2006, 11:36pm UTC](https://www.ruby-forum.com/t/pdf-writer-postscript-type-1-font-handling-problems/65443/2 "2006-08-18T23:36:31Z")

</div>

Hi Austin, no its not a defult font. I’ve tried with a variety of AFM  
fonts all to no avail.

Ta, Ray

---

<div class="post-metadata">

**Author:** ![RaySSbiesS\_Smundo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/13edae/32.png) [@RaySSbiesS\_Smundo](https://www.ruby-forum.com/u/RaySSbiesS_Smundo)\
**Post date:** [August 18, 2006, 6:05pm UTC](https://www.ruby-forum.com/t/pdf-writer-postscript-type-1-font-handling-problems/65443/3 "2006-08-18T18:05:54Z")

</div>

On 8/18/06, Ray(:bies, :mundo) [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Folks/Admin, apologies for this cross post. I posted to the wrong group  
> previously.

Is this a default installed font for the Mac? If so, I can test it as  
soon as I get Ruby 1.8.4 installed.

-austin
