A shared instance of the default shape, which has no effect on the text margins.
Called when a markup box is drawn and Show Regions is active. This method should draw lines or curves to indicate the shape visually. The passed-in graphics context will already have been initialized with an appropriate stroke, paint, and transform.
the graphics context to draw the shape into
the text drawing region to draw the margins for
Returns the narrowest left edge inset between y1
and y2
. It is guaranteed that y1 <= y2
.
the top of the Y-range
the bottom of the Y-range
the maximum inset within the specified range
Returns the narrowest right edge inset between y1
and y2
. It is guaranteed that y1 <= y2
.
the top of the Y-range
the bottom of the Y-range
the maximum inset within the specified range
Shapes the left and right margins of drawn text to flow text around shaped edges. A shape is defined in terms of insets relative to the original margins specified by the region passed to draw. A MarkupBox will query the PageShape with a range of Y-positions covered by a line of text, and the shape must return the narrowest (largest) inset within that range. Positive inset values reduce the margins by moving a side inward; negative values increase them. A zero inset leaves the margin unchanged.
To create a new shape, subclass PageShape and override
getLeftInset
andgetRightInset
. Optionally, you can also overridedebugDraw
to draw lines indicating how the margins have changed. If you do not override this method, then no margin lines (dashed blue lines) will be drawn when Show Regions is active.In addition to creating your own shapes, a number of predefined shapes are available to handle common cases.