Font Scaling
Font Scaling
Font scaling is the process of changing a glyph from one size or shape to
an other. The Font Manager can scale bitmapped and TrueType fonts in three
ways: changing a glyph's point size on the same display device, modifying the
glyph but keeping the point size constant when using a different display device,
and altering the shape of the glyph.
The simplest form of scaling occurs when the Font Manager changes a glyph
from one point size to another on the same display device. If the glyph is
bitmapped and the requested font size is not available, there are certain rules
the Font Manager follows to create a new bitmapped glyph from an existing
one; these rules are discussed in the description of Font Rules. If the glyph is
an outline glyph, the Font Manager uses the original outline for that glyph to
create a new bitmap at a different size. The bitmaps available to the
Font Manager to create all 32 point sizes were 9, 10, 12, 14, 18, and 24
points. A single TrueType outline produces a smoother bitmap in all point
sizes.
The Font Manager also scales a glyph when moving it from one device to
another device with a different resolution: for instance, from the screen to a
printer. A bitmap that is 72 pixels high on a 72 dpi screen measures one inch,
but on a 144 dpi printer it measures a half inch. In order to produce a figure
the same size as the original screen bitmap, the Font Manager needs a
bitmap twice the size of the original. If there are no bitmaps available in twice
the point size of the bitmap that appears on the screen, QuickDraw scales the
original bitmap to twice its original size in order to print it on the printer.
Your application can scale a glyph by stretching or shrinking it, which
changes the glyph from a familiar point size to something a little stranger-for
example, a glyph that is 12 points high but as wide as a whole page of text.
Your application tells the Font Manager how to scale a glyph using font
scaling factors, which are represented as proportions or fractions that
indicate how the Font Manager should scale the glyph in the vertical and
horizontal directions. The ratio given by the font scaling factors determines
whether the glyph grows or shrinks; if the ratio is greater than one, the glyph
increases in size, and if it is less than one, the glyph decreases in size. If the
font scaling factors are 1-to-1 (1/1) for both horizontal and vertical
scaling, the glyph does not change size.
In the following figure, the font scaling factors are 2/1 in the horizontal
direction and 1/1 in the vertical direction. The glyph stays the same height,
but grows twice as large in width.
A glyph stretched horizontally
In the next figure, the font scaling factors are 2/1 in the vertical direction
and 1/1 in the horizontal direction. The glyph stays the same width, but grows
to twice its original height.
A glyph stretched vertically
In the figure which follows, the font scaling factors are 1/1 in the vertical
direction and 1/2 in the horizontal direction. The glyph stays the same height
but retains only half its width.
A glyph condensed horizontally
If the font scaling factors are 2/2 in both directions, QuickDraw draws the
glyph at a point size twice that of the original. In the case of
bitmapped fonts, QuickDraw first looks for a bitmap at twice the size of the
original before redrawing the glyph at the new point size.
The Font Manager produces better results by scaling TrueType glyphs,
because it changes the font's original outline to the new size or shape, and then
makes the bitmap. Outlines give better results than bitmaps when scaled,
because the outlines are intended for use at all point sizes, whereas the
bitmaps are not.