Class TextLayoutManager.TextAreaBuilder
java.lang.Object
org.apache.fop.layoutmgr.inline.TextLayoutManager.TextAreaBuilder
- Enclosing class:
TextLayoutManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate intprivate final LayoutContextprivate final intprivate final Fontprivate int[][]private intprivate final booleanprivate final intprivate int[]private intprivate GlyphMappingprivate TextAreaprivate final MinOptMaxprivate StringBufferprivate intprivate int[]private int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTextAreaBuilder(MinOptMax width, int adjust, LayoutContext context, int firstIndex, int lastIndex, boolean isLastArea, Font font) Creates a newTextAreaBuilderwhich itself builds an inline word area. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanaddGlyphPositionAdjustments(GlyphMapping wordMapping) Given a word area info associated with a word fragment, concatenate glyph position adjustments for each (possibly mapped) character.private voidprivate voidaddLetterAdjust(GlyphMapping wordMapping) Given a word area info associated with a word fragment, concatenate letter space adjustments for each (possibly mapped) character.private voidTheGlyphMappingstores information about spaces.private voidaddWord(int startIndex, int endIndex, int wordLength) Add word with fragments from STARTINDEX to ENDINDEX, where total length of (possibly mapped) word is CHARLENGTH.private voidaddWordChars(GlyphMapping wordMapping) Given a word area info associated with a word fragment, (1) concatenate (possibly mapped) word characters to word character buffer; (2) concatenante (possibly mapped) word bidi levels to levels buffer; (3) update word's IPD with optimal IPD of fragment.private voidaddWordLevels(int[] levels) Given a (possibly null) bidi levels array associated with a word fragment, concatenante (possibly mapped) word bidi levels to levels buffer.private TextAreabuild()private voidprivate voidCreates an plainTextAreaor a justifiedTextAreawith additional information.private int[]getMappingBidiLevels(GlyphMapping mapping) Obtain bidirectional levels of mapping of characters over specific interval.private int[]private voidinitWord(int wordLength) Fully allocate word character buffer, letter space adjustments array, bidi levels array, and glyph position adjustments array.private booleanisHyphenated(int endIndex) private booleanisWordEnd(int mappingIndex) private booleanisWordSpace(int mappingIndex) private voidprivate voidprivate voidprivate voidprivate voidsetText()Sets the text of the TextArea, split into words and spaces.
-
Field Details
-
width
-
adjust
private final int adjust -
context
-
firstIndex
private final int firstIndex -
lastIndex
private final int lastIndex -
isLastArea
private final boolean isLastArea -
font
-
textArea
-
blockProgressionDimension
private int blockProgressionDimension -
mapping
-
wordChars
-
letterSpaceAdjust
private int[] letterSpaceAdjust -
letterSpaceAdjustIndex
private int letterSpaceAdjustIndex -
wordLevels
private int[] wordLevels -
wordLevelsIndex
private int wordLevelsIndex -
wordIPD
private int wordIPD -
gposAdjustments
private int[][] gposAdjustments -
gposAdjustmentsIndex
private int gposAdjustmentsIndex
-
-
Constructor Details
-
TextAreaBuilder
private TextAreaBuilder(MinOptMax width, int adjust, LayoutContext context, int firstIndex, int lastIndex, boolean isLastArea, Font font) Creates a newTextAreaBuilderwhich itself builds an inline word area. This creates a TextArea and sets up the various attributes.- Parameters:
width- the MinOptMax width of the contentadjust- the total ipd adjustment with respect to the optimal widthcontext- the layout contextfirstIndex- the index of the first GlyphMapping used for the TextArealastIndex- the index of the last GlyphMapping used for the TextAreaisLastArea- is this TextArea the last in a line?font- Font to be used in this particular TextArea
-
-
Method Details
-
build
-
createTextArea
private void createTextArea()Creates an plainTextAreaor a justifiedTextAreawith additional information. -
setInlineProgressionDimension
private void setInlineProgressionDimension() -
calcBlockProgressionDimension
private void calcBlockProgressionDimension() -
setBlockProgressionDimension
private void setBlockProgressionDimension() -
setBaselineOffset
private void setBaselineOffset() -
setBlockProgressionOffset
private void setBlockProgressionOffset() -
setText
private void setText()Sets the text of the TextArea, split into words and spaces. -
isWordEnd
private boolean isWordEnd(int mappingIndex) -
addWord
private void addWord(int startIndex, int endIndex, int wordLength) Add word with fragments from STARTINDEX to ENDINDEX, where total length of (possibly mapped) word is CHARLENGTH. A word is composed from one or more word fragments, where each fragment corresponds to distinct instance in a sequence of area info instances starting at STARTINDEX continuing through (and including) ENDINDEX.- Parameters:
startIndex- index of first area info of word to addendIndex- index of last area info of word to addwordLength- number of (mapped) characters in word
-
isWordSpace
private boolean isWordSpace(int mappingIndex) -
getNonEmptyLevels
private int[] getNonEmptyLevels() -
initWord
private void initWord(int wordLength) Fully allocate word character buffer, letter space adjustments array, bidi levels array, and glyph position adjustments array. based on full word length, including all (possibly mapped) fragments.- Parameters:
wordLength- length of word including all (possibly mapped) fragments
-
isHyphenated
private boolean isHyphenated(int endIndex) -
addHyphenationChar
private void addHyphenationChar() -
addWordChars
Given a word area info associated with a word fragment, (1) concatenate (possibly mapped) word characters to word character buffer; (2) concatenante (possibly mapped) word bidi levels to levels buffer; (3) update word's IPD with optimal IPD of fragment.- Parameters:
wordMapping- fragment info
-
getMappingBidiLevels
Obtain bidirectional levels of mapping of characters over specific interval.- Parameters:
start- index in character bufferend- index in character buffer- Returns:
- a (possibly empty) array of bidi levels or null in case no bidi levels have been assigned
-
addWordLevels
private void addWordLevels(int[] levels) Given a (possibly null) bidi levels array associated with a word fragment, concatenante (possibly mapped) word bidi levels to levels buffer.- Parameters:
levels- bidi levels array or null
-
addLetterAdjust
Given a word area info associated with a word fragment, concatenate letter space adjustments for each (possibly mapped) character.- Parameters:
wordMapping- fragment info
-
addGlyphPositionAdjustments
Given a word area info associated with a word fragment, concatenate glyph position adjustments for each (possibly mapped) character.- Parameters:
wordMapping- fragment info- Returns:
- true if an adjustment was non-zero
-
addSpaces
private void addSpaces()TheGlyphMappingstores information about spaces.Add the spaces - except zero-width spaces - to the TextArea.
-