Class GFXDriver
- java.lang.Object
-
- com.adobe.xfa.gfx.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 Summary
Fields Modifier and Type Field Description static int
ACTIVE
static int
CAP_PIX_HEIGHT
static int
CAP_PIX_WIDTH
static int
CAP_REAL_HEIGHT
static int
CAP_REAL_WIDTH
static int
CAP_TYPE
static int
DRAW_2D
static int
DRAW_3D
static int
DRAW_WELL
static int
INACTIVE
static int
MAPPING_FULL
static int
MAPPING_LEGACY
static int
MAPPING_SUPPRESS
Character to glyph mapping level required by the driver.java.util.List<com.adobe.xfa.gfx.GFXDriver.AnglePair>
moAngleStack
java.util.List<Rect>
moClipStack
static int
MODE_OPAQUE
static int
MODE_TRANSPARENT
java.util.List<CoordPair>
moOffsetStack
static int
PUSHED
static int
TYPE_PRINTER
static int
TYPE_SCREEN
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
absFillRect(Rect oRect, int eDrawMode)
void
absGlyphs(int[] pnGlyphs, int length)
abstract void
absLine(CoordPair oEnd, int eDrawMode)
void
absLine(CoordPair oStart, CoordPair oEnd, int eDrawMode)
CoordPair
absPosition()
void
absPosition(CoordPair oStart)
abstract void
absText(java.lang.String oText, int eDrawMode)
Angle
angle()
Angle
angle(boolean bRelative)
UnitSpan
charSpacing()
Returns the character spacing currently in effect for this driver.void
charSpacing(UnitSpan oNewSpacing)
Set a new character spacing for subsequent text output.boolean
charSpacingSupported()
Query whether this driver implementation supports character spacing.void
clearStacks()
Rect
clipRect()
Rect
clipRect(boolean bRelative)
int
devH(UnitSpan oHeight)
GFXDevPoint
devPoint(CoordPair oPoint)
GFXDevRect
devRect(Rect oRect)
UnitSpan
devUnitX()
UnitSpan
devUnitY()
int
devW(UnitSpan oWidth)
int
devX(UnitSpan oX)
int
devY(UnitSpan oY)
int
dotsPerInch()
boolean
draw3dEffects()
void
draw3dEffects(boolean b3dEffects)
GFXEnv
env()
GFXFillAttr
fillAttr()
void
fillAttr(GFXFillAttr poNewAttr)
void
fit(double dScale, CoordPair oOrigin, int nFit)
FontInstance
fontInstance()
void
fontInstance(FontInstance poNewFont)
int
getMappingLevel()
Return the mapping required by the driver.int
glyphOrientation()
void
glyphOrientation(int eNewGlyphOrientation)
abstract int
height()
UnitSpan
heightInUnits()
abstract boolean
interactive()
GFXLineAttr
lineAttr()
void
lineAttr(GFXLineAttr poNewAttr)
void
mapChars(int nIndex, int nLength)
Legacy character/glyph mapping.void
mapGlyphs(GFXMappingList oMappings, boolean bIsRTL)
Full character/glyph mapping.int
mode()
void
mode(int eNewMode)
CoordPair
nonPrintOffset()
CoordPair
offset()
CoordPair
offset(boolean bRelative)
CoordPair
offsetPoint(CoordPair oPoint)
void
paraHint()
void
popAngle()
void
popClipRect()
void
popOffset()
void
popRenderContext()
Restore the rendering context.void
pushAngle(boolean bRelative, Angle oAngle, boolean bOffsetPoint, CoordPair oRotationPoint)
void
pushClipRect(boolean bRelative, Rect oClipRect)
void
pushOffset(boolean bRelative, CoordPair oOffset)
void
pushRenderContext(int[] pcText, int pnCharIndex)
Indicates the caller needs to perform some specific rendering without losing the overall rendering context.void
relFillRect(Rect oRect)
void
relFillRect(Rect oRect, int eDrawMode)
void
relGlyphs(int[] pnGlyphs, int length)
void
relLine(CoordPair oEnd, int eDrawMode)
void
relLine(CoordPair oStart, CoordPair oEnd)
void
relLine(CoordPair oStart, CoordPair oEnd, int eDrawMode)
CoordPair
relPosition()
void
relPosition(CoordPair oStart)
void
relText(java.lang.String oText)
void
relText(java.lang.String oText, int eDrawMode)
void
resolutionChanged()
CoordPair
rotatePoint(CoordPair oPoint)
CoordPair
rotationPoint(boolean bRelative)
double
scale()
void
setUnicodeChars(int[] text)
Set the Unicode characters that are about to be rendered by subsequent calls to the driver.GFXTextAttr
textAttr()
void
textAttr(GFXTextAttr poNewAttr)
UnitSpan
unitH(int lHeight)
CoordPair
unitPoint(int lX, int lY)
Rect
unitRect(int lLeft, int lTop, int lRight, int lBottom)
UnitSpan
unitW(int lWidth)
UnitSpan
unitX(int lX)
UnitSpan
unitY(int lY)
Rect
visibleArea()
abstract int
width()
UnitSpan
widthInUnits()
UnitSpan
wordSpacing()
Returns the word spacing currently in effect for this driver.void
wordSpacing(UnitSpan oNewSpacing)
Set a new word spacing for subsequent text output.boolean
wordSpacingSupported()
Query whether this driver implementation supports word spacing.
-
-
-
Field Detail
-
MODE_OPAQUE
public static final int MODE_OPAQUE
- See Also:
- Constant Field Values
-
MODE_TRANSPARENT
public static final int MODE_TRANSPARENT
- See Also:
- Constant Field Values
-
TYPE_PRINTER
public static final int TYPE_PRINTER
- See Also:
- Constant Field Values
-
TYPE_SCREEN
public static final int TYPE_SCREEN
- See Also:
- Constant Field Values
-
CAP_TYPE
public static final int CAP_TYPE
- See Also:
- Constant Field Values
-
CAP_PIX_WIDTH
public static final int CAP_PIX_WIDTH
- See Also:
- Constant Field Values
-
CAP_PIX_HEIGHT
public static final int CAP_PIX_HEIGHT
- See Also:
- Constant Field Values
-
CAP_REAL_WIDTH
public static final int CAP_REAL_WIDTH
- See Also:
- Constant Field Values
-
CAP_REAL_HEIGHT
public static final int CAP_REAL_HEIGHT
- See Also:
- Constant Field Values
-
DRAW_2D
public static final int DRAW_2D
- See Also:
- Constant Field Values
-
DRAW_3D
public static final int DRAW_3D
- See Also:
- Constant Field Values
-
DRAW_WELL
public static final int DRAW_WELL
- See Also:
- Constant Field Values
-
ACTIVE
public static final int ACTIVE
- See Also:
- Constant Field Values
-
INACTIVE
public static final int INACTIVE
- See Also:
- Constant Field Values
-
PUSHED
public static final int PUSHED
- See Also:
- Constant Field Values
-
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
-
MAPPING_FULL
public static final int MAPPING_FULL
- See Also:
- Constant Field Values
-
MAPPING_LEGACY
public static final int MAPPING_LEGACY
- 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
-
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)
-
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)
-
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)
-
-