Previous Next


                                            388
    CHAPTER 5                                                                       Text



5.1 Organization and Use of Fonts

    A character is an abstract symbol, whereas a glyph is a specific graphical render-
    ing of a character. For example, the glyphs A, A, and A are renderings of the ab-
    stract “A” character. Historically these two terms have often been used
    interchangeably in computer typography (as evidenced by the names chosen for
    some PDF dictionary keys and PostScript operators), but advances in this area
    have made the distinction more meaningful. Consequently, this book distin-
    guishes between characters and glyphs, though with some residual names that are
    inconsistent.

    Glyphs are organized into fonts. A font defines glyphs for a particular character
    set; for example, the Helvetica and Times fonts define glyphs for a set of standard
    Latin characters. A font for use with a PDF consumer application is prepared in
    the form of a program. Such a font program is written in a special-purpose lan-
    guage, such as the Type 1 or TrueType font format, that is understood by a special-
    ized font interpreter.

    In PDF, the term font refers to a font dictionary, a PDF object that identifies the
    font program and contains additional information about it. There are several dif-
    ferent font types, identified by the Subtype entry of the font dictionary.

    For most font types, the font program is defined in a separate font file, which may
    be either embedded in a PDF stream object or obtained from an external source.
    The font program contains glyph descriptions that generate glyphs.

    A content stream paints glyphs on the page by specifying a font dictionary and a
    string object that is interpreted as a sequence of one or more character codes
    identifying glyphs in the font. This operation is called showing the text string; the
    text strings drawn in this way are called show strings. The glyph description con-
    sists of a sequence of graphics operators that produce the specific shape for that
    character in this font. To render a glyph, the application executes the glyph de-
    scription.

    Programmers who have experience with scan conversion of general shapes may
    be concerned about the amount of computation that this description seems to
    imply. However, this is only the abstract behavior of glyph descriptions and font
    programs, not how they are implemented. In fact, an efficient implementation
    can be achieved through careful caching and reuse of previously rendered glyphs.

Previous Next