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 ContentFunctionprivate Elementprivate booleanSeeisEndsHere()private intprivate BlockBoxprivate FSFunctionprivate intprivate booleanprivate intprivate Stringprivate Stringprivate booleanprivate booleanSeeisStartsHere()private CalculatedStyleprivate Stringprivate byte -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendPositioningInfo(StringBuilder result) voidprivate voidcalcMaxWidthFromLineLength(LayoutContext c, int cbWidth, boolean trim) voidcalcMinMaxWidth(LayoutContext c, int cbWidth, boolean trimLeadingSpace) private intcalcMinWidthFromWordLength(LayoutContext c, int cbWidth, boolean trimLeadingSpace, boolean includeWS) intprivate intgetInlineMBP(LayoutContext c, int cbWidth) private intintintintgetStyle()getText()private StringgetText(boolean trimLeadingSpace) byteprivate intgetTextWidth(LayoutContext c, String s) intbooleanbooleanbooleanThe opposite ofisStartsHere()booleanbooleanWhether this is the first InlineBox for a box.voidsetContentFunction(ContentFunction contentFunction) voidsetElement(Element element) voidsetEndsHere(boolean endsHere) SeeisEndsHere()voidsetFootnote(BlockBox footnoteBody) voidsetFunction(FSFunction function) voidsetPseudoElementOrClass(String pseudoElementOrClass) voidsetRemovableWhitespace(boolean removeableWhitespace) voidsetStartsHere(boolean startsHere) SeeisStartsHere()voidsetStyle(CalculatedStyle style) voidvoidsetTextDirection(byte direction) private StringtoString()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 fromBidiSplitterinterface.
-
getTextDirection
public byte getTextDirection()- Returns:
- either LTR or RTL from
BidiSplitterinterface.
-
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:
getElementin interfaceStyleable
-
setElement
- Specified by:
setElementin 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:
getPseudoElementOrClassin interfaceStyleable
-
setPseudoElementOrClass
-
toString
-
appendPositioningInfo
-
shortText
-
getFunction
-
setFunction
-
truncateText
public void truncateText() -
setFootnote
-
hasFootnote
public boolean hasFootnote() -
getFootnoteBody
-