[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# TFont

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The Font to be used for drawing Text

## Declaration

Source position: graphics.pp line 476

`type TFont = class(TFPCustomFont)`
`protected`
`function GetCharSet;` |  | GetCharSet - returns the Character Set to be used for this Font
`function GetHeight;` |  | GetHeight - returns the height of the Font
`function GetName;` |  | GetName - returns the name of the Font
`function GetOrientation;` |  | GetOrientation - Returns the orientation for the font
`function GetPitch;` |  | GetPitch - returns the pitch of the Font
`function GetSize;` |  | GetSize - returns the size of the Font
`function GetStyle;` |  | GetStyle - returns the style of the Font
`procedure Changed; override;` |  | Changed - checks for pending updates (if there are any, returns True) or calls inherited Changed
`procedure DoAllocateResources; override;` |  | DoAllocateResources - calls inherited method then calls GetReference
`procedure DoCopyProps(); override;` |  | DoCopyProps - calls inherited method; if From argument is another Font, copies specified properties directly
`procedure DoDeAllocateResources; override;` |  | DoDeAllocateResources - frees references then calls inherited method
`procedure SetCharSet();` |  | SetCharSet - specify the character set
`procedure SetColor();` |  | SetColor - specify the colour for the font
`procedure SetFlags(); override;` |  | SetFlags - if the passed argument AValue for the Index is the same, returns unchanged; otherwise, calls inherited method and sets style flags as appropriate
`procedure SetFPColor(); override;` |  | SetFPColor converts TFPColor to TColor
`procedure SetHeight();` |  | SetHeight - specify the height of the Font
`procedure SetName(); override;` |  | SetName - if AValue is a new name, frees the old reference, calls inherited method and sets the Changed property
`procedure SetOrientation();`
`procedure SetPitch();` |  | SetPitch - specify the pitch for the Font
`procedure SetSize(); override;` |  | SetSize - if AValue is a new size, frees the old reference, calls the inherited method, performs the appropriate rounding and sets the Changed property
`procedure SetStyle();` |  | SetStyle - specify which style to use
`procedure SetQuality();` |  | SetQuality - specify the quality
`public`
`constructor Create; override;` |  | Create - constructor for TFont: Opens a new instance of the class, calling inherited Create and setting some defaults
`destructor Destroy; override;` |  | Destroy - destructor for TFont: frees reference then performs inherited Destroy
`procedure Assign();` |  | Assign - copies the LogFont settings to itself
`procedure BeginUpdate;` |  | BeginUpdate - start the update process
`procedure EndUpdate;` |  | EndUpdate - finish the update process
`property FontData: TFontData; [rw]` |  | FontData - the data describing the font
`function HandleAllocated;` |  | HandleAllocated - returns True if a handle has been allocated
`property Handle: HFONT; [rw]` |  | Operataing system Handle for this Font
`function IsDefault;` |  | IsDefault - returns True if this is the default Font
`function IsEqual(); virtual;` |  | IsEqual - returns True if this Font is the same as the specified Font
`property IsMonoSpace: Boolean; [r]` |  | IsMonoSpace - returns True if this is a MonoSpace Font
`procedure SetDefault;` |  | SetDefault - method for setting the default Font
`property CanUTF8: Boolean; [r]` |  | CanUTF8 - returns True if Font can be used for UTF8
`property PixelsPerInch: Integer; [rw]` |  | PixelsPerInch - scaling factor for drawing Font
`property Reference: TWSFontReference; [r]` |  | Reference - References made to this Font
`published`
`property CharSet: TFontCharSet; [rw]` |  | The Character Set to be used by the currentFont
`property Color: TColor; [rw]` |  | Colour of the current Font
`property Height: Integer; [rws]` |  | The Height of the current Font
`property Name: String; [rws]`
`property Orientation: Integer; [rw]` |  | The Orientation (wheteher horizontal or vertical etc) of the current font
`property Pitch: TFontPitch; [rw]` |  | Pitch type of the Font
`property Quality: TFontQuality; [rw]` |  | Output quality of the Font, such as antialiasing
`property Size: Integer; [rws]`
`property Style: TFontStyles; [rw]` |  | Style of the Font
`end;`

## Inheritance

`TFont` |  | The Font to be used for drawing Text
`TFPCustomFont`
`TObject`

## Description

Most of the data about the font are dealt with by the protected procedures GetData and SetData which operate on TFontData

Individual properties such as Character Set, colour and size can be accessed in the public area

The latest version of this document can be found at lazarus-ccr.sourceforge.net.