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;

This item has no description.

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public procedure PrepareResources; override;

This item has no description. Showing description inherited from TCastleAbstractFont.PrepareResources.

The font may require some OpenGL resources for drawing. You can explicitly create them using PrepareResources (although it is never needed, resources will be automatically created if needed). There's no public method to explicitly destroy them, they are always destroyed automatically.

Public procedure Print(const X, Y: Single; const Color: TCastleColor; const S: string); override;

This item has no description. Showing description inherited from TCastleAbstractFont.Print.

Draw text at the given position with given color. If the last Color component is not 1, the text is rendered with blending.

Overloaded version without X, Y uses WindowPos (but doesn't modify it, in contrast to PrintAndMove). Overloaded version without Color uses CurrentColor, last color set by glColorv. It is not adviced to use overloaded versions without X, Y or Color — using global state leads to messy code. You should upgrade your code to use the version that gets X,Y,Color explicitly.

May require 1 free slot on the attributes stack. May only be called when current matrix is modelview. Doesn't modify any OpenGL state or matrix, except it moves raster position.

Public function TextWidth(const S: string): Single; override;

This item has no description.

Public function TextHeight(const S: string): Single; override;

This item has no description.

Public function TextHeightBase(const S: string): Single; override;

This item has no description. Showing description inherited from TCastleAbstractFont.TextHeightBase.

The height (above the baseline) of the text. This doesn't take into account height of the text below the baseline (for example letter "y" has the tail below the baseline in most fonts).

Public function TextMove(const S: string): TVector2; override;

This item has no description.

Public function EffectiveSize: Single; override;

This item has no description. Showing description inherited from TCastleAbstractFont.EffectiveSize.

Non-zero font size. Usually same thing as Size, but in case of proxy font classes (like TCustomizedFont and TCastleFontFamily) it makes sure to never return zero (which, in case of font proxies, is allowed value for Size and means "use underlying font size").

Public function FontLoaded: Boolean; override;

This item has no description. Showing description inherited from TCastleAbstractFont.FontLoaded.

If the font is loaded, it can actually display and measure some characters.

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;

This item has no description.


Generated by PasDoc 0.16.0-snapshot.