Class ScaledBaselineTable


  • final class ScaledBaselineTable
    extends java.lang.Object
    The FOP specific incarnation of the XSL-FO scaled baseline table. All baseline tables are scaled to the font size of the font they apply to. This class uses a coordinate system with its origin where the dominant baseline intersects the start edge of the box. All measurements are in mpt.
    • Field Detail

      • HANGING_BASELINE_FACTOR

        private static final float HANGING_BASELINE_FACTOR
        See Also:
        Constant Field Values
      • MATHEMATICAL_BASELINE_FACTOR

        private static final float MATHEMATICAL_BASELINE_FACTOR
        See Also:
        Constant Field Values
      • altitude

        private final int altitude
      • depth

        private final int depth
      • xHeight

        private final int xHeight
      • dominantBaselineIdentifier

        private final int dominantBaselineIdentifier
      • dominantBaselineOffset

        private final int dominantBaselineOffset
      • beforeEdgeOffset

        private int beforeEdgeOffset
      • afterEdgeOffset

        private int afterEdgeOffset
    • Constructor Detail

      • ScaledBaselineTable

        ScaledBaselineTable​(int altitude,
                            int depth,
                            int xHeight,
                            int dominantBaselineIdentifier,
                            WritingMode writingMode)
        Creates a new instance of BasicScaledBaselineTable for the given altitude, depth, xHeight, baseline and writing mode.
        Parameters:
        altitude - the height of the box or the font ascender
        depth - the font descender or 0
        xHeight - the font xHeight
        dominantBaselineIdentifier - the dominant baseline given as an integer constant
        writingMode - the writing mode given as an integer constant
    • Method Detail

      • getDominantBaselineIdentifier

        int getDominantBaselineIdentifier()
        Return the dominant baseline for this baseline table.
        Returns:
        the dominant baseline
      • getWritingMode

        WritingMode getWritingMode()
        Return the writing mode for this baseline table.
        Returns:
        the writing mode
      • getBaseline

        int getBaseline​(int baselineIdentifier)
        Return the offset of the given baseline from the dominant baseline.
        Parameters:
        baselineIdentifier - a baseline identifier
        Returns:
        the offset from the dominant baseline
      • isHorizontalWritingMode

        private boolean isHorizontalWritingMode()
      • getBaselineDefaultOffset

        private int getBaselineDefaultOffset​(int baselineIdentifier)
        Return the baseline offset measured from the font's default baseline for the given baseline.
        Parameters:
        baselineIdentifier - the baseline identifier
        Returns:
        the baseline offset
      • setBeforeAndAfterBaselines

        void setBeforeAndAfterBaselines​(int beforeBaseline,
                                        int afterBaseline)
        Sets the position of the before and after baselines. This is usually only done for line areas. For other areas the position of the before and after baselines are fixed when the table is constructed.
        Parameters:
        beforeBaseline - the offset of the before-edge baseline from the dominant baseline
        afterBaseline - the offset of the after-edge baseline from the dominant baseline
      • deriveScaledBaselineTable

        ScaledBaselineTable deriveScaledBaselineTable​(int baselineIdentifier)
        Return a new baseline table for the given baseline based on the current baseline table.
        Parameters:
        baselineIdentifier - the baseline identifer
        Returns:
        a new baseline with the new baseline