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
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleAbstractFont
- TCustomizedFont
Overview
Methods
procedure Notification(AComponent: TComponent; Operation: TOperation); override; |
|
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
procedure PrepareResources; override; |
|
procedure Print(const X, Y: Single; const Color: TCastleColor; const S: string); override; |
|
function TextWidth(const S: string): Single; override; |
|
function TextHeight(const S: string): Single; override; |
|
function TextHeightBase(const S: string): Single; override; |
|
function TextMove(const S: string): TVector2; override; |
|
function EffectiveSize: Single; override; |
|
function FontLoaded: Boolean; override; |
|
procedure AddAlternativeSourceFont(const ASourceFont: TCastleAbstractFont); |
|
procedure Load(const Url: String; const ASizes: array of Integer; const AnAntiAliased: boolean; const ACharacters: TUnicodeCharList = nil); |
|
function BestSourceFont(const ASize: Single): TCastleAbstractFont; |
Properties
property SourceFont: TCastleAbstractFont read FSourceFont write SetSourceFont; |
Description
Methods
procedure Notification(AComponent: TComponent; Operation: TOperation); override; |
|
This item has no description. |
constructor Create(AOwner: TComponent); override; |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
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 |
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. |
function TextWidth(const S: string): Single; override; |
|
This item has no description. |
function TextHeight(const S: string): Single; override; |
|
This item has no description. |
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). |
function TextMove(const S: string): TVector2; override; |
|
This item has no description. |
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"). |
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. |
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. |
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. |
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
property SourceFont: TCastleAbstractFont read FSourceFont write SetSourceFont; |
|
This item has no description. |
Generated by PasDoc 0.16.0-snapshot.