Class TWindowsFont

DescriptionHierarchyFieldsMethodsProperties

Unit

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

  • TObject
  • TWindowsFont

Overview

Methods

Public function GetHandle: HFont;
Public constructor Create(AHeight: Integer);

Properties

Public property Height: Integer read FHeight write FHeight;
Public property Angle: Integer read FAngle write FAngle default 0;
Public property Weight: Integer read FWeight write FWeight default FW_REGULAR;
Public property Italic: boolean read FItalic write FItalic default false;
Public property Underline: boolean read FUnderline write FUnderline default false;
Public property StrikeOut: boolean read FStrikeOut write FStrikeOut default false;
Public property CharSet: TWinCharSet read FCharSet write FCharSet default wcsDEFAULT;
Public property OutputPrecision: DWord read FOutputPrecision write FOutputPrecision default OUT_DEFAULT_PRECIS;
Public property ClipPrecision: DWord read FClipPrecision write FClipPrecision default CLIP_DEFAULT_PRECIS;
Public property Quality: DWord read FQuality write FQuality default DEFAULT_QUALITY;
Public property Pitch: DWord read FPitch write FPitch default DEFAULT_PITCH;
Public property Family: DWord read FFamily write FFamily default FF_DONTCARE;
Public property FaceName: string read FFaceName write FFaceName;

Description

Methods

Public 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)
Public 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

Public property Height: Integer read FHeight write FHeight;
 
Public 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.

Public property Weight: Integer read FWeight write FWeight default FW_REGULAR;
 
Public property Italic: boolean read FItalic write FItalic default false;
 
Public property Underline: boolean read FUnderline write FUnderline default false;
 
Public property StrikeOut: boolean read FStrikeOut write FStrikeOut default false;
 
Public property CharSet: TWinCharSet read FCharSet write FCharSet default wcsDEFAULT;
 
Public property OutputPrecision: DWord read FOutputPrecision write FOutputPrecision default OUT_DEFAULT_PRECIS;
 
Public property ClipPrecision: DWord read FClipPrecision write FClipPrecision default CLIP_DEFAULT_PRECIS;
 
Public property Quality: DWord read FQuality write FQuality default DEFAULT_QUALITY;
 
Public 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.

Public property Family: DWord read FFamily write FFamily default FF_DONTCARE;
 
Public 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