public final class HighlightsLayer extends Object
There can be multiple highlight layers participating in rendering one document. Each highlight layer provides its z-order, which defines an order in which the layers are used. The higher the z-order the more 'visible' the layer is. In other word highlights provided by a layer with higher z-order can hide highlights provided by a layer with lower z-order for the same part of a document.
The highlights provided by a HighlightsLayer
can
define any attributes affecting text rendering including attributes that affect the
size of the view containing the rendered text. The layers that use those attributes
have to participate in the view layout and therefore need to be treated in a
special way. The isFixedSize
attribute can be true
if and only if layer's highlights will never contain attributes that influence the
layout of a view (e.g. font size).
For example attributes changing foreground or background color such as
StyleConstants.Foreground
or StyleConstants.Background
do not affect metrics while the following attributes do affect it
StyleConstants.FontFamily
,
StyleConstants.FontSize
,
StyleConstants.Bold
,
StyleConstants.Italic
.
Modifier and Type | Method and Description |
---|---|
static HighlightsLayer |
create(String layerTypeId,
ZOrder zOrder,
boolean fixedSize,
HighlightsContainer container)
Creates a new
HighlightsLayer with contents defined by
HighlightsContainer . |
String |
toString() |
public static HighlightsLayer create(String layerTypeId, ZOrder zOrder, boolean fixedSize, HighlightsContainer container)
HighlightsLayer
with contents defined by
HighlightsContainer
.layerTypeId
- The unique identifier of the new layer. This id is
used for identifying this layer among other layers that may be created
for the same Document
and it is used for example for
the purpose of z-order.zOrder
- The layer's z-order.fixedSize
- Whether this layer defines any attributes
affecting text rendering; including attributes that affect the size
of the view containing the rendered text. Pass in true
if and only if the layer does not change metrics of rendered
text.container
- The HighlightsContainer
that should be used
as a contents of this layer.ZOrder
,
HighlightsContainer