Class TextLayoutManager.TextAreaBuilder

  • Enclosing class:
    TextLayoutManager

    private final class TextLayoutManager.TextAreaBuilder
    extends java.lang.Object
    • Field Detail

      • adjust

        private final int adjust
      • firstIndex

        private final int firstIndex
      • lastIndex

        private final int lastIndex
      • isLastArea

        private final boolean isLastArea
      • font

        private final Font font
      • blockProgressionDimension

        private int blockProgressionDimension
      • 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 new TextAreaBuilder which itself builds an inline word area. This creates a TextArea and sets up the various attributes.
        Parameters:
        width - the MinOptMax width of the content
        adjust - the total ipd adjustment with respect to the optimal width
        context - the layout context
        firstIndex - the index of the first GlyphMapping used for the TextArea
        lastIndex - the index of the last GlyphMapping used for the TextArea
        isLastArea - is this TextArea the last in a line?
        font - Font to be used in this particular TextArea
    • Method Detail

      • createTextArea

        private void createTextArea()
        Creates an plain TextArea or a justified TextArea 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 add
        endIndex - index of last area info of word to add
        wordLength - 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 buffer
        end - 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()
        The GlyphMapping stores information about spaces.

        Add the spaces - except zero-width spaces - to the TextArea.