TextArea (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.area.inline

## Class TextArea

- java.lang.Object
- - org.apache.fop.area.AreaTreeObject
  - - org.apache.fop.area.Area
    - - org.apache.fop.area.inline.InlineArea
      - - org.apache.fop.area.inline.InlineParent
        - - org.apache.fop.area.inline.AbstractTextArea
          - - org.apache.fop.area.inline.TextArea

- All Implemented Interfaces:
    Serializable, Cloneable
  Direct Known Subclasses:
    ResolvedPageNumber, UnresolvedPageNumber

      public class TextArea
      extends AbstractTextArea

  A text inline area.
  See Also:
    Serialized Form

- - ### Nested Class Summary

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

      `AbstractTextArea.TextAdjustingInfo`

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

      `InlineArea.InlineAdjustingInfo`

  - ### Field Summary

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

      `autoSize, inlines, minChildOffset`

    - ### 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
    `TextArea()` Create a text inline area
    `TextArea(int stretch, int shrink, int adj)` Constructor with extra parameters: create a TextAdjustingInfo object

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addSpace(char space, int ipd, boolean adjustable, int blockProgressionOffset, int level)` Create and add a SpaceArea child to this TextArea
    `void` | `addWord(String word, int offset)` Create and add a WordArea child to this TextArea.
    `void` | `addWord(String word, int offset, int level)` Create and add a WordArea child to this TextArea.
    `void` | `addWord(String word, int ipd, int[] letterAdjust, int[] levels, int[][] gposAdjustments, int blockProgressionOffset)`
    `void` | `addWord(String word, int ipd, int[] letterAdjust, int[] levels, int[][] gposAdjustments, int blockProgressionOffset, boolean nextIsSpace)` Create and add a WordArea child to this TextArea.
    `int` | `getEffectiveIPD()`
    `String` | `getText()` Get the whole text string.
    `boolean` | `isHyphenated()` Returns `true` if the last word in this area is hyphenated.
    `void` | `removeText()` Remove the old text
    `void` | `setHyphenated()` Records that the last word in this text area is hyphenated.
    `String` | `toString()`
    `void` | `updateLevel(int newLevel)`

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

      `applyVariationFactor, getBaselineOffset, getTextLetterSpaceAdjust, getTextWordSpaceAdjust, setBaselineOffset, setSpaceDifference, setTextLetterSpaceAdjust, setTextWordSpaceAdjust`

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

      `addChildArea, collectInlineRuns, getChildAreas, resetChildrenLevel, setFromFootnote`

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

      `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, getIPD, getSpaceAfter, getSpaceBefore, getSpaceEnd, getSpaceStart, getTrait, getTraitAsBoolean, getTraitAsInteger, getTraits, hasTrait, hasTraits, isFromFootnote, resetBidiLevel, setAreaClass, setBidiLevel, setBPD, setChangeBarList, setIPD, setTraits, setWritingModeTraits`

    - ### 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`

- - ### Constructor Detail

    - #### TextArea

          public TextArea()

      Create a text inline area

    - #### TextArea

          public TextArea(int stretch,
                          int shrink,
                          int adj)

      Constructor with extra parameters: create a TextAdjustingInfo object
      Parameters:
        `stretch` - the available stretch of the text
        `shrink` - the available shrink of the text
        `adj` - the current total adjustment

  - ### Method Detail

    - #### removeText

          public void removeText()

      Remove the old text

    - #### addWord

          public void addWord(String word,
                              int offset)

      Create and add a WordArea child to this TextArea.
      Parameters:
        `word` - the word string
        `offset` - the offset for the next area

    - #### addWord

          public void addWord(String word,
                              int offset,
                              int level)

      Create and add a WordArea child to this TextArea.
      Parameters:
        `word` - the word string
        `offset` - the offset for the next area
        `level` - bidirectional level that applies to entire word

    - #### addWord

          public void addWord(String word,
                              int ipd,
                              int[] letterAdjust,
                              int[] levels,
                              int[][] gposAdjustments,
                              int blockProgressionOffset,
                              boolean nextIsSpace)

      Create and add a WordArea child to this TextArea.
      Parameters:
        `word` - the word string
        `ipd` - the word's ipd
        `letterAdjust` - the letter adjustment array (may be null)
        `levels` - array of resolved bidirectional levels of word characters, or null if default level
        `gposAdjustments` - array of general position adjustments or null if none apply
        `blockProgressionOffset` - the offset for the next area

    - #### addWord

          public void addWord(String word,
                              int ipd,
                              int[] letterAdjust,
                              int[] levels,
                              int[][] gposAdjustments,
                              int blockProgressionOffset)

    - #### addSpace

          public void addSpace(char space,
                               int ipd,
                               boolean adjustable,
                               int blockProgressionOffset,
                               int level)

      Create and add a SpaceArea child to this TextArea
      Parameters:
        `space` - the space character
        `ipd` - the space's ipd
        `blockProgressionOffset` - the offset for the next area
        `adjustable` - is this space adjustable?
        `level` - resolved bidirection level of space character

    - #### setHyphenated

          public void setHyphenated()

      Records that the last word in this text area is hyphenated.

    - #### isHyphenated

          public boolean isHyphenated()

      Returns `true` if the last word in this area is hyphenated.

    - #### getText

          public String getText()

      Get the whole text string. Renderers whose space adjustment handling is not affected by multi-byte characters can use this method to render the whole TextArea at once; the other renderers (for example PDFRenderer) have to implement renderWord(WordArea) and renderSpace(SpaceArea) in order to correctly place each text fragment.
      Returns:
        the text string

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Area`
      Returns:
        ipd and bpd of area

    - #### updateLevel

          public void updateLevel(int newLevel)

    - #### getEffectiveIPD

          public int getEffectiveIPD()

      Overrides:
        `getEffectiveIPD` in class `Area`

Copyright © 2025 Apache Software Foundation. All rights reserved.