GDI Plus Font Foundation Class

Visual Studio 2005

The gpFont class defines a particular format for text, including font face, size, and style attributes.

Category Reporting

Default Catalog

Visual FoxPro Catalog\Foundation Classes\Output\GDIplus

Class

gpFont

Base Class

Custom

Class Library

_GDIPLUS.vcx

Parent Class

gpObject (GDI Plus Object Foundation Class)

The following table lists public properties and methods added by this class to its parent class, gpObject. It also implements the Clone and Init methods.

Values listed as em height in the table are equivalent to cell ascent (height of the font above the line) + cell descent (height of the font below the line) - internal leading of the font. Values listed as line spacing are equal to cell ascent + cell descent + external leading.

Properties and methods Description

Clone Method

Clones a font object.

Syntax: ? THIS.Clone(toFont)

Return Values: Logical, representing success or failure.

Parameters: 

toFont, required, the gpFont object to clone.

Create Method

Creates a font object from a specified set of font attributes.

Syntax: ? THIS.Create(tvFontNameOrFamily, [tnSize [, tnStyle[, tnUnits]]])

Return Values: Logical, representing success or failure.

Parameters: 

tvFontNameOrFamily, required, a gpFontFamily object or a string representing the name of a font.

tnSize, required, size in specified units.

tnStyle, optional, fontstyle attributes as specified in GDIPLUS_FontStyle_* constants. Default value is GDIPLUS_FontStyle_Regular.

tnUnits, optional, units for font size as specified in GDIPLUS_Unit_* constants. Default value is GDIPLUS_Unit_Point.

FontName Property

Font name, for example "Arial".

Default: Empty.

GetHeight Method

Get line spacing for a font for a given graphics object, using the units of that graphics object.

Syntax: nHeight = THIS.GetHeight(tvGraphics)

Return Values: Number, line-height. Returns null (.NULL.) on error.

Parameters: 

tvGraphics, required, a gpGraphics object or a GDI+ graphics handle.

GetHeightGivenDPI Method

Get line spacing for a font given a value in dots per inch (DPI).

Syntax: nHeight = THIS.GetHeightGivenDPI(tnDPI)

Return Values: Number, line-height. Returns null (.NULL.) on error.

Parameters: 

tnDPI, required, a number of dots per inch.

Init Method

Constructs a font object during initialization if passed appropriate arguments.

Syntax: CREATEOBJECT("gpFont", tvFontNameOrFamily, [tnSize [, tnStyle[, tnUnits]]])

Return Values: Logical, representing success or failure. If the method fails, the object does not instantiate.

Parameters: 

tvFontNameOrFamily, required if immediate creation of the object is requested. A gpFontFamily object or a string representing the name of a font.

tnSize, required, size in specified units.

tnStyle, optional, fontstyle attributes as specified in GDIPLUS_FontStyle_* constants. Default value is GDIPLUS_FontStyle_Regular.

tnUnits, optional, units for font size as specified in GDIPLUS_Unit_* constants. Default value is GDIPLUS_Unit_Point.

Size Property

The em size of the font using the units of this font object.

Default: Empty.

Style Property

Style information for this font object, using GDIPLUS_FontStyle_* constant values.

Default: Empty.

Unit Property

The unit of measure used by this font, using GDIPLUS_Unit_* constant values.

Default: Empty.

Community Additions

ADD
Show: