home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-07 | 2.5 KB | 72 lines | [TEXT/R*ch] |
- NewText
- by Maurice Sharp, J. Christopher Bell
- Copyright 1994 by Apple Computer, Inc. All rights reserved
-
- This sample demonstrates two new text calls that are available in ROMs with
- versions greater or equal to 1.3 (the MessagePad 110 and later). You should
- really test for these functions before you use them. If you need to do
- something like wrapping text, you could default to the method use in the Wrap
- It Up sample code. A way to test things...
-
- if functions.TextBox exists then
- TextBox(...)
- else
- MyFunkyTextBoxBasedOnWrapItUp(...)
-
-
- Note that the actual drawing is done within a DoDrawing() dispatch, which is the
- correct way to set up your drawing outside of a viewDrawScript. If you do not
- do your drawing with a normal viewDrawScript or the DoDrawing function,
- the clipping region will be incorrect. Symptoms of bad clipping are overwriting
- the extras drawer, keyboards, the styles pallete, or other views overlapping
- with your view. If you do your drawing this way, you will not have these problems.
-
-
-
- The functions are:
-
- // *** TextBox
- TextBox(<text>, <funkyFontFrame>, <bounds>)
- return value - undefined
- text - string to draw
- funkyFontFrame - see funkyFontFrame description below
- bounds - bounds frame to draw into
-
- This function wraps text so that it fits in bounds and blasts it onto the
- screen use this in a viewDrawScript Note: the bounds are in local coordinates
- of the view that makes the TextBox call.
-
-
-
- // *** TextBounds
- TextBounds(<text>, <funkyFontFrame>, <bounds>)
- return value - undefined
- text - the text to 'wrap'
- funkyFontFrame - see funkyFontFrame description below (justification is ignored)
- bounds - bounds frame with width or height 0. The bounds object
- itself will be modified. This frame should not be a read-only
- object
-
- TextBounds returns bounds that <text> would wrap to based on certain
- conditions. For this to work, either width or height or both must be 0.
- IMPORTANT: the original bounds frame is actually modified.
-
- If one of width or height are 0, the bounds returned reflects
- wrapping the text to fit the constrained dimension
-
- If both width and height are 0, the bounds returned just use
- explicit CR's in the text to find the bounds
-
-
-
- // *** About funkyFontFrame
- funkyFontFrame objects
-
- This frame contains both a font specification and, optionally,
- a justification, the format is:
-
- {font: <font-frame>, justification: <justify-symbol>}
- <font-frame>: must be a font frame as per NPG (NOT a condensed number)
- <justify-symbol>: ['left|'center|'right]
- if slot not present or slot is nil, defaults to 'left
-