Package com.itextpdf.layout.layout
Class TextLayoutResult
- java.lang.Object
-
- com.itextpdf.layout.layout.LayoutResult
-
- com.itextpdf.layout.layout.MinMaxWidthLayoutResult
-
- com.itextpdf.layout.layout.TextLayoutResult
-
public class TextLayoutResult extends MinMaxWidthLayoutResult
Represents the result of a textlayout.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancontainsPossibleBreakprotected booleanendsWithSplitCharacterprotected floatleftMinWidthprotected floatrightMinWidthprotected booleansplitForcedByNewlineIndicates whether split was forced by new line symbol in text or not.protected booleanstartsWithSplitCharacterWhiteSpaceprotected booleanwordHasBeenSplitIndicates whether some word was split duringlayout.-
Fields inherited from class com.itextpdf.layout.layout.MinMaxWidthLayoutResult
minMaxWidth
-
Fields inherited from class com.itextpdf.layout.layout.LayoutResult
areaBreak, causeOfNothing, FULL, NOTHING, occupiedArea, overflowRenderer, PARTIAL, splitRenderer, status
-
-
Constructor Summary
Constructors Constructor Description TextLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRenderer, IRenderer overflowRenderer)TextLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRenderer, IRenderer overflowRenderer, IRenderer cause)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatgetLeftMinWidth()Gets min width of the leftmost unbreakable part of the TextRenderer#line after layout.floatgetRightMinWidth()Gets min width of the rightmost unbreakable part of the TextRenderer#line after layout.booleanisContainsPossibleBreak()Indicates whether split renderer contains possible break.booleanisEndsWithSplitCharacter()Indicates whether TextRenderer#line ends with a splitCharacter.booleanisSplitForcedByNewline()Indicates whether split was forced by new line symbol in rendered text.booleanisStartsWithSplitCharacterWhiteSpace()Indicates whether TextRenderer#line starts with a whitespace.booleanisWordHasBeenSplit()Indicates whether some word in a rendered text was split duringlayout.TextLayoutResultsetContainsPossibleBreak(boolean containsPossibleBreak)TextLayoutResultsetEndsWithSplitCharacter(boolean endsWithSplitCharacter)TextLayoutResultsetLeftMinWidth(float leftMinWidth)Sets min width of the leftmost unbreakable part of the TextRenderer#line after layout.TextLayoutResultsetRightMinWidth(float rightMinWidth)Sets min width of the rightmost unbreakable part of the TextRenderer#line after layout.TextLayoutResultsetSplitForcedByNewline(boolean isSplitForcedByNewline)TextLayoutResultsetStartsWithSplitCharacterWhiteSpace(boolean startsWithSplitCharacterWhiteSpace)TextLayoutResultsetWordHasBeenSplit(boolean wordHasBeenSplit)SetswordHasBeenSplit-
Methods inherited from class com.itextpdf.layout.layout.MinMaxWidthLayoutResult
getMinMaxWidth, setMinMaxWidth
-
Methods inherited from class com.itextpdf.layout.layout.LayoutResult
getAreaBreak, getCauseOfNothing, getOccupiedArea, getOverflowRenderer, getSplitRenderer, getStatus, setAreaBreak, setOverflowRenderer, setSplitRenderer, setStatus, toString
-
-
-
-
Field Detail
-
wordHasBeenSplit
protected boolean wordHasBeenSplit
Indicates whether some word was split duringlayout.
-
splitForcedByNewline
protected boolean splitForcedByNewline
Indicates whether split was forced by new line symbol in text or not.
-
containsPossibleBreak
protected boolean containsPossibleBreak
-
startsWithSplitCharacterWhiteSpace
protected boolean startsWithSplitCharacterWhiteSpace
-
endsWithSplitCharacter
protected boolean endsWithSplitCharacter
-
leftMinWidth
protected float leftMinWidth
-
rightMinWidth
protected float rightMinWidth
-
-
Constructor Detail
-
TextLayoutResult
public TextLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRenderer, IRenderer overflowRenderer)Creates theresult of {@link com.itextpdf.layout.renderer.TextRenderer#layout(LayoutContext) layouting}. TheLayoutResult.causeOfNothingwill be set as null.- Parameters:
status- the status ofTextRenderer.layout(LayoutContext)occupiedArea- the area occupied by the contentsplitRenderer- the renderer to draw the split part of the contentoverflowRenderer- the renderer to draw the overflowed part of the content
-
TextLayoutResult
public TextLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRenderer, IRenderer overflowRenderer, IRenderer cause)Creates theresult of {@link com.itextpdf.layout.renderer.TextRenderer#layout(LayoutContext) layouting}.- Parameters:
status- the status ofTextRenderer.layout(LayoutContext)occupiedArea- the area occupied by the contentsplitRenderer- the renderer to draw the split part of the contentoverflowRenderer- the renderer to draw the overflowed part of the contentcause- the first renderer to produceLayoutResult.NOTHING
-
-
Method Detail
-
isWordHasBeenSplit
public boolean isWordHasBeenSplit()
Indicates whether some word in a rendered text was split duringlayout. The value will be set as true if, for example, the rendered words width is bigger than the width of layout area.- Returns:
- whether some word was split or not.
-
setWordHasBeenSplit
public TextLayoutResult setWordHasBeenSplit(boolean wordHasBeenSplit)
SetswordHasBeenSplit- Parameters:
wordHasBeenSplit- indicates that some word was split duringlayout.- Returns:
this layout resultthe setting was applied on- See Also:
wordHasBeenSplit
-
isSplitForcedByNewline
public boolean isSplitForcedByNewline()
Indicates whether split was forced by new line symbol in rendered text. The value will be set as true if, for example, the rendered text contains '\n' symbol. This value can also be true even if the text was fully placed, but had line break at the end.- Returns:
- whether split was forced by new line or not.
-
setSplitForcedByNewline
public TextLayoutResult setSplitForcedByNewline(boolean isSplitForcedByNewline)
- Parameters:
isSplitForcedByNewline- indicates that split was forced by new line symbol in rendered text.- Returns:
this layout resultthe setting was applied on.- See Also:
setSplitForcedByNewline(boolean)
-
isContainsPossibleBreak
public boolean isContainsPossibleBreak()
Indicates whether split renderer contains possible break. Possible breaks are either whitespaces or split characters.- Returns:
- true if there's a possible break within the split renderer.
- See Also:
ISplitCharacters
-
setContainsPossibleBreak
public TextLayoutResult setContainsPossibleBreak(boolean containsPossibleBreak)
- Parameters:
containsPossibleBreak- indicates that split renderer contains possible break.- Returns:
this layout resultthe setting was applied on.- See Also:
isContainsPossibleBreak()
-
setStartsWithSplitCharacterWhiteSpace
public TextLayoutResult setStartsWithSplitCharacterWhiteSpace(boolean startsWithSplitCharacterWhiteSpace)
- Parameters:
startsWithSplitCharacterWhiteSpace- indicates if TextRenderer#line starts with a split character that is also a whitespace.- Returns:
this layout resultthe setting was applied on.- See Also:
isStartsWithSplitCharacterWhiteSpace()
-
isStartsWithSplitCharacterWhiteSpace
public boolean isStartsWithSplitCharacterWhiteSpace()
Indicates whether TextRenderer#line starts with a whitespace.- Returns:
- true if TextRenderer#line starts with a whitespace.
-
setEndsWithSplitCharacter
public TextLayoutResult setEndsWithSplitCharacter(boolean endsWithSplitCharacter)
- Parameters:
endsWithSplitCharacter- indicates if TextRenderer#line ends with a splitCharacter.- Returns:
this layout resultthe setting was applied on.- See Also:
isEndsWithSplitCharacter()
-
isEndsWithSplitCharacter
public boolean isEndsWithSplitCharacter()
Indicates whether TextRenderer#line ends with a splitCharacter.- Returns:
- true if TextRenderer#line ends with a splitCharacter.
- See Also:
ISplitCharacters
-
setLeftMinWidth
public TextLayoutResult setLeftMinWidth(float leftMinWidth)
Sets min width of the leftmost unbreakable part of the TextRenderer#line after layout. This value includes left-side additional width, i.e. left margin, border and padding widths. In case when entire TextRenderer#line is unbreakable, leftMinWidth also includes right-side additional width.- Parameters:
leftMinWidth- min width of the leftmost unbreakable part of the TextRenderer#line after layout.- Returns:
this layout resultthe setting was applied on.
-
getLeftMinWidth
public float getLeftMinWidth()
Gets min width of the leftmost unbreakable part of the TextRenderer#line after layout. This value leftMinWidth includes left-side additional width, i.e. left margin, border and padding widths. In case when entire TextRenderer#line is unbreakable, leftMinWidth also includes right-side additional width.- Returns:
- min width of the leftmost unbreakable part of the TextRenderer#line after layout.
-
setRightMinWidth
public TextLayoutResult setRightMinWidth(float rightMinWidth)
Sets min width of the rightmost unbreakable part of the TextRenderer#line after layout. This value includes right-side additional width, i.e. right margin, border and padding widths. In case when entire TextRenderer#line is unbreakable, this value must be -1 and right-side additional width must be included in leftMinWidth.- Parameters:
rightMinWidth- min width of the rightmost unbreakable part of the TextRenderer#line after layout.- Returns:
this layout resultthe setting was applied on.
-
getRightMinWidth
public float getRightMinWidth()
Gets min width of the rightmost unbreakable part of the TextRenderer#line after layout. This value includes right-side additional width, i.e. right margin, border and padding widths. In case when entire TextRenderer#line is unbreakable, this value must be -1 and right-side additional width must be included in leftMinWidth.- Returns:
- min width of the leftmost unbreakable part of the TextRenderer#line after layout.
-
-