Package com.itextpdf.layout.renderer
Class TextSequenceWordWrapping
java.lang.Object
com.itextpdf.layout.renderer.TextSequenceWordWrapping
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
(package private) static class
(package private) static enum
(package private) static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertPossibleBreakPointsToGlyphLineBased
(List<Integer> possibleBreakPoints, List<Integer> amountOfChars, List<Integer> indices) (package private) static void
distributePossibleBreakPointsOverSequentialTextRenderers
(LineRenderer lineRenderer, int childPos, int numberOfSequentialTextRenderers, List<Integer> possibleBreakPointsGlobal, List<Integer> indicesOfFloating) private static void
fillActualTextChunkRelatedLists
(GlyphLine glyphLine, List<Integer> amountOfCharsBetweenTextStartAndActualTextChunk, List<Integer> glyphLineBasedIndicesOfActualTextChunkEnds) (package private) static float
getCurWidthRelayoutedTextSequenceDecrement
(int childPos, int newChildPos, Map<Integer, LayoutResult> textRendererLayoutResults) getIndexAndLayoutResultOfTheLastTextRendererContainingSpecialScripts
(LineRenderer lineRenderer, int childPos, Map<Integer, LayoutResult> specialScriptLayoutResults, boolean wasParentsHeightClipped, boolean isOverflowFit) getIndexAndLayoutResultOfTheLastTextRendererWithNoSpecialScripts
(LineRenderer lineRenderer, int childPos, Map<Integer, LayoutResult> textSequenceLayoutResults, boolean wasParentsHeightClipped, boolean isOverflowFit, boolean floatsPlaced) (package private) static TextSequenceWordWrapping.SpecialScriptsContainingSequenceStatus
getSpecialScriptsContainingSequenceStatus
(LineRenderer lineRenderer, int analyzedTextRendererIndex) This method defines how to proceed with aTextRenderer
within which possible breaks haven't been found.(package private) static TextSequenceWordWrapping.SpecialScriptsContainingTextRendererSequenceInfo
getSpecialScriptsContainingTextRendererSequenceInfo
(LineRenderer lineRenderer, int childPos) static boolean
static boolean
postprocessTextSequenceOverflowX
(LineRenderer lineRenderer, boolean textSequenceOverflowXProcessing, int childPos, IRenderer childRenderer, LayoutResult childResult, boolean wasXOverflowChanged) Checks if the layouting should be stopped on current child and resets configurations set onpreprocessTextSequenceOverflowX(LineRenderer, boolean, IRenderer, boolean, OverflowPropertyValue)
.static void
preprocessTextSequenceOverflowX
(LineRenderer lineRenderer, boolean textSequenceOverflowXProcessing, IRenderer childRenderer, boolean wasXOverflowChanged, OverflowPropertyValue oldXOverflow) Performs some settings onLineRenderer
and its child prior to layouting the child to be overflowed beyond the available area.static void
processSpecialScriptPreLayout
(LineRenderer lineRenderer, int childPos) Preprocess a continuous sequence of TextRenderer containing special scripts prior to layouting the first TextRenderer in the sequence.static void
resetTextSequenceIfItEnded
(Map<Integer, LayoutResult> textRendererLayoutResults, boolean specialScripts, IRenderer childRenderer, int childPos, TextSequenceWordWrapping.MinMaxWidthOfTextRendererSequenceHelper minMaxWidthOfTextRendererSequenceHelper, boolean noSoftWrap, AbstractWidthHandler widthHandler) private static void
updateMinMaxWidthOfLineRendererAfterTextRendererSequenceProcessing
(boolean noSoftWrap, int childPos, LayoutResult layoutResult, AbstractWidthHandler widthHandler, TextSequenceWordWrapping.MinMaxWidthOfTextRendererSequenceHelper minMaxWidthOfTextRendererSequenceHelper, Map<Integer, LayoutResult> textRendererLayoutResults) updateTextRendererSequenceAscentDescent
(LineRenderer lineRenderer, Map<Integer, float[]> textRendererSequenceAscentDescent, int childPos, float[] childAscentDescent, LineRenderer.LineAscentDescentState preTextSequenceAscentDescent) updateTextRendererSequenceMinMaxWidth
(LineRenderer lineRenderer, AbstractWidthHandler widthHandler, int childPos, TextSequenceWordWrapping.MinMaxWidthOfTextRendererSequenceHelper minMaxWidthOfTextRendererSequenceHelper, boolean anythingPlaced, Map<Integer, LayoutResult> textRendererLayoutResults, Map<Integer, LayoutResult> specialScriptLayoutResults, float textIndent) static void
updateTextSequenceLayoutResults
(Map<Integer, LayoutResult> textRendererLayoutResults, boolean specialScripts, IRenderer childRenderer, int childPos, LayoutResult childResult)
-
Field Details
-
OCCUPIED_AREA_RELAYOUT_EPS
private static final float OCCUPIED_AREA_RELAYOUT_EPS- See Also:
-
-
Constructor Details
-
TextSequenceWordWrapping
private TextSequenceWordWrapping()
-
-
Method Details
-
isTextRendererAndRequiresSpecialScriptPreLayoutProcessing
public static boolean isTextRendererAndRequiresSpecialScriptPreLayoutProcessing(IRenderer childRenderer) -
processSpecialScriptPreLayout
Preprocess a continuous sequence of TextRenderer containing special scripts prior to layouting the first TextRenderer in the sequence.In this method we preprocess a sequence containing special scripts only, skipping floating renderers as they're not part of a regular layout flow, and breaking the prelayout processing once a non-special script containing renderer occurs. Note! Even though floats are skipped during calculating correct word boundaries, floats themselves are considered as soft-wrap opportunities.
Prelayout processing includes the following steps:
getSpecialScriptsContainingTextRendererSequenceInfo(LineRenderer, int)
: determine boundaries of the sequence and concatenate its TextRenderer#text fields converted to a String representation;- get the String analyzed with WordWrapper#getPossibleBreaks and receive a zero-based array of points where the String is allowed to got broken in lines;
distributePossibleBreakPointsOverSequentialTextRenderers(LineRenderer, int, int, List, List)
: distribute the list over the TextRenderer#specialScriptsWordBreakPoints, preliminarily having the points shifted, so that each TextRenderer#specialScriptsWordBreakPoints is based on the first element of TextRenderer#text.
- Parameters:
lineRenderer
- line renderer containing text sequence to processchildPos
- index of the childRenderer in LineRenderer#childRenderers from which the a continuous sequence of TextRenderer containing special scripts starts
-
updateTextSequenceLayoutResults
public static void updateTextSequenceLayoutResults(Map<Integer, LayoutResult> textRendererLayoutResults, boolean specialScripts, IRenderer childRenderer, int childPos, LayoutResult childResult) -
resetTextSequenceIfItEnded
public static void resetTextSequenceIfItEnded(Map<Integer, LayoutResult> textRendererLayoutResults, boolean specialScripts, IRenderer childRenderer, int childPos, TextSequenceWordWrapping.MinMaxWidthOfTextRendererSequenceHelper minMaxWidthOfTextRendererSequenceHelper, boolean noSoftWrap, AbstractWidthHandler widthHandler) -
updateTextRendererSequenceAscentDescent
public static LineRenderer.LineAscentDescentState updateTextRendererSequenceAscentDescent(LineRenderer lineRenderer, Map<Integer, float[]> textRendererSequenceAscentDescent, int childPos, float[] childAscentDescent, LineRenderer.LineAscentDescentState preTextSequenceAscentDescent) -
updateTextRendererSequenceMinMaxWidth
public static TextSequenceWordWrapping.MinMaxWidthOfTextRendererSequenceHelper updateTextRendererSequenceMinMaxWidth(LineRenderer lineRenderer, AbstractWidthHandler widthHandler, int childPos, TextSequenceWordWrapping.MinMaxWidthOfTextRendererSequenceHelper minMaxWidthOfTextRendererSequenceHelper, boolean anythingPlaced, Map<Integer, LayoutResult> textRendererLayoutResults, Map<Integer, LayoutResult> specialScriptLayoutResults, float textIndent) -
getIndexAndLayoutResultOfTheLastTextRendererWithNoSpecialScripts
public static TextSequenceWordWrapping.LastFittingChildRendererData getIndexAndLayoutResultOfTheLastTextRendererWithNoSpecialScripts(LineRenderer lineRenderer, int childPos, Map<Integer, LayoutResult> textSequenceLayoutResults, boolean wasParentsHeightClipped, boolean isOverflowFit, boolean floatsPlaced) -
getIndexAndLayoutResultOfTheLastTextRendererContainingSpecialScripts
public static TextSequenceWordWrapping.LastFittingChildRendererData getIndexAndLayoutResultOfTheLastTextRendererContainingSpecialScripts(LineRenderer lineRenderer, int childPos, Map<Integer, LayoutResult> specialScriptLayoutResults, boolean wasParentsHeightClipped, boolean isOverflowFit) -
preprocessTextSequenceOverflowX
public static void preprocessTextSequenceOverflowX(LineRenderer lineRenderer, boolean textSequenceOverflowXProcessing, IRenderer childRenderer, boolean wasXOverflowChanged, OverflowPropertyValue oldXOverflow) Performs some settings onLineRenderer
and its child prior to layouting the child to be overflowed beyond the available area.- Parameters:
lineRenderer
- line renderer containing text sequence to processtextSequenceOverflowXProcessing
- true if it isTextRenderer
sequence processing in overflowX modechildRenderer
- theLineRenderer
's child to be preprocessedwasXOverflowChanged
- true if value ofProperty.OVERFLOW_X
has been changed during layoutingoldXOverflow
- the value ofProperty.OVERFLOW_X
before it's been changed during layouting ofLineRenderer
or null ifProperty.OVERFLOW_X
hasn't been changed
-
postprocessTextSequenceOverflowX
public static boolean postprocessTextSequenceOverflowX(LineRenderer lineRenderer, boolean textSequenceOverflowXProcessing, int childPos, IRenderer childRenderer, LayoutResult childResult, boolean wasXOverflowChanged) Checks if the layouting should be stopped on current child and resets configurations set onpreprocessTextSequenceOverflowX(LineRenderer, boolean, IRenderer, boolean, OverflowPropertyValue)
.- Parameters:
lineRenderer
- line renderer containing text sequence to processtextSequenceOverflowXProcessing
- true if it isTextRenderer
sequence processing in overflowX modechildRenderer
- theLineRenderer
's child to be preprocessedwasXOverflowChanged
- true if value ofProperty.OVERFLOW_X
has been changed during layouting
-
getSpecialScriptsContainingTextRendererSequenceInfo
static TextSequenceWordWrapping.SpecialScriptsContainingTextRendererSequenceInfo getSpecialScriptsContainingTextRendererSequenceInfo(LineRenderer lineRenderer, int childPos) -
distributePossibleBreakPointsOverSequentialTextRenderers
static void distributePossibleBreakPointsOverSequentialTextRenderers(LineRenderer lineRenderer, int childPos, int numberOfSequentialTextRenderers, List<Integer> possibleBreakPointsGlobal, List<Integer> indicesOfFloating) -
getSpecialScriptsContainingSequenceStatus
static TextSequenceWordWrapping.SpecialScriptsContainingSequenceStatus getSpecialScriptsContainingSequenceStatus(LineRenderer lineRenderer, int analyzedTextRendererIndex) This method defines how to proceed with aTextRenderer
within which possible breaks haven't been found. Possible scenarios are: - Preceding renderer is also an instance ofTextRenderer
and does contain special scripts:getIndexAndLayoutResultOfTheLastTextRendererContainingSpecialScripts(LineRenderer, int, Map, boolean, boolean)
will proceed to analyze the precedingTextRenderer
on the subject of possible breaks; - Preceding renderer is either an instance ofTextRenderer
which does not contain special scripts, or an instance ofImageRenderer
or is an inlineBlock child: in this case the entire subsequence ofTextRenderer
-s containing special scripts is to be moved to the next line; - Otherwise a forced split is to happen.- Parameters:
lineRenderer
- line renderer containing text sequence to processanalyzedTextRendererIndex
- index of the latter child that has been analyzed on the subject of possible breaks- Returns:
TextSequenceWordWrapping.SpecialScriptsContainingSequenceStatus
instance standing for the strategy to proceed with.
-
getCurWidthRelayoutedTextSequenceDecrement
static float getCurWidthRelayoutedTextSequenceDecrement(int childPos, int newChildPos, Map<Integer, LayoutResult> textRendererLayoutResults) -
updateMinMaxWidthOfLineRendererAfterTextRendererSequenceProcessing
private static void updateMinMaxWidthOfLineRendererAfterTextRendererSequenceProcessing(boolean noSoftWrap, int childPos, LayoutResult layoutResult, AbstractWidthHandler widthHandler, TextSequenceWordWrapping.MinMaxWidthOfTextRendererSequenceHelper minMaxWidthOfTextRendererSequenceHelper, Map<Integer, LayoutResult> textRendererLayoutResults) -
convertPossibleBreakPointsToGlyphLineBased
-
fillActualTextChunkRelatedLists
-