Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 3 - QuickDraw Text / About QuickDraw Text


Scaling

Text scaling is the process of changing glyphs from one size or shape to another. This section discusses two kinds of scaling: implicit and explicit. This section also summarizes how the Font Manager handles scaling requirements when scaling is disabled. The chapter "Font Manager" in this book describes disabling scaling in greater detail.

Implicit scaling is performed automatically by QuickDraw when the Font Manager cannot supply a bitmapped font in the size that you request. In this case, the Font Manager returns to QuickDraw a bitmapped font that is the closest approximation, along with scaling factors. QuickDraw uses these values to scale the text when drawing it. This process is transparent to your application. Because the Font Manager can always satisfy a font request completely when outline fonts are installed, no scaling is necessary.

Explicit scaling is performed in essentially the same way as implicit scaling, but you specify how the text is to be scaled. Several QuickDraw routines include parameters that let your application specify (explicitly) how text is to be scaled. You might want to scale text explicitly, for example, to create unusual glyph shapes, or to increase or decrease the size of text when a user clicks in a zoom box. You can use the high-level QuickDraw justification routines to explicitly scale text. Alternatively, you can use the low-level standard measuring and drawing routines, referred to as bottleneck routines. See "Using Scaled Text" on page 3-43. To explicitly scale text, you specify values that let you stretch or shrink a glyph horizontally or vertically. You can change a glyph from a familiar point size to one that is unusual--for example, a glyph that is 12 points high but as wide as
the entire page.

The same rules apply to the interaction between the Font Manager and QuickDraw whether scaling is implicit or explicit. However, for explicit scaling, QuickDraw passes the scaling factors that you specify as routine parameters to the Font Manager in an input record (FMInput) along with the standard information, which includes the font family ID number, the size, and the stylistic variation of the font request. Taking the requested scaling factors into account, the Font Manager follows a standard path looking for an available font that best satisfies the request, and returns the bitmap information to QuickDraw via an output record (FMOutput), which contains a handle to the requested font resource and, among other information, the scaling factors that now apply, if any. The returned scaling factors describe how QuickDraw is to draw the text to fulfill the input scaling factors request.

If you use the low-level bottleneck procedure or the higher-level justification procedure to draw the scaled text and the Font Manager returns scaling factors to be applied to the text, QuickDraw applies the additional scaling.

The low-level bottleneck measuring function lets you specify scaling factors in reference parameters. If only bitmapped fonts are installed and a font does not exist that matches the scale you specify, the Font Manager uses the font that best approximates the request, and measures the text using that font. The Font Manager returns scaling factors in the reference parameters, along with the width of the text based on the supplied font. In this case, QuickDraw does not apply the necessary additional scaling to the text to give you the correct text measurement including scaling. To measure the text correctly, you need to apply the additional scaling to the text width of the font that the Font Manager returns.

For example, suppose only bitmapped fonts are installed and you request a point size of 24 with a horizontal scaling factor of 2/1 and a vertical scaling factor of 1/1. The Font Manager returns the most optimal matching font that it has, which is 12, say, with a horizontal scaling factor of 4/1 and a vertical scaling factor of 2/1. Now, you must apply these scaling factors to the text width and height metrics in the 12-point font to get the correct text measurement.

You can use the Font Manager SetFScaleDisable procedure to enable or disable font scaling of bitmapped glyphs. When you disable scaling, the Font Manager finds the closest, smaller-sized font to the one that you request, and adjusts the width table associated with the font to match the requested size. As a result, the height of the glyphs is smaller than you requested, but the spacing compensates for it. When scaling is disabled, the Font Manager returns 1/1 scaling in response to the request.

For a complete discussion of how the Font Manager determines which font to return to QuickDraw to satisfy a font request, see the chapter "Font Manager" in this book. This chapter also describes the SetFScaleDisable procedure and the width table.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996