get-extent in snip%
Calculates the snip's width, height, descent (amount of height which is drawn below the baseline), space (amount of height which is ``filler'' space at the top), and horizontal spaces (amount of width which is ``filler'' space at the left and right).
This method is called by the snip's administrator; it should not be
called directly by others. To get the extent of a snip, use
get-snip-location in editor<%> .
A drawing context is provided for the purpose of finding font sizes,
but no drawing should occur. The
get-extent and
partial-offset methods must not make any assumptions about the state of the drawing
context, except that it is scaled properly. In particular, the font
for the snip's style is not automatically set in the drawing context
before the method is called.18
If
get-extent or
partial-offset changes the drawing context's setting, it must restore them before
returning. However, the methods should not need to change the drawing
context; only font settings can affect measurement results from a
device context, and
get-text-extent in dc<%> accepts a font% argument for sizing that overrides that
device context's current font.
The snip's left and top locations are provided in editor coordinates. In a text editor, the y-coordinate is the line's top location; the snip's actual top location is potentially undetermined until its height is known.
If a snip caches the result size for future replies, it should
invalidate its cached size when
size-cache-invalid is called (especially if the snip's size depends on any device context
properties).
If a snip's size changes after receiving a call to
get-extent and before receiving a call to
size-cache-invalid, then the snip must notify its administrator of the size change, so
that the administrator can recompute its derived size information.
Notify the administrator of a size change by call its
resized method.
The snip's editor is usually internally locked for writing and reflowing when this method is called (see also Locks).
(-> voidsenda-snipget-extentdcxywhdescentspacelspacerspace)
dc:dc<%>object
x: real number
y: real number
w=#f: boxed non-negative real number or#f
h=#f: boxed non-negative real number or#f
descent=#f: boxed non-negative real number or#f
space=#f: boxed non-negative real number or#f
lspace=#f: boxed non-negative real number or#f
rspace=#f: boxed non-negative real number or#fFills in all boxes with 0.0.
18 Many snips cache their size information, so automatically setting the font would be wasteful.