org.apache.fop.area.inline

## Class WordArea

- java.lang.Object
- - org.apache.fop.area.AreaTreeObject
  - - org.apache.fop.area.Area
    - - org.apache.fop.area.inline.InlineArea
      - - org.apache.fop.area.inline.WordArea

- All Implemented Interfaces:
    Serializable, Cloneable

      public class WordArea
      extends InlineArea

  A string of characters without spaces
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.fop.area.inline.InlineArea

      `InlineArea.InlineAdjustingInfo`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int[][]` | `gposAdjustments` An array of glyph positioning adjustments to apply to each glyph 'char' in word (optional)
    `protected int[]` | `letterAdjust` An array of width for adjusting the individual letters (optional)
    `protected int[]` | `levels` An array of resolved bidirectional levels corresponding to each character in word (optional)
    `protected boolean` | `reversed` A flag indicating whether the content of word is reversed in relation to its original logical order.
    `protected String` | `word` The text for this word area

    - ### Fields inherited from class org.apache.fop.area.inline.InlineArea

      `adjustingInfo, blockProgressionOffset`

    - ### Fields inherited from class org.apache.fop.area.Area

      `bidiLevel, bpd, CLASS_ABSOLUTE, CLASS_BEFORE_FLOAT, CLASS_FIXED, CLASS_FOOTNOTE, CLASS_MAX, CLASS_NORMAL, CLASS_SIDE_FLOAT, effectiveIPD, ipd, log, ORIENT_0, ORIENT_180, ORIENT_270, ORIENT_90, traits`

    - ### Fields inherited from class org.apache.fop.area.AreaTreeObject

      `extensionAttachments, foreignAttributes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WordArea(int blockProgressionOffset, int level, String word, int[] letterAdjust, int[] levels, int[][] gposAdjustments)` Create a word area
    `WordArea(int blockProgressionOffset, int level, String word, int[] letterAdjust, int[] levels, int[][] gposAdjustments, boolean reversed)`
    `WordArea(int blockProgressionOffset, int level, String word, int[] letterAdjust, int[] levels, int[][] gposAdjustments, boolean reversed, boolean nextIsSpace)` Create a word area

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `bidiLevelAt(int position)` Obtain per-character (glyph) level at a specified index position.
    `List` | `collectInlineRuns(List runs)` Collection bidi inline runs.
    `int[]` | `getBidiLevels()` Obtain per-character (glyph) bidi levels.
    `int[]` | `getBidiLevels(int start, int end)` Obtain per-character (glyph) bidi levels over a specified subsequence.
    `int[][]` | `getGlyphPositionAdjustments()` Obtain per-character (glyph) position adjustments.
    `int[]` | `getLetterAdjustArray()`
    `String` | `getWord()`
    `int[]` | `glyphPositionAdjustmentsAt(int position)` Obtain per-character (glyph) position adjustments at a specified index position.
    `boolean` | `isNextIsSpace()`
    `boolean` | `isReversed()` Determined if word has been reversed (in relation to original logical order).
    `void` | `mirror()` Perform mirroring on mirrorable characters.
    `void` | `reverse(boolean mirror)` Reverse characters and corresponding per-character levels and glyph position adjustments.

    - ### Methods inherited from class org.apache.fop.area.inline.InlineArea

      `addChildArea, applyVariationFactor, getAdjustingInfo, getBlockProgressionOffset, getParentArea, handleIPDVariation, hasLineThrough, hasOverline, hasUnderline, increaseIPD, isAncestor, isAncestorOrSelf, isBlinking, notifyIPDVariation, setAdjustingInfo, setAdjustingInfo, setAdjustment, setBlockProgressionOffset, setParentArea`

    - ### Methods inherited from class org.apache.fop.area.Area

      `activateEffectiveIPD, addTrait, clone, getAllocBPD, getAllocIPD, getAreaClass, getBidiLevel, getBorderAndPaddingWidthAfter, getBorderAndPaddingWidthBefore, getBorderAndPaddingWidthEnd, getBorderAndPaddingWidthStart, getBPD, getChangeBarList, getEffectiveAllocIPD, getEffectiveIPD, getIPD, getSpaceAfter, getSpaceBefore, getSpaceEnd, getSpaceStart, getTrait, getTraitAsBoolean, getTraitAsInteger, getTraits, hasTrait, hasTraits, resetBidiLevel, setAreaClass, setBidiLevel, setBPD, setChangeBarList, setIPD, setTraits, setWritingModeTraits, toString`

    - ### Methods inherited from class org.apache.fop.area.AreaTreeObject

      `addExtensionAttachment, getExtensionAttachments, getForeignAttributes, getForeignAttributeValue, hasExtensionAttachments, setExtensionAttachments, setForeignAttribute, setForeignAttributes`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### word

          protected String word

      The text for this word area

    - #### letterAdjust

          protected int[] letterAdjust

      An array of width for adjusting the individual letters (optional)

    - #### levels

          protected int[] levels

      An array of resolved bidirectional levels corresponding to each character in word (optional)

    - #### gposAdjustments

          protected int[][] gposAdjustments

      An array of glyph positioning adjustments to apply to each glyph 'char' in word (optional)

    - #### reversed

          protected boolean reversed

      A flag indicating whether the content of word is reversed in relation to its original logical order.

  - ### Constructor Detail

    - #### WordArea

          public WordArea(int blockProgressionOffset,
                          int level,
                          String word,
                          int[] letterAdjust,
                          int[] levels,
                          int[][] gposAdjustments,
                          boolean reversed,
                          boolean nextIsSpace)

      Create a word area
      Parameters:
        `blockProgressionOffset` - the offset for this area
        `level` - the bidirectional embedding level (or -1 if not defined) for word as a group
        `word` - the word string
        `letterAdjust` - the letter adjust array (may be null)
        `levels` - array of per-character (glyph) bidirectional levels, in case word area is heterogenously leveled
        `gposAdjustments` - array of general position adjustments or null if none apply
        `reversed` - true if word is known to be reversed at construction time

    - #### WordArea

          public WordArea(int blockProgressionOffset,
                          int level,
                          String word,
                          int[] letterAdjust,
                          int[] levels,
                          int[][] gposAdjustments,
                          boolean reversed)

    - #### WordArea

          public WordArea(int blockProgressionOffset,
                          int level,
                          String word,
                          int[] letterAdjust,
                          int[] levels,
                          int[][] gposAdjustments)

      Create a word area
      Parameters:
        `blockProgressionOffset` - the offset for this area
        `level` - the bidirectional embedding level (or -1 if not defined) for word as a group
        `word` - the word string
        `letterAdjust` - the letter adjust array (may be null)
        `levels` - array of per-character (glyph) bidirectional levels, in case word area is heterogenously leveled
        `gposAdjustments` - array of general position adjustments or null if none apply

  - ### Method Detail

    - #### getWord

          public String getWord()

      Returns:
        Returns the word.

    - #### getLetterAdjustArray

          public int[] getLetterAdjustArray()

      Returns:
        the array of letter adjust widths

    - #### getBidiLevels

          public int[] getBidiLevels()

      Obtain per-character (glyph) bidi levels.
      Returns:
        a (possibly empty) array of levels or null (if none resolved)

    - #### getBidiLevels

          public int[] getBidiLevels(int start,
                                     int end)

      Obtain per-character (glyph) bidi levels over a specified subsequence.

      If word has been reversed, then the subsequence is over the reversed word.

      Parameters:
        `start` - starting (inclusive) index of subsequence
        `end` - ending (exclusive) index of subsequence
      Returns:
        a (possibly null) array of per-character (glyph) levels over the specified sequence

    - #### bidiLevelAt

          public int bidiLevelAt(int position)

      Obtain per-character (glyph) level at a specified index position.

      If word has been reversed, then the position is relative to the reversed word.

      Parameters:
        `position` - the index of the (possibly reversed) character from which to obtain the level
      Returns:
        a resolved bidirectional level or, if not specified, then -1

    - #### collectInlineRuns

          public List collectInlineRuns(List runs)

      Description copied from class: `InlineArea`
      Collection bidi inline runs.
      Overrides:
        `collectInlineRuns` in class `InlineArea`
      Parameters:
        `runs` - current list of inline runs
      Returns:
        modified list of inline runs, having appended new run

    - #### getGlyphPositionAdjustments

          public int[][] getGlyphPositionAdjustments()

      Obtain per-character (glyph) position adjustments.
      Returns:
        a (possibly empty) array of adjustments, each having four elements, or null if no adjustments apply

    - #### glyphPositionAdjustmentsAt

          public int[] glyphPositionAdjustmentsAt(int position)

      Obtain per-character (glyph) position adjustments at a specified index position.

      If word has been reversed, then the position is relative to the reversed word.

      Parameters:
        `position` - the index of the (possibly reversed) character from which to obtain the level
      Returns:
        an array of adjustments or null if none applies

    - #### reverse

          public void reverse(boolean mirror)

      Reverse characters and corresponding per-character levels and glyph position adjustments.

      Parameters:
        `mirror` - if true, then perform mirroring if mirrorred characters

    - #### mirror

          public void mirror()

      Perform mirroring on mirrorable characters.

    - #### isReversed

          public boolean isReversed()

      Determined if word has been reversed (in relation to original logical order).

      If a word is reversed, then both its characters (glyphs) and corresponding per-character levels are in reverse order.

      Note: this information is used in order to process non-spacing marks during rendering as well as provide hints for caret direction.

      Returns:
        true if word is reversed

    - #### isNextIsSpace

          public boolean isNextIsSpace()

Copyright © 2023 Apache Software Foundation. All rights reserved.