public interface HTextLayoutManager
HTextLayoutManager class
manages the layout and rendering on-screen of a
"marked-up" string.
Possible implementations of HTextLayoutManager could enable the following behaviors:
HDefaultTextLayoutManager.
HTextLayoutManager supports passing a java.awt.Insets object as
argument to the render method
to restrict the area in which text may be rendered. If the insets
are zero, the text is rendered into the area defined by the bounds
of the HVisible passed to the render method.
The clipping rectangle of the Graphics object passed
to the render method
is not used to determine the area in which text is
rendered, as its size and position is not guaranteed to cover the
entire HVisible - for example, when
partial repainting of an HVisible is
performed. The diagram below shows a possible scenario:
![]() |
The gray area shows the bounds of the HVisible. The green area shows the clipping rectangle of the
Graphics context, and the dashed lines show the insets
passed to the render
method. The text is laid out into the rectangle
defined by the HVisible bounds after
subtracting the insets. However, only the part of the text covered
by the clipping rectangle is actually drawn to the screen, as shown
in the diagram below:
![]() |
The behavior of the render method when the text to be rendered does not fit in the current area specified is implementation-specific.
HDefaultTextLayoutManagervoid render(String markedUpString, Graphics g, HVisible v, Insets insets)
HTextLayoutManager should use the passed HVisible object to determine any
additional information required to render the string,
e.g. Font, Color etc.
The text should be laid out in the layout area, which is
defined by the bounds of the specified HVisible, after subtracting the
insets. If the insets are null the full bounding
rectangle is used as the area to render text into.
The HTextLayoutManager should not modify the clipping rectangle of
the Graphics object.
markedUpString - the string to render.g - the graphics context, including a clipping rectangle
which encapsulates the area within which rendering is
permitted. If a valid insets value is passed to this method then
text must only be rendered into the bounds of the widget after
the insets are subtracted. If the insets value is null
then text is rendered into the entire bounding area of the HVisible. It is implementation specific whether
or not the renderer takes into account the intersection of the
clipping rectangle in each case for optimization purposes.v - the HVisible into which
to render.insets - the insets to
determine the area in which to layout the text, or null.Copyright © 2012 code4tv.com. All Rights Reserved.