HTextLayoutManager

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.havi.ui
Interface HTextLayoutManager

All Known Implementing Classes:
  DVBTextLayoutManager, HDefaultTextLayoutManager

    public interface HTextLayoutManager

The `HTextLayoutManager` class manages the layout and rendering on-screen of a "marked-up" string.

Possible implementations of `HTextLayoutManager` could enable the following behaviors:

- Interpreting basic markup, such as changing color or font, and forced line breaks.
- Providing text alignment, as in the `HDefaultTextLayoutManager`.
- Providing text wrapping policies, such as word-wrap.
- Providing text orientations, such as right-to-left, or top-to-bottom rendering.
- Providing specialized support for missing characters, or fonts.
- Providing specific language support.
- Additional text styles, such as drop capitals or "shadow" characters.

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.

See Also:
  `HDefaultTextLayoutManager`

Method Summary
`void` | `render(String markedUpString, Graphics g, HVisible v, Insets insets)` Render the string.

Method Detail

### render

    void render(String markedUpString,
                Graphics g,
                HVisible v,
                Insets insets)

  Render the string. The `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.

  Parameters:
    `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`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD