[previous] [up] [next]     [index]
Next: get-inset Up: editor-snip Previous: get-editor

get-extent

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).

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.[footnote] 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 corrdinates. 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.

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<%> .

The snip's editor is usually internally locked for writing and reflowing when this method is called (see also Locks).


[previous] [up] [next]     [index]
Next: get-inset Up: editor-snip Previous: get-editor

PLT