Package com.ms.awt Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class FontX

Fields , Constructors , Methods

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.


Fields

EMBEDDED
Indicates the new font should be linked to a privately embedded font.
STRIKEOUT
Indicates that text drawn using the new font should be struck out.
UNDERLINE
Indicates that text drawn using 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.


Constructors


FontX

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

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

ParameterDescription
name Name of the font face.
style Font style. Can be a combination of these values:
BOLD
ITALIC
PLAIN
size 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 Name of the font face.
style Font style. Can be a combination of these values:
BOLD
ITALIC
PLAIN
size Point size of the font.
bEmbed 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 Name of the font face.
style Font style. Can be a combination of these values:
BOLD
ITALIC
PLAIN
size 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 can be typed in the given language.

Return Value:

Returns true if the font can be typed, false otherwise.

ParameterDescription
language Identifier of the language to be checked.


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 that the argument is not null, is either a Font or FontX object, and has the same name, same style, and same point size as this FontX object.

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 containing the names of available font faces.


ChooseFont

public static FontX ChooseFont(Component c);

Displays a dialog box that allows 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 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 that allows 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 Component that owns the dialog box (and subsequently is blocked until the dialog box is closed).
f FontX object to use as the default.



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.