Previous Next


                                        395
SECTION 5.1                                            Organization and Use of Fonts



space to (40, 50) in the user coordinate system and then places the origin of the A
glyph at that point:

   BT
        40 50 Td
        ( ABC ) Tj
   ET

The glyph displacement is the distance from the glyph’s origin to the point at
which the origin of the next glyph should normally be placed when painting the
consecutive glyphs of a line of text. This distance is a vector (called the displace-
ment vector) in the glyph coordinate system; it has horizontal and vertical com-
ponents. (A displacement that is horizontal is usually called a width.) Most
Western writing systems, including those based on the Latin alphabet, have a
positive horizontal displacement and a zero vertical displacement. Some Asian
writing systems have a nonzero vertical displacement. In all cases, the text-show-
ing operators transform the displacement vector into text space and then trans-
late text space by that amount.

The glyph bounding box is the smallest rectangle (oriented with the axes of the
glyph coordinate system) that just encloses the entire glyph shape. The bounding
box is expressed in terms of its left, bottom, right, and top coordinates relative to
the glyph origin in the glyph coordinate system.

In some writing systems, text is frequently aligned in two different directions. For
example, it is common to write Japanese and Chinese glyphs either horizontally
or vertically. To handle this, a font can optionally contain a second set of metrics
for each glyph. Which set of metrics to use is selected according to a writing
mode, where 0 specifies horizontal writing and 1 specifies vertical writing. This
feature is available only for composite fonts, discussed in Section 5.6, “Composite
Fonts.”

When a glyph has two sets of metrics, each set specifies a glyph origin and a dis-
placement vector for that writing mode. In vertical writing, the glyph position is
described by a position vector from the origin used for horizontal writing
(origin 0) to the origin used for vertical writing (origin 1). Figure 5.5 illustrates
the metrics for the two writing modes:

• The left diagram illustrates the glyph metrics associated with writing mode 0,
  horizontal writing. The coordinates ll and ur specify the bounding box of the
  glyph relative to origin 0. w0 is the displacement vector that specifies how the

Previous Next