Class GFXDriver

java.lang.Object
com.adobe.xfa.gfx.GFXDriver
Direct Known Subclasses:
LayoutDriver

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

    • MODE_OPAQUE

      public static final int MODE_OPAQUE
      See Also:
    • MODE_TRANSPARENT

      public static final int MODE_TRANSPARENT
      See Also:
    • TYPE_PRINTER

      public static final int TYPE_PRINTER
      See Also:
    • TYPE_SCREEN

      public static final int TYPE_SCREEN
      See Also:
    • CAP_TYPE

      public static final int CAP_TYPE
      See Also:
    • CAP_PIX_WIDTH

      public static final int CAP_PIX_WIDTH
      See Also:
    • CAP_PIX_HEIGHT

      public static final int CAP_PIX_HEIGHT
      See Also:
    • CAP_REAL_WIDTH

      public static final int CAP_REAL_WIDTH
      See Also:
    • CAP_REAL_HEIGHT

      public static final int CAP_REAL_HEIGHT
      See Also:
    • DRAW_2D

      public static final int DRAW_2D
      See Also:
    • DRAW_3D

      public static final int DRAW_3D
      See Also:
    • DRAW_WELL

      public static final int DRAW_WELL
      See Also:
    • ACTIVE

      public static final int ACTIVE
      See Also:
    • INACTIVE

      public static final int INACTIVE
      See Also:
    • PUSHED

      public static final int PUSHED
      See Also:
    • 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:
    • MAPPING_FULL

      public static final int MAPPING_FULL
      See Also:
    • MAPPING_LEGACY

      public static final int MAPPING_LEGACY
      See Also:
    • moOffsetStack

      public List<CoordPair> moOffsetStack
    • moAngleStack

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

      public List<Rect> moClipStack
  • Constructor Details

    • GFXDriver

      public GFXDriver(GFXEnv env)
  • Method Details

    • env

      public GFXEnv env()
    • devW

      public int devW(UnitSpan oWidth)
    • devH

      public int devH(UnitSpan oHeight)
    • devPoint

      public GFXDevPoint devPoint(CoordPair oPoint)
    • devRect

      public GFXDevRect devRect(Rect oRect)
    • devX

      public int devX(UnitSpan oX)
    • devY

      public int devY(UnitSpan oY)
    • devUnitX

      public UnitSpan devUnitX()
    • devUnitY

      public UnitSpan devUnitY()
    • fit

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

      public CoordPair rotatePoint(CoordPair oPoint)
    • offsetPoint

      public CoordPair offsetPoint(CoordPair oPoint)
    • 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 GFXLineAttr lineAttr()
    • lineAttr

      public void lineAttr(GFXLineAttr poNewAttr)
    • fillAttr

      public GFXFillAttr fillAttr()
    • fillAttr

      public void fillAttr(GFXFillAttr poNewAttr)
    • textAttr

      public GFXTextAttr textAttr()
    • textAttr

      public void textAttr(GFXTextAttr poNewAttr)
    • fontInstance

      public FontInstance fontInstance()
    • 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)
    • offset

      public CoordPair offset()
    • 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)
    • relLine

      public void relLine(CoordPair oStart, CoordPair oEnd, int eDrawMode)
    • relLine

      public void relLine(CoordPair oStart, CoordPair oEnd)
    • relFillRect

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

      public void relFillRect(Rect oRect)
    • relText

      public void relText(String oText, int eDrawMode)
    • relText

      public void relText(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)
    • absLine

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

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

      public abstract void absText(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)