Package com.ms.awt Previous
Previous
Microsoft Packages
Microsoft Packages
Index
Index
Next
Next

Class FontX

Constructors , Methods , Fields

public class FontX extends Font
{
	// Fields
	public static final int EMBEDDED = 1;
	public static final int STRIKEOUT = 2;
	public static final int UNDERLINE = 4;
	public static final int OUTLINE = 8;

	// Constructors
	public FontX(String name, int style, int size);
	public FontX(String name, int style, int size, boolean bEmbed);
	public FontX(String name, int style, int size, int xFlags);

	// Methods
	public boolean isTypeable(int language);
	public int getFlags()
	public String getFamily();
	public String getName();
	public int getStyle();
	public int getSize();
	public boolean isPlain();
	public boolean isBold();
	public boolean isItalic();
	public int hashCode();
	public boolean equals(Object obj);
	public String toString();
	public static String[] getFontList();
	public static FontX ChooseFont(Component c);
	public static FontX ChooseFont(Component c, FontX f);
}

Creates a font object that defines the font family, font face, style, and size. Supports TrueType fonts.


Constructors


FontX

public FontX(String name, int style, int size) 

Creates a new font with the specified name, style, and point size.

ParameterDescription
name The name of the font face.
style The font style. Can be a combination of these values:
BOLD
ITALIC
PLAIN
size The point size of the font.


FontX

public FontX(String name, int style, int size, boolean bEmbed) 

Creates a new font with the specified name, style, and point size, and specifies whether the font is embedded.

ParameterDescription
name The name of the font face.
style The font style. Can be a combination of these values:
BOLD
ITALIC
PLAIN
size The point size of the font.
bEmbed Set to true if the font is embedded, false otherwise.


FontX

public FontX(String name, int style, int size, int xFlags) 

Creates an extended font.

ParameterDescription
name The name of the font face.
style The font style. Can be a combination of these values:
BOLD
ITALIC
PLAIN
size The point size of the font.
xFlags Extended styles. Can be one of these values:
EMBEDDED
UNDERLINE
STRIKEOUT
OUTLINE


Methods


isTypeable

public boolean isTypeable(int language)

Checks whether the font is typeable in the given language.

Return Value:

Returns true if the font is typeable, false otherwise.

ParameterDescription
language The identifier of the language to check.


getFlags

public int getFlags()

Returns the extended flags of a FontX object.

Return Value:

Returns a combination of these extended styles: EMBEDDED, STRIKEOUT, UNDERLINE, and OUTLINE.


equals

public boolean equals(Object obj) 

Checks whether the argument is not null and is either a Font or FontX object with the same name, same style, and same point size as this FontX.

Return Value:

Returns true if the objects are equal, false otherwise.


toString

public String toString() 

Returns a string that specifies the family, font face, style, and size of the given font.

Return Value:

Returns a string having this format:

class[family=family-name,name=font-name,style=bold/italic,size=size]


getFontList

public static String[] getFontList() 

Retrieves a list of the names of the font faces available.

Return Value:

Returns a string array, each component of which specifies the name of an available font face.


ChooseFont

public static FontX ChooseFont(Component c)

Displays a dialog box to allow the user to choose a font. A default font will be initialized.

Return Value:

Returns a FontX object or null if the user canceled the dialog box by pressing the Cancel button.

ParameterDescription
c The component that owns the dialog box (and subsequently is blocked until the dialog box is closed).


ChooseFont

public static FontX ChooseFont(Component c, FontX f)

Displays a dialog box to allow the user to choose a font. The default font will be initialized to the given font.

Return Value:

Returns a FontX object or null if the user canceled the dialog box by pressing the Cancel button.

ParameterDescription
c The component that owns the dialog box (and subsequently is blocked until the dialog box is closed).
f The FontX object to use as the default.


Fields

EMBEDDED
Flag used to indicate the new font should be linked to a privately embedded font.
STRIKEOUT
Indicates that text drawn using the the new font should be stuck out.
UNDERLINE
Indicates that text drawn using the the new font should be underlined.
OUTLINE
Indicates that the text drawn using the new font should be drawn using the outline of the glyph. This is only supported by certain fonts in the system, and only GraphicsX will support this feature. Trying to draw outline fonts using a Win32Graphics object will result in the glyph being drawn normally.

See also Class FontX.

Top© 1996 Microsoft Corporation. All rights reserved.