/* ** Newton Developer Technical Support Sample Code ** ** Font Scaling, Scaling text within an arbitrary box ** ** by Bob Ebert and Bennett Battaile, Newton Developer Technical Support ** ** Copyright © 1993-1995 by Apple Computer, Inc. All rights reserved. ** ** You may incorporate this sample code into your applications without ** restriction. This sample code has been provided "AS IS" and the ** responsibility for its operation is 100% yours. You are not ** permitted to modify and redistribute the source as "DTS Sample Code." ** If you are going to re-distribute the source, we require that you ** make it clear in the source that the code was descended from ** Apple-provided sample code, but that you've made changes. */ Font Scaling 3 by Bob Ebert and Bennett Battaile Updated for NTK 1.0 and MP 110 by Todd Courtois Demonstrates how to scale fonts. Just calling ScaleShape on the shape produced by MakeText wonÕt work: it only scales the rectangle around the actual graphic text. Instead what we do is create a picture shape from the text shape, then call ScaleShape on the picture. This works, but of course you get grainy picture scaling. Before we pass the text shape off to MakePict to make a picture shape, we first enclose the text shape in a framing rectangle. If you donÕt put the framing rectangle around the text shape, the text shape will be clipped to the rectangle specified in MakeText, which chops off descenders. Because of oddities in the text scaling algorithm, the trailing letter may be clipped from a line of text at some widths. Padding is added to the text bounds rectangle to allow for this. Each pen stroke stretches the text continuously. After one stroke unit has complete, we change the text shape so that the next time the user puts the pen down, a new text shape appears in the same bounding rect as the previous text shape.