Class AbstractTextArea

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    TextArea

    public abstract class AbstractTextArea
    extends InlineParent
    Abstract base class for both TextArea and Character.
    See Also:
    Serialized Form
    • Field Detail

      • textWordSpaceAdjust

        private int textWordSpaceAdjust
      • textLetterSpaceAdjust

        private int textLetterSpaceAdjust
      • baselineOffset

        private int baselineOffset
    • Constructor Detail

      • AbstractTextArea

        public AbstractTextArea()
        Default constructor
      • AbstractTextArea

        public AbstractTextArea​(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 adjustment of the area
    • Method Detail

      • getTextWordSpaceAdjust

        public int getTextWordSpaceAdjust()
        Get text word space adjust.
        Returns:
        the text word space adjustment
      • setTextWordSpaceAdjust

        public void setTextWordSpaceAdjust​(int textWordSpaceAdjust)
        Set text word space adjust.
        Parameters:
        textWordSpaceAdjust - the text word space adjustment
      • getTextLetterSpaceAdjust

        public int getTextLetterSpaceAdjust()
        Get text letter space adjust.
        Returns:
        the text letter space adjustment
      • setTextLetterSpaceAdjust

        public void setTextLetterSpaceAdjust​(int textLetterSpaceAdjust)
        Set text letter space adjust.
        Parameters:
        textLetterSpaceAdjust - the text letter space adjustment
      • setSpaceDifference

        public void setSpaceDifference​(int spaceDiff)
        Set the difference between optimal width of a space and default width of a space according to the font; this part of the space adjustment is fixed and must not be multiplied by the variation factor.
        Parameters:
        spaceDiff - the space difference
      • applyVariationFactor

        public boolean applyVariationFactor​(double variationFactor,
                                            int lineStretch,
                                            int lineShrink)
        recursively apply the variation factor to all descendant areas
        Overrides:
        applyVariationFactor in class InlineParent
        Parameters:
        variationFactor - the variation factor that must be applied to adjustments
        lineStretch - the total stretch of the line
        lineShrink - the total shrink of the line
        Returns:
        true if there is an UnresolvedArea descendant
      • getBaselineOffset

        public int getBaselineOffset()
        Get baseline offset, i.e. the distance from the before edge of this area to the nominal baseline.
        Returns:
        the baseline offset
      • setBaselineOffset

        public void setBaselineOffset​(int baselineOffset)
        Set the baseline offset.
        Parameters:
        baselineOffset - the baseline offset
      • getVirtualOffset

        int getVirtualOffset()
        Description copied from class: InlineArea
        Returns the offset that this area would have if its offset and size were taking children areas into account. The bpd of an inline area is taken from its nominal font and doesn't depend on the bpds of its children elements. However, in the case of a basic-link element we want the active area to cover all of the children elements.
        Overrides:
        getVirtualOffset in class InlineParent
        Returns:
        the offset that this area would have if the before-edge of its content-rectangle were coinciding with the beforest before-edge of its children allocation-rectangles.
        See Also:
        InlineArea.getVirtualBPD(), BasicLinkArea