Chapter 4: Text Handling
If you want to examine TrueType fonts in more detail take a look at Microsoft’s free
»font properties extension«
which will display many entries of the font’s TrueType ta-
bles in human-readable form.
Finding TrueType font names on the Mac. Generally, you can find the name of an in-
stalled font in the font menu of applications such as TextEdit on Mac OS X. However,
this method does not always result in the proper font name as expected by PDFlib. For
this reason we recommend Apple’s freely available Font Tools
. This suite of command-
line utilities contains a program called ftxinstalledfonts which is useful for determining
the exact name of all installed fonts. In order to determine the font name expected by
PDFlib, install Font Tools and issue the following statement on the command-line:
4.2.3 User-Defined (Type 3) Fonts
Type 3 fonts in PDF (as opposed to PostScript Type 3 fonts) are not actually a file format.
Instead, the glyphs in a Type 3 font must be defined at runtime with standard PDFlib
graphics functions. Since all PDFlib features for vector graphics, raster images, and even
text output can be used in Type 3 font definitions, there are no restrictions regarding
the contents of the characters in a Type 3 font. Combined with the PDF import library
PDI you can even import complex drawings as a PDF page, and use those for defining a
character in a Type 3 font.
Note PostScript Type 3 fonts are not supported.
Type 3 fonts must completely be defined outside of any page (more precisely, the font
definition must take place in document scope). The following example demonstrates the
definition of a simple Type 3 font:
PDF_begin_font(p, "Fuzzyfont", 0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, "");
PDF_begin_glyph(p, "circle", 1000, 0, 0, 1000, 1000);
PDF_arc(p, 500, 500, 500, 0, 360);
PDF_begin_glyph(p, "ring", 400, 0, 0, 400, 400);
PDF_arc(p, 200, 200, 200, 0, 360);
The font will be registered in PDFlib, and its name can be supplied to PDF_load_font( )
along with an encoding which contains the names of the glyphs in the Type 3 font.
Please note the following when working with Type 3 fonts:
>Similar to patterns and templates, images cannot be opened within a glyph descrip-
tion. However, they can be opened before starting a glyph description, and placed
within the glyph description. Alternatively, inline images may be used for small bit-
maps to overcome this restriction.
1. See http://www.microsoft.com/typography/property/property.htm
2. See http://developer.apple.com/fonts/OSXTools.html