Package org.apache.fop.layoutmgr.inline
Class TextLayoutManager.TextAreaBuilder
java.lang.Object
org.apache.fop.layoutmgr.inline.TextLayoutManager.TextAreaBuilder
- Enclosing class:
- TextLayoutManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private int
private final LayoutContext
private final int
private final Font
private int[][]
private int
private final boolean
private final int
private int[]
private int
private GlyphMapping
private TextArea
private final MinOptMax
private StringBuffer
private int
private int[]
private int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
TextAreaBuilder
(MinOptMax width, int adjust, LayoutContext context, int firstIndex, int lastIndex, boolean isLastArea, Font font) Creates a newTextAreaBuilder
which itself builds an inline word area. -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
addGlyphPositionAdjustments
(GlyphMapping wordMapping) Given a word area info associated with a word fragment, concatenate glyph position adjustments for each (possibly mapped) character.private void
private void
addLetterAdjust
(GlyphMapping wordMapping) Given a word area info associated with a word fragment, concatenate letter space adjustments for each (possibly mapped) character.private void
TheGlyphMapping
stores information about spaces.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.private void
addWordChars
(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 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.private TextArea
build()
private void
private void
Creates an plainTextArea
or a justifiedTextArea
with additional information.private int[]
getMappingBidiLevels
(GlyphMapping mapping) Obtain bidirectional levels of mapping of characters over specific interval.private int[]
private void
initWord
(int wordLength) Fully allocate word character buffer, letter space adjustments array, bidi levels array, and glyph position adjustments array.private boolean
isHyphenated
(int endIndex) private boolean
isWordEnd
(int mappingIndex) private boolean
isWordSpace
(int mappingIndex) private void
private void
private void
private void
private void
setText()
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 newTextAreaBuilder
which 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 plainTextArea
or a justifiedTextArea
with 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()TheGlyphMapping
stores information about spaces.Add the spaces - except zero-width spaces - to the TextArea.
-