[cl-pdf-devel] Conversion of TrueType fonts to afm for use by CL-PDF

Mitch Berkson mitch at bermita.com
Tue Nov 15 18:11:12 UTC 2011


I have tried two ways to convert my Garamond TrueType font to .afm.  The 
first was using the font converter at http://fpdf.fruit-lab.de/. The 
second was using Dimitriy's converter ttf2pt1.

When viewing a pdf document created using the Garamond.afm font produced 
by either of these, Adobe reader says "The font 'Garamond' contains a 
bad /BBox." and the text looks bad.

Is there a better way to get .afm files for CL-PDF?  Thanks for any help.

Mitch Berkson

I doubt if this is an issue, but to generate the pdf, I am using:

(defun font-test (&optional (file (merge-pathnames  "font-test.pdf" *dir*)))
   (pdf:with-document ()
     (pdf:with-page ()
       (let ((font-names '("Helvetica" "Times-Roman" "Garamond"))
             (text-str "Lorem ipsum dolor sit amet, consectetur 
adipiscing elit. Nam elit metus,
consequat ac posuere eu, rutrum sit amet nisi. Suspendisse potenti. In 
consequat, massa sit amet
eleifend pharetra, ligula nisl posuere elit, aliquam sagittis nibh magna 
eget justo. Maecenas
justo risus, varius at iaculis in, pellentesque at lectus. Praesent ut 
tincidunt lectus.")
             (content))
         (loop for a-font-name in font-names
               for i from 0
               do (setf content
                        (tt:compile-text ()
                          (tt:paragraph (:h-align 'left
                                         :font (pdf:get-font a-font-name)
                                         :font-size 12
                                         :color (pdf:set-cymk-stroke 0.0 
0.0 0.0 100.0))
                            (tt:verbatim (format nil "~a~%~a" 
a-font-name text-str)))))
               do (tt::draw-block content 50 (- 700 (* 100 i)) 500 500))))
     (pdf:write-document file)))




More information about the cl-pdf-devel mailing list