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
Represents the result of a text
layout.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected floatprotected floatprotected booleanIndicates whether split was forced by new line symbol in text or not.protected booleanprotected booleanIndicates whether some word was split duringlayout.Fields inherited from class com.itextpdf.layout.layout.MinMaxWidthLayoutResult
minMaxWidthFields inherited from class com.itextpdf.layout.layout.LayoutResult
areaBreak, causeOfNothing, FULL, NOTHING, occupiedArea, overflowRenderer, PARTIAL, splitRenderer, status -
Constructor Summary
ConstructorsConstructorDescriptionTextLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRenderer, IRenderer overflowRenderer) Creates theresult of layouting.TextLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRenderer, IRenderer overflowRenderer, IRenderer cause) Creates theresult of layouting. -
Method Summary
Modifier and TypeMethodDescriptionfloatGets min width of the leftmost unbreakable part of the TextRenderer#line after layout.floatGets min width of the rightmost unbreakable part of the TextRenderer#line after layout.booleanIndicates whether split renderer contains possible break.booleanIndicates whether TextRenderer#line ends with a splitCharacter.booleanIndicates whether split was forced by new line symbol in rendered text.booleanIndicates whether TextRenderer#line starts with a whitespace.booleanIndicates whether some word in a rendered text was split duringlayout.setContainsPossibleBreak(boolean containsPossibleBreak) setEndsWithSplitCharacter(boolean endsWithSplitCharacter) setLeftMinWidth(float leftMinWidth) Sets min width of the leftmost unbreakable part of the TextRenderer#line after layout.setRightMinWidth(float rightMinWidth) Sets min width of the rightmost unbreakable part of the TextRenderer#line after layout.setSplitForcedByNewline(boolean isSplitForcedByNewline) setStartsWithSplitCharacterWhiteSpace(boolean startsWithSplitCharacterWhiteSpace) setWordHasBeenSplit(boolean wordHasBeenSplit) SetswordHasBeenSplitMethods inherited from class com.itextpdf.layout.layout.MinMaxWidthLayoutResult
getMinMaxWidth, setMinMaxWidthMethods inherited from class com.itextpdf.layout.layout.LayoutResult
getAreaBreak, getCauseOfNothing, getOccupiedArea, getOverflowRenderer, getSplitRenderer, getStatus, setAreaBreak, setOverflowRenderer, setSplitRenderer, setStatus, toString
-
Field Details
-
wordHasBeenSplit
protected boolean wordHasBeenSplitIndicates whether some word was split duringlayout. -
splitForcedByNewline
protected boolean splitForcedByNewlineIndicates 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 Details
-
TextLayoutResult
public TextLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRenderer, IRenderer overflowRenderer) Creates theresult of layouting. TheLayoutResult.causeOfNothingwill be set as null.- Parameters:
-
status- the status ofTextRenderer.layout(LayoutContext) -
occupiedArea- the area occupied by the content -
splitRenderer- the renderer to draw the split part of the content -
overflowRenderer- 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 layouting.- Parameters:
-
status- the status ofTextRenderer.layout(LayoutContext) -
occupiedArea- the area occupied by the content -
splitRenderer- the renderer to draw the split part of the content -
overflowRenderer- the renderer to draw the overflowed part of the content -
cause- the first renderer to produceLayoutResult.NOTHING
-
-
Method Details
-
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
SetswordHasBeenSplit- Parameters:
-
wordHasBeenSplit- indicates that some word was split duringlayout. - Returns:
-
this layout resultthe setting was applied on - See Also:
-
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
- Parameters:
-
isSplitForcedByNewline- indicates that split was forced by new line symbol in rendered text. - Returns:
-
this layout resultthe setting was applied on. - See Also:
-
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:
-
setContainsPossibleBreak
- Parameters:
-
containsPossibleBreak- indicates that split renderer contains possible break. - Returns:
-
this layout resultthe setting was applied on. - See Also:
-
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
public boolean isStartsWithSplitCharacterWhiteSpace()Indicates whether TextRenderer#line starts with a whitespace.- Returns:
- true if TextRenderer#line starts with a whitespace.
-
setEndsWithSplitCharacter
- Parameters:
-
endsWithSplitCharacter- indicates if TextRenderer#line ends with a splitCharacter. - Returns:
-
this layout resultthe setting was applied on. - See Also:
-
isEndsWithSplitCharacter
public boolean isEndsWithSplitCharacter()Indicates whether TextRenderer#line ends with a splitCharacter.- Returns:
- true if TextRenderer#line ends with a splitCharacter.
- See Also:
-
setLeftMinWidth
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
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.
-