Class TCustomizedFont

Unit

Declaration

type TCustomizedFont = class(TCastleAbstractFont)

Description

Font that uses another TCastleAbstractFont for rendering and sizing, but modifies the underlying font size. Simply set the Size property of this instance to non-zero to force the specific size.

The underlying font properties remain unchanged (so it can be still used for other purposes, directly or by other TCustomizedFont wrappers).

Hierarchy

Overview

Methods

Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure PrepareResources; override;
Public procedure Print(const X, Y: Single; const Color: TCastleColor; const S: string); override;
Public function TextWidth(const S: string): Single; override;
Public function TextHeight(const S: string): Single; override;
Public function TextHeightBase(const S: string): Single; override;
Public function TextMove(const S: string): TVector2; override;
Public function EffectiveSize: Single; override;
Public function FontLoaded: Boolean; override;
Public procedure AddAlternativeSourceFont(const ASourceFont: TCastleAbstractFont);
Public procedure Load(const URL: string; const ASizes: array of Integer; const AnAntiAliased: boolean; const ACharacters: TUnicodeCharList = nil);
Public function BestSourceFont(const ASize: Single): TCastleAbstractFont;

Properties

Public property SourceFont: TCastleAbstractFont read FSourceFont write SetSourceFont;

Description

Methods

Protected procedure Notification(AComponent: TComponent; Operation: TOperation); override;
 
Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public procedure PrepareResources; override;
 
Public procedure Print(const X, Y: Single; const Color: TCastleColor; const S: string); override;
 
Public function TextWidth(const S: string): Single; override;
 
Public function TextHeight(const S: string): Single; override;
 
Public function TextHeightBase(const S: string): Single; override;
 
Public function TextMove(const S: string): TVector2; override;
 
Public function EffectiveSize: Single; override;
 
Public function FontLoaded: Boolean; override;
 
Public procedure AddAlternativeSourceFont(const ASourceFont: TCastleAbstractFont);

Add any number of alternative source fonts. Before actually using them for rendering, we always choose the one with size most matching our desired Size. This way you can e.g. load the same font in sizes 10, 50, 100, and have good quality font rendering in various sizes.

Public procedure Load(const URL: string; const ASizes: array of Integer; const AnAntiAliased: boolean; const ACharacters: TUnicodeCharList = nil);

Load the same font to a number of textures with different sizes. At rendering, we will automatically use the best size. This sets SourceFont and AddAlternativeSourceFont.

This allows to achieve better look than TTexturedFont with one size.

Public function BestSourceFont(const ASize: Single): TCastleAbstractFont;

Return SourceFont or one of the fonts added by AddAlternativeSourceFont, to have the font with TCastleAbstractFont.Size closest to the given ASize.

Properties

Public property SourceFont: TCastleAbstractFont read FSourceFont write SetSourceFont;
 

Generated by PasDoc 0.16.0.