@@ -51,21 +51,27 @@ This file is part of the iText (R) project.
51
51
public class TextLayoutResult extends MinMaxWidthLayoutResult {
52
52
53
53
/**
54
- * Indicates whether some word was splitted during {@link com.itextpdf.layout.renderer.TextRenderer#layout(LayoutContext) layout}.
54
+ * Indicates whether some word was split during {@link com.itextpdf.layout.renderer.TextRenderer#layout(LayoutContext) layout}.
55
55
*/
56
56
protected boolean wordHasBeenSplit ;
57
57
/**
58
58
* Indicates whether split was forced by new line symbol in text or not.
59
59
*/
60
60
protected boolean splitForcedByNewline ;
61
61
62
+ protected boolean containsPossibleBreak = false ;
63
+
64
+ protected boolean lineStartsWithWhiteSpace = false ;
65
+
66
+ protected boolean lineEndsWithSplitCharacterOrWhiteSpace = false ;
67
+
62
68
/**
63
69
* Creates the {@link LayoutResult result of {@link com.itextpdf.layout.renderer.TextRenderer#layout(LayoutContext) layouting}}.
64
70
* The {@link LayoutResult#causeOfNothing} will be set as null.
65
71
*
66
72
* @param status the status of {@link com.itextpdf.layout.renderer.TextRenderer#layout(LayoutContext)}
67
73
* @param occupiedArea the area occupied by the content
68
- * @param splitRenderer the renderer to draw the splitted part of the content
74
+ * @param splitRenderer the renderer to draw the split part of the content
69
75
* @param overflowRenderer the renderer to draw the overflowed part of the content
70
76
*/
71
77
public TextLayoutResult (int status , LayoutArea occupiedArea , IRenderer splitRenderer , IRenderer overflowRenderer ) {
@@ -77,7 +83,7 @@ public TextLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRend
77
83
*
78
84
* @param status the status of {@link com.itextpdf.layout.renderer.TextRenderer#layout(LayoutContext)}
79
85
* @param occupiedArea the area occupied by the content
80
- * @param splitRenderer the renderer to draw the splitted part of the content
86
+ * @param splitRenderer the renderer to draw the split part of the content
81
87
* @param overflowRenderer the renderer to draw the overflowed part of the content
82
88
* @param cause the first renderer to produce {@link LayoutResult#NOTHING}
83
89
*/
@@ -89,7 +95,7 @@ public TextLayoutResult(int status, LayoutArea occupiedArea, IRenderer splitRend
89
95
* Indicates whether some word in a rendered text was split during {@link com.itextpdf.layout.renderer.IRenderer#layout layout}.
90
96
* The value will be set as true if, for example, the rendered words width is bigger than the width of layout area.
91
97
*
92
- * @return whether some word was splitted or not.
98
+ * @return whether some word was split or not.
93
99
*/
94
100
public boolean isWordHasBeenSplit () {
95
101
return wordHasBeenSplit ;
@@ -128,4 +134,70 @@ public TextLayoutResult setSplitForcedByNewline(boolean isSplitForcedByNewline)
128
134
this .splitForcedByNewline = isSplitForcedByNewline ;
129
135
return this ;
130
136
}
137
+
138
+ /**
139
+ * Indicates whether split renderer contains possible break.
140
+ * Possible breaks are either whitespaces or split characters.
141
+ *
142
+ * @return true if there's a possible break within the split renderer.
143
+ * @see com.itextpdf.layout.splitting.ISplitCharacters
144
+ */
145
+ public boolean isContainsPossibleBreak () {
146
+ return containsPossibleBreak ;
147
+ }
148
+
149
+ /**
150
+ * Sets {@link #isContainsPossibleBreak()}.
151
+ *
152
+ * @param containsPossibleBreak indicates that split renderer contains possible break.
153
+ * @return {@link com.itextpdf.layout.layout.TextLayoutResult this layout result} the setting was applied on.
154
+ * @see #isContainsPossibleBreak
155
+ */
156
+ public TextLayoutResult setContainsPossibleBreak (boolean containsPossibleBreak ) {
157
+ this .containsPossibleBreak = containsPossibleBreak ;
158
+ return this ;
159
+ }
160
+
161
+ /**
162
+ * Sets {@link #isLineStartsWithWhiteSpace()}.
163
+ *
164
+ * @param lineStartsWithWhiteSpace indicates if TextRenderer#line starts with a whitespace.
165
+ * @return {@link com.itextpdf.layout.layout.TextLayoutResult this layout result} the setting was applied on.
166
+ * @see #isLineStartsWithWhiteSpace
167
+ */
168
+ public TextLayoutResult setLineStartsWithWhiteSpace (boolean lineStartsWithWhiteSpace ) {
169
+ this .lineStartsWithWhiteSpace = lineStartsWithWhiteSpace ;
170
+ return this ;
171
+ }
172
+
173
+ /**
174
+ * Indicates whether TextRenderer#line starts with a whitespace.
175
+ *
176
+ * @return true if TextRenderer#line starts with a whitespace.
177
+ */
178
+ public boolean isLineStartsWithWhiteSpace () {
179
+ return lineStartsWithWhiteSpace ;
180
+ }
181
+
182
+ /**
183
+ * Sets {@link #isLineEndsWithSplitCharacterOrWhiteSpace()}.
184
+ *
185
+ * @param lineEndsWithSplitCharacterOrWhiteSpace indicates if TextRenderer#line ends with a splitCharacter.
186
+ * @return {@link com.itextpdf.layout.layout.TextLayoutResult this layout result} the setting was applied on.
187
+ * @see #isLineEndsWithSplitCharacterOrWhiteSpace
188
+ */
189
+ public TextLayoutResult setLineEndsWithSplitCharacterOrWhiteSpace (boolean lineEndsWithSplitCharacterOrWhiteSpace ) {
190
+ this .lineEndsWithSplitCharacterOrWhiteSpace = lineEndsWithSplitCharacterOrWhiteSpace ;
191
+ return this ;
192
+ }
193
+
194
+ /**
195
+ * Indicates whether TextRenderer#line ends with a splitCharacter.
196
+ *
197
+ * @return true if TextRenderer#line ends with a splitCharacter.
198
+ * @see com.itextpdf.layout.splitting.ISplitCharacters
199
+ */
200
+ public boolean isLineEndsWithSplitCharacterOrWhiteSpace () {
201
+ return lineEndsWithSplitCharacterOrWhiteSpace ;
202
+ }
131
203
}
0 commit comments