Package com.openhtmltopdf.render
Class InlineBox
java.lang.Object
com.openhtmltopdf.render.InlineBox
- All Implemented Interfaces:
Styleable
A class which represents a portion of an inline element. If an inline element
does not contain any nested elements, then a single
InlineBox
object will contain the content for the entire element. Otherwise multiple
InlineBox
objects will be created corresponding to each
discrete chunk of text appearing in the element. It is not rendered directly
(and hence does not extend from Box
), but does play an important
role in layout (for example, when calculating min/max widths). Note that it
does not contain children. Inline content is stored as a flat list in the
layout tree. However, InlineBox
does contain enough
information to reconstruct the original element nesting and this is, in fact,
done during inline layout.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ContentFunction
private Element
private boolean
SeeisEndsHere()
private int
private BlockBox
private FSFunction
private int
private boolean
private int
private String
private String
private boolean
private boolean
SeeisStartsHere()
private CalculatedStyle
private String
private byte
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendPositioningInfo
(StringBuilder result) void
private void
calcMaxWidthFromLineLength
(LayoutContext c, int cbWidth, boolean trim) void
calcMinMaxWidth
(LayoutContext c, int cbWidth, boolean trimLeadingSpace) private int
calcMinWidthFromWordLength
(LayoutContext c, int cbWidth, boolean trimLeadingSpace, boolean includeWS) int
private int
getInlineMBP
(LayoutContext c, int cbWidth) private int
int
int
int
getStyle()
getText()
private String
getText
(boolean trimLeadingSpace) byte
private int
getTextWidth
(LayoutContext c, String s) int
boolean
boolean
boolean
The opposite ofisStartsHere()
boolean
boolean
Whether this is the first InlineBox for a box.void
setContentFunction
(ContentFunction contentFunction) void
setElement
(Element element) void
setEndsHere
(boolean endsHere) SeeisEndsHere()
void
setFootnote
(BlockBox footnoteBody) void
setFunction
(FSFunction function) void
setPseudoElementOrClass
(String pseudoElementOrClass) void
setRemovableWhitespace
(boolean removeableWhitespace) void
setStartsHere
(boolean startsHere) SeeisStartsHere()
void
setStyle
(CalculatedStyle style) void
void
setTextDirection
(byte direction) private String
toString()
void
-
Field Details
-
_element
-
_originalText
-
_text
-
_removableWhitespace
private boolean _removableWhitespace -
_startsHere
private boolean _startsHereSeeisStartsHere()
-
_endsHere
private boolean _endsHereSeeisEndsHere()
-
_style
-
_contentFunction
-
_function
-
_minMaxCalculated
private boolean _minMaxCalculated -
_maxWidth
private int _maxWidth -
_minWidth
private int _minWidth -
_firstLineWidth
private int _firstLineWidth -
_pseudoElementOrClass
-
_textDirection
private byte _textDirection -
_footnoteBody
-
-
Constructor Details
-
InlineBox
-
-
Method Details
-
setTextDirection
public void setTextDirection(byte direction) - Parameters:
direction
- either LTR or RTL fromBidiSplitter
interface.
-
getTextDirection
public byte getTextDirection()- Returns:
- either LTR or RTL from
BidiSplitter
interface.
-
getText
-
setText
-
applyTextTransform
public void applyTextTransform() -
isRemovableWhitespace
public boolean isRemovableWhitespace() -
setRemovableWhitespace
public void setRemovableWhitespace(boolean removeableWhitespace) -
isEndsHere
public boolean isEndsHere()The opposite ofisStartsHere()
-
setEndsHere
public void setEndsHere(boolean endsHere) SeeisEndsHere()
-
isStartsHere
public boolean isStartsHere()Whether this is the first InlineBox for a box. For example:[b]one[i]two[/i]three[/b]
will create three InlineBox objects and one and two will return true for isStartsHere. This is used for example to decide whether left margin needs to be applied. -
setStartsHere
public void setStartsHere(boolean startsHere) SeeisStartsHere()
-
getStyle
-
setStyle
-
getElement
- Specified by:
getElement
in interfaceStyleable
-
setElement
- Specified by:
setElement
in interfaceStyleable
-
getContentFunction
-
setContentFunction
-
isDynamicFunction
public boolean isDynamicFunction() -
getTextWidth
-
getMaxCharWidth
-
calcMaxWidthFromLineLength
-
getSpaceWidth
-
getTrailingSpaceWidth
-
calcMinWidthFromWordLength
private int calcMinWidthFromWordLength(LayoutContext c, int cbWidth, boolean trimLeadingSpace, boolean includeWS) -
getText
-
getInlineMBP
-
calcMinMaxWidth
-
getMaxWidth
public int getMaxWidth() -
getMinWidth
public int getMinWidth() -
getFirstLineWidth
public int getFirstLineWidth() -
getPseudoElementOrClass
- Specified by:
getPseudoElementOrClass
in interfaceStyleable
-
setPseudoElementOrClass
-
toString
-
appendPositioningInfo
-
shortText
-
getFunction
-
setFunction
-
truncateText
public void truncateText() -
setFootnote
-
hasFootnote
public boolean hasFootnote() -
getFootnoteBody
-