Skip to Content
Developing with PDF
book

Developing with PDF

by Leonard Rosenthol
October 2013
Intermediate to advanced content levelIntermediate to advanced
215 pages
4h 29m
English
O'Reilly Media, Inc.
Content preview from Developing with PDF

Chapter 4. Text

In this chapter you will learn how to draw text on a page. Drawing text is the most complex part of PDF graphics, but it is also what helped PDF beat its competitors to become the international standard that it is today. While the other original players converted text to raster images or vector paths (to maintain the visual integrity), the inventors of PDF knew that users needed text that could be searched and copied and didn’t just look pretty on the screen. With the depth of experience and understanding of fonts that Adobe’s engineers had, they were able to integrate actual text with visual presentation.

While the text support in PDF enables the rendering of any glyphs from any font representing any language, the mechanics (as you’ll see shortly) were all created prior to Unicode. This means that many things that developers working in other file formats take for granted, such as just putting down Unicode codepoints and letting the renderer do all the hard work, have to be done manually with PDF.

Now that you’ve been given fair warning, let’s start!

Fonts

In the previous chapters you learned how to draw vector graphics (or paths) as well as raster graphics (images) on a page. These types of drawing operations are fairly simple as they don’t normally need extra information—it’s just the instructions and (in the case of raster images) the image data. Text, however, requires more pieces. The most important of these pieces is the font.

Glyphs

A font, sometimes called a

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PDF Hacks

PDF Hacks

Sid Steward
Fonts & Encodings

Fonts & Encodings

Yannis Haralambous
iText in Action

iText in Action

Bruno Lowagie

Publisher Resources

ISBN: 9781449327903Errata Page