Class TWindowsFont
Unit
CastleWindowsFonts
Declaration
type TWindowsFont = class(TObject)
Description
A wrapper for CreateFont WinAPI function. Create an instance of this class, setup some attributes, and call GetHandle. In the future this class may be extended to something less trivial.
For the meaning of properties see WinAPI documentation for CreateFont function.
Hierarchy
Overview
Methods
Properties
 |
property Height: Integer read FHeight write FHeight; |
 |
property Angle: Integer read FAngle write FAngle default 0; |
 |
property Weight: Integer read FWeight write FWeight default FW_REGULAR; |
 |
property Italic: boolean read FItalic write FItalic default false; |
 |
property Underline: boolean read FUnderline write FUnderline default false; |
 |
property StrikeOut: boolean read FStrikeOut write FStrikeOut default false; |
 |
property CharSet: TWinCharSet read FCharSet write FCharSet default wcsDEFAULT; |
 |
property OutputPrecision: DWord read FOutputPrecision write FOutputPrecision
default OUT_DEFAULT_PRECIS; |
 |
property ClipPrecision: DWord read FClipPrecision write FClipPrecision
default CLIP_DEFAULT_PRECIS; |
 |
property Quality: DWord read FQuality write FQuality default DEFAULT_QUALITY; |
 |
property Pitch: DWord read FPitch write FPitch default DEFAULT_PITCH; |
 |
property Family: DWord read FFamily write FFamily default FF_DONTCARE; |
 |
property FaceName: string read FFaceName write FFaceName; |
Description
Methods
 |
function GetHandle: HFont; |
Create a font with given properties. Calls WinAPI CreateFont. Rememeber to free result somewhere by DeleteObject.
Remeber that you may not get the font you asked for. Windows.CreateFont will try to return something as close as possible, but if exact match will not be possible – it can return something else. E.g. specifying FaceName = 'some non-existing font name' will not cause some error (like EOSError). Instead it will result in default Windows font ("MS Sans Serif" usually) being returned.
Exceptions raised
EOSError
- If font cannot be created (when WinAPI CreateFont returned error)
|
 |
constructor Create(AHeight: Integer); |
Constructor, takes initial Height value. We require the height value to be passed to constructor, simply because there's no "generally sensible" default value for Height.
|
Properties
 |
property Height: Integer read FHeight write FHeight; |
|
 |
property Angle: Integer read FAngle write FAngle default 0; |
Value for both nEscapement and nOrientation parameters for CreateFont. The only portable way is to set them both to the same values.
|
 |
property Weight: Integer read FWeight write FWeight default FW_REGULAR; |
|
 |
property Italic: boolean read FItalic write FItalic default false; |
|
 |
property Underline: boolean read FUnderline write FUnderline default false; |
|
 |
property StrikeOut: boolean read FStrikeOut write FStrikeOut default false; |
|
 |
property CharSet: TWinCharSet read FCharSet write FCharSet default wcsDEFAULT; |
|
 |
property OutputPrecision: DWord read FOutputPrecision write FOutputPrecision
default OUT_DEFAULT_PRECIS; |
|
 |
property ClipPrecision: DWord read FClipPrecision write FClipPrecision
default CLIP_DEFAULT_PRECIS; |
|
 |
property Quality: DWord read FQuality write FQuality default DEFAULT_QUALITY; |
|
 |
property Pitch: DWord read FPitch write FPitch default DEFAULT_PITCH; |
Font pitch and family. They will be combined to create fdwPitchAndFamily param, i.e. fdwPitchAndFamily := Pitch or Family. Pitch is for XXX_PITCH consts, Family is for FF_XXX consts.
|
 |
property Family: DWord read FFamily write FFamily default FF_DONTCARE; |
|
 |
property FaceName: string read FFaceName write FFaceName; |
Font face name. Default is ''.
|
Generated by PasDoc 0.13.0 on 2014-10-26 05:15:16
|