GetFont Method

Gets the definition data of the font for the TextStyle.

See Also | Example

Signature

object.GetFont Typeface, Bold, Italic, CharSet, PitchAndFamily

Object

TextStyle
The object or objects this method applies to.

Typeface

String; output-only
The typeface (font name) of the TextStyle you queried.

Bold

Boolean; output-only
Specifies if the TextStyle is bold.

TRUE: The TextStyle is bold.

FALSE: The TextStyle is not bold.

Italic

Boolean; output-only
Specifies if the TextStyle is italic.

TRUE: The TextStyle is italic.

FALSE: The TextStyle is not italic.

CharSet

Long; output-only
The character set for the font. (See the available values in the Remarks section.)

PitchAndFamily

Long; output-only
The pitch and family definitions for the font. (See the available values in the Remarks section.)

Remarks

This section provides definitions for constants to use with this method. To use these constants, copy the definitions you need and paste them into the Declarations section of your application. A complete list of the constants that are available from Microsoft can be found in the file win32api.txt, which is provided with the Visual Basic Development Environment.

The CharSet parameter specifies the character set for the font. To use the following constants in your VB or VBA application, copy the definitions into the Declaration section of your code.


Public Const ANSI_CHARSET = 0
Public Const DEFAULT_CHARSET = 1
Public Const SYMBOL_CHARSET = 2
Public Const SHIFTJIS_CHARSET = 128
Public Const OEM_CHARSET = 255

The PitchAndFamily parameter specifies the pitch and family values for the font. The value is determined by a combination of three different settings. By choosing a setting from each of the three categories and using the Boolean operator OR to combine them, you achieve the PitchAndFamily value. A setting is required from the first two categories: the pitch and the family. The third category, the TrueType Flag, is used only when you are specifying a TrueType font.


' Pitch Values
Public Const DEFAULT_PITCH = 0
Public Const FIXED_PITCH = 1
Public Const VARIABLE_PITCH = 2

' Family Values
Public Const FF_DONTCARE = 0	'  Don't care or don't know.
Public Const FF_ROMAN = 16	'  Variable stroke width, serifed.
Public Const FF_SWISS = 32	'  Variable stroke width, sans-serifed.
Public Const FF_MODERN = 48	 '  Constant stroke width, serifed or sans-serifed.
Public Const FF_SCRIPT = 64	 '  Cursive, etc.
Public Const FF_DECORATIVE = 80 '  Old English, etc.

' TrueType Flag
Public Const TMPF_TRUETYPE = &H4

 

   Comments?