Class GFXDriver

  • Direct Known Subclasses:
    LayoutDriver

    public abstract class GFXDriver
    extends java.lang.Object
    A base class used by the text and gfx packages to render/position objects within their respective environment.
    • Field Detail

      • MAPPING_SUPPRESS

        public static final int MAPPING_SUPPRESS
        Character to glyph mapping level required by the driver.

        Some driver implementations do more than rendering; they may need to reconstiture the original text and understand how it relates to the rendered glyphs. This enumeration allows a driver to indicate what sort of character/glyph mapping it requires. If the caller is using the driver to render text, it must provide mapping information in accordance with what the driver needs.

        • MAPPING_SUPPRESS: No character/glyph mapping is required.
        • MAPPING_FULL: Full mapping information must be provided by the caller. Note that there may be a performance hit if the caller must generate full mapping information when it is not required by the driver.
        • MAPPING_LEGACY: The caller must simpler, legacy mapping information.
        See Also:
        Constant Field Values
      • moOffsetStack

        public java.util.List<CoordPair> moOffsetStack
      • moAngleStack

        public java.util.List<com.adobe.xfa.gfx.GFXDriver.AnglePair> moAngleStack
      • moClipStack

        public java.util.List<Rect> moClipStack
    • Constructor Detail

      • GFXDriver

        public GFXDriver​(GFXEnv env)
    • Method Detail

      • devW

        public int devW​(UnitSpan oWidth)
      • devH

        public int devH​(UnitSpan oHeight)
      • devX

        public int devX​(UnitSpan oX)
      • devY

        public int devY​(UnitSpan oY)
      • fit

        public void fit​(double dScale,
                        CoordPair oOrigin,
                        int nFit)
      • scale

        public double scale()
      • unitW

        public UnitSpan unitW​(int lWidth)
      • unitH

        public UnitSpan unitH​(int lHeight)
      • unitPoint

        public CoordPair unitPoint​(int lX,
                                   int lY)
      • unitRect

        public Rect unitRect​(int lLeft,
                             int lTop,
                             int lRight,
                             int lBottom)
      • unitX

        public UnitSpan unitX​(int lX)
      • unitY

        public UnitSpan unitY​(int lY)
      • mode

        public int mode()
      • mode

        public void mode​(int eNewMode)
      • lineAttr

        public void lineAttr​(GFXLineAttr poNewAttr)
      • fillAttr

        public void fillAttr​(GFXFillAttr poNewAttr)
      • textAttr

        public void textAttr​(GFXTextAttr poNewAttr)
      • fontInstance

        public void fontInstance​(FontInstance poNewFont)
      • glyphOrientation

        public int glyphOrientation()
      • glyphOrientation

        public void glyphOrientation​(int eNewGlyphOrientation)
      • charSpacing

        public UnitSpan charSpacing()
        Returns the character spacing currently in effect for this driver.

        Note that not all driver implementations support character spacing.

        Returns:
        Character spacing value currently in effect for this driver. The default implementation returns zero.
      • charSpacing

        public void charSpacing​(UnitSpan oNewSpacing)
        Set a new character spacing for subsequent text output.

        Note that not all driver implementations support character spacing.

        Parameters:
        oNewSpacing - - New character spacing value. Negative values are allowed.
      • charSpacingSupported

        public boolean charSpacingSupported()
        Query whether this driver implementation supports character spacing.

        If it does not, there is no point in calling the CharSpacing() overloads. AXTE uses the result of this method to determine whether a text run with a spacing override must be rendered as individual glyphs or can be put out as a run.

        Returns:
        True if the driver supports character spacing; false if not. The default implementation returns false.
      • wordSpacing

        public UnitSpan wordSpacing()
        Returns the word spacing currently in effect for this driver.

        Note that not all driver implementations support word spacing.

        Returns:
        Word spacing value currently in effect for this driver. The default implementation returns zero.
      • wordSpacing

        public void wordSpacing​(UnitSpan oNewSpacing)
        Set a new word spacing for subsequent text output.

        Note that not all driver implementations support word spacing. Note also that word and character spacing support are independent of each other. A driver may support one, the other, both or neither.

        Parameters:
        oNewSpacing - - New word spacing value. Negative values are allowed.
      • wordSpacingSupported

        public boolean wordSpacingSupported()
        Query whether this driver implementation supports word spacing.

        If it does not, there is no point in calling the WordSpacing() overloads.

        Returns:
        True if the driver supports word spacing; false if not. The default implementation returns false.
      • pushOffset

        public void pushOffset​(boolean bRelative,
                               CoordPair oOffset)
      • popOffset

        public void popOffset()
      • offset

        public CoordPair offset​(boolean bRelative)
      • pushAngle

        public void pushAngle​(boolean bRelative,
                              Angle oAngle,
                              boolean bOffsetPoint,
                              CoordPair oRotationPoint)
      • popAngle

        public void popAngle()
      • angle

        public Angle angle​(boolean bRelative)
      • angle

        public Angle angle()
      • rotationPoint

        public CoordPair rotationPoint​(boolean bRelative)
      • pushClipRect

        public void pushClipRect​(boolean bRelative,
                                 Rect oClipRect)
      • popClipRect

        public void popClipRect()
      • clipRect

        public Rect clipRect​(boolean bRelative)
      • clipRect

        public Rect clipRect()
      • clearStacks

        public void clearStacks()
      • relPosition

        public CoordPair relPosition()
      • relPosition

        public void relPosition​(CoordPair oStart)
      • relLine

        public void relLine​(CoordPair oEnd,
                            int eDrawMode)
      • relFillRect

        public void relFillRect​(Rect oRect,
                                int eDrawMode)
      • relFillRect

        public void relFillRect​(Rect oRect)
      • relText

        public void relText​(java.lang.String oText,
                            int eDrawMode)
      • relText

        public void relText​(java.lang.String oText)
      • relGlyphs

        public void relGlyphs​(int[] pnGlyphs,
                              int length)
      • absPosition

        public CoordPair absPosition()
      • absPosition

        public void absPosition​(CoordPair oStart)
      • absLine

        public abstract void absLine​(CoordPair oEnd,
                                     int eDrawMode)
      • absFillRect

        public abstract void absFillRect​(Rect oRect,
                                         int eDrawMode)
      • absText

        public abstract void absText​(java.lang.String oText,
                                     int eDrawMode)
      • absGlyphs

        public void absGlyphs​(int[] pnGlyphs,
                              int length)
      • setUnicodeChars

        public void setUnicodeChars​(int[] text)
        Set the Unicode characters that are about to be rendered by subsequent calls to the driver.

        If the driver requires any sort of mapping, the caller must provide the raw Unicode content through this call before calling any of the text rendering methods RelText(), AbsText(), RelGlyphs() or AbsGlyphs() to render that content.

        The caller typically calls this method once for each "line" of text and then makes one or more calls to the text rendering methods to render the text of the line. If the driver requires mapping, each text rendering call must be preceded by an appropriate call, in order to determine how the rendering run maps to the Unicode content.

        Parameters:
        text - - Unicode text content, UTF32 format.
      • pushRenderContext

        public void pushRenderContext​(int[] pcText,
                                      int pnCharIndex)
        Indicates the caller needs to perform some specific rendering without losing the overall rendering context.

        The SetUnicodeChars() method establishes a context that the driver may need for subsequent rendering and mapping calls. There are situations where that context needs to be put on hold, while the caller goes off and performs some other sort of rendering, before coming back to the context originally set by SetUnicodeChars().

        In particular, consider the case where a tab leader is filled with a sequence of repeating glyphs. The caller will call SetUnicodeChars() with the Unicode content of the complete line, which contains text and tab characters. In filling the leader for a single tab, it will push a new context, with the text used to fill the tab leader. After rendering the tab leader, it will pop the context back to that of the original line.

        Parameters:
        pcText - - New Unicode text context to establish.
        pnCharIndex - - (optional) Index of the character in the parent context that led to this new context. For example, in the case of tab leaders, this would be the index of a tab character. A future overload may allow for a more elaborate mapping specification.
      • popRenderContext

        public void popRenderContext()
        Restore the rendering context. Please see the description of PushRenderContext() for a description of rendering contexts. The client must call this once for each call it makes to PushRenderContext().
      • mapChars

        public void mapChars​(int nIndex,
                             int nLength)
        Legacy character/glyph mapping.

        If the driver needs legacy mapping, the caller must preceed each call to a text rendering method with a call to this method. Legacy mapping can describe only simple character/glyph relationships:

        • A sequence of N consecutive characters mapping 1:1, left-to-right to N consecutive glyphs.
        • A sequence of N consecutive characters mapping N:1 to a single glyph.

        If the driver uses legacy mapping, the caller must break each ligature and each RTL glyph out into its own run.

      • mapGlyphs

        public void mapGlyphs​(GFXMappingList oMappings,
                              boolean bIsRTL)
        Full character/glyph mapping.

        If the driver needs legacy mapping, the caller must preceed each call to a text rendering method with a call to this method. Full mapping supports 1:1, N:1, 1:M and N:M mappings, as well as mappings that involve non-contiguous runs of Unicode content and glyph output.

        Parameters:
        oMappings - - Description of the mappings for the subsequent text rendering call. The Unicode character indexes in the mappings are relative to the line's text passed in SetUnicodeChars(). The glyph indexes are zero-based, relative to the glyphs in the next text rendering call.
        bIsRTL - - True if the subsequent run represents RTL text; FALSE for LTR text.
      • getMappingLevel

        public int getMappingLevel()
        Return the mapping required by the driver.
        Returns:
        Mapping level that the client must implement in order to satisfy the driver's needs.
      • dotsPerInch

        public int dotsPerInch()
      • height

        public abstract int height()
      • width

        public abstract int width()
      • interactive

        public abstract boolean interactive()
      • visibleArea

        public Rect visibleArea()
      • nonPrintOffset

        public CoordPair nonPrintOffset()
      • paraHint

        public void paraHint()
      • resolutionChanged

        public void resolutionChanged()
      • heightInUnits

        public UnitSpan heightInUnits()
      • widthInUnits

        public UnitSpan widthInUnits()
      • draw3dEffects

        public boolean draw3dEffects()
      • draw3dEffects

        public void draw3dEffects​(boolean b3dEffects)