Package org.apache.fop.layoutmgr.inline
Class TextLayoutManager.TextAreaBuilder
- java.lang.Object
-
- org.apache.fop.layoutmgr.inline.TextLayoutManager.TextAreaBuilder
-
- Enclosing class:
- TextLayoutManager
private final class TextLayoutManager.TextAreaBuilder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private int
adjust
private int
blockProgressionDimension
private LayoutContext
context
private int
firstIndex
private Font
font
private int[][]
gposAdjustments
private int
gposAdjustmentsIndex
private boolean
isLastArea
private int
lastIndex
private int[]
letterSpaceAdjust
private int
letterSpaceAdjustIndex
private GlyphMapping
mapping
private TextArea
textArea
private MinOptMax
width
private java.lang.StringBuffer
wordChars
private int
wordIPD
private int[]
wordLevels
private int
wordLevelsIndex
-
Constructor Summary
Constructors Modifier Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private 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
addHyphenationChar()
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
addSpaces()
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
calcBlockProgressionDimension()
private void
createTextArea()
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[]
getNonEmptyLevels()
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
setBaselineOffset()
private void
setBlockProgressionDimension()
private void
setBlockProgressionOffset()
private void
setInlineProgressionDimension()
private void
setText()
Sets the text of the TextArea, split into words and spaces.
-
-
-
Field Detail
-
width
private final MinOptMax width
-
adjust
private final int adjust
-
context
private final LayoutContext context
-
firstIndex
private final int firstIndex
-
lastIndex
private final int lastIndex
-
isLastArea
private final boolean isLastArea
-
font
private final Font font
-
textArea
private TextArea textArea
-
blockProgressionDimension
private int blockProgressionDimension
-
mapping
private GlyphMapping mapping
-
wordChars
private java.lang.StringBuffer 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 Detail
-
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 Detail
-
build
private TextArea 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
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.- Parameters:
wordMapping
- fragment info
-
getMappingBidiLevels
private int[] getMappingBidiLevels(GlyphMapping mapping)
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
private void addLetterAdjust(GlyphMapping wordMapping)
Given a word area info associated with a word fragment, concatenate letter space adjustments for each (possibly mapped) character.- Parameters:
wordMapping
- fragment info
-
addGlyphPositionAdjustments
private boolean addGlyphPositionAdjustments(GlyphMapping wordMapping)
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.
-
-