Package com.ms.fx |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public abstract class FxFont extends Font { //Fields public static final int STRIKEOUT; public static final int UNDERLINE; // Constructors public FxFont(String name, int style, int size); public FxFont(String name, int style, int size, int flags); // Methods public boolean drawCharsCallback(FxGraphics g, char data[], int offset, int length, int x, int y, Rectangle optionRect, int options, int dx[], int dy[], boolean meta); public boolean drawStringCallback(FxGraphics g, String str, int x, int y, Rectangle optionRect, int options, int dx[], int dy[], boolean metaAdvVals); public boolean drawBytesCallback(FxGraphics g, byte data[], int offset, int length, int x, int y, Rectangle optionRect, int options, int dx[], int dy[], boolean meta); public FontMetrics getFontMetricsCallback(FxGraphics g); public void setFontCallback(FxGraphics g); public boolean drawOutlineCharCallback(FxGraphics g, int xOrig, int yOrig, GlyphOutline go); public void setColorCallback(Color c); public GlyphOutline getGlyphOutlineCallback(FxGraphics g, char ch); public void setBackgroundCallback(Color c); }
A class that produces user-defined font objects.
The Microsoft com.ms.fx Java package is more powerful and more flexible than other graphics packages because it uses extensible objects .
public FxFont(String name, int style, int size);Construct the FxFont object.
Parameter Description name The name of the font. style The style of the font. size The size of the font. Remarks:
If the current FxFont object is an object that is not based on GDI (Graphical Device Interface), retrieve a system font's name and size. This system font can force the use of an existing logfont. NativeSetFont will only be used if the font object specifically calls it.
public FxFont(String name, int style, int size, int flags);Constructs an FxFont object with the specified flags.
Parameter Description name The name of the font. style The style of the font. size The size of the font. flags The font's flags. Currently, these may either be STRIKEOUT or UNDERLINE.
public boolean drawCharsCallback(FxGraphics g, char data[], int offset, int length, int x, int y, Rectangle optionRect, int options, int dx[], int dy[], boolean meta);This method is called by an FxGraphics object to draw an array of characters.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. data The array of characters to draw. offset The offset to use. length The length of the array used. x The x coordinate of the location where the characters should be drawn. y The y coordinate of the location where the characters should be drawn. optionRect The optional rectangle used for clipping or opaquing. options The options set for the method. dx The array of dx values. dy The array of dy values. meta The Boolean value that determines if meta advance values are used. Remarks:
This method is called by FxGraphics if drawChars is called when an FxFont object is currently selected.
public boolean drawStringCallback(FxGraphics g, String str, int x, int y, Rectangle optionRect, int options, int dx[], int dy[], boolean metaAdvVals);This method is called by an FxGraphics object to draw a string.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. str The string to draw. x The x coordinate of the location where the string should be drawn. y The y coordinate of the location where the string should be drawn. optionRect The optional rectangle used for clipping or opaquing. options The options set for the method. dx The array of dx values. dy The array of dy values. metaAdvVals The Boolean value that determines if meta advance values are used. Remarks:
Called by FxGraphics if drawString is called when an FxFont object is currently selected.
public boolean drawBytesCallback(FxGraphics g, byte data[], int offset, int length, int x, int y, Rectangle optionRect, int options, int dx[], int dy[], boolean meta);This method is called by an FxGraphics object to draw an array of bytes.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. data The array of bytes to draw. offset The offset to use. length The length of the array used. x The x coordinate of the location where the bytes should be drawn. y The y coordinate of the location where the bytes should be drawn. optionRect The optional rectangle used for clipping or opaquing. options The options set for the method. dx The array of dx values. dy The array of dy values. meta The Boolean value that determines if meta advance values are used. Remarks:
Called by FxGraphics if drawBytes is called when an FxFont object is currently selected.
public FontMetrics getFontMetricsCallback(FxGraphics g);This method is called by an FxGraphics object to retrieve the font metrics.
Return Value:
Returns the FontMetrics value.
Parameter Description g The graphics object to use. Remarks:
Called by FxGraphics if the font metrics are required when an FxFont object is currently selected. The object returned must be derived from FontMetrics.
public void setFontCallback(FxGraphics g);Selects the current font for use as the native font for the graphics object.
Return Value:
No return value.
Parameter Description g The graphics object to use. Remarks:
Called by FxGraphics when an FxFont object is selected. This allows the object to do any device specific initialization. The default action is to pass the font back and use it as a native font.
public boolean drawOutlineCharCallback(FxGraphics g, int xOrig, int yOrig, GlyphOutline go);This method is called by an FxGraphics object to draw an outline character.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. xOrig The x coordinate of the character. yOrig The y coordinate of the character. go The GlyphOutline to use. Remarks:
This method is used internally and is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public void setColorCallback(Color c);Sets the color to use for the foreground.
Return Value:
No return value.
Parameter Description c The color to use for the foreground. Remarks:
Called by FxGraphics if setColor is called when an FxFont object is currently selected.
public GlyphOutline getGlyphOutlineCallback(FxGraphics g, char ch);Retrieves a glyph outline for the character.
Return Value:
Returns a glyph outline for the character.
Parameter Description g The graphics object to use. ch The character to find the glyph outline for.
public void setBackgroundCallback(Color c);Sets the background color.
Return Value:
No return value.
Parameter Description c The color to use for the background. Remarks:
Called by FxGraphics if setTextBackground is called when an FxFont object is currently selected. This method is currently not implemented.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.