Class TCastleBitmapFont
Unit
CastleFonts
Declaration
type TCastleBitmapFont = class(TCastleAbstractFont)
Description
Bitmap font, where each character is just drawn (and may be multi-color) on a raster image. See https://en.wikipedia.org/wiki/Computer_font about "bitmap font" or (less common name, but more valid) "raster font".
By default this class makes some assumptions about how the font image looks like: the characters are placed on the image in their Unicode order, starting from space in the upper-left corner. TODO: Use OnGlyph event to customize it.
Examples of such fonts:
Hierarchy
Overview
Methods
|
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
procedure Load(const AImage: TCastleImage; const AImageColumns, AImageRows, AImageMargin: Cardinal; const ADisplayMargin: Single); deprecated 'assign properties to load font: ImageUrl, ImageColumns, ImageRows, ImageMargin and (only for display) DisplayMargin'; |
|
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 FontLoaded: Boolean; override; |
Properties
|
property ImageUrl: String read FImageUrl write SetImageUrl; |
|
property ImageColumns: Cardinal read FImageColumns write SetImageColumns default 8; |
|
property ImageRows: Cardinal read FImageRows write SetImageRows default 8; |
|
property ImageMargin: Cardinal read FImageMargin write SetImageMargin default 0; |
|
property DisplayMargin: Single read FDisplayMargin write SetDisplayMargin default 2; |
Description
Methods
|
constructor Create(AOwner: TComponent); override; |
|
|
destructor Destroy; override; |
|
|
procedure Load(const AImage: TCastleImage; const AImageColumns, AImageRows, AImageMargin: Cardinal; const ADisplayMargin: Single); deprecated 'assign properties to load font: ImageUrl, ImageColumns, ImageRows, ImageMargin and (only for display) DisplayMargin'; |
Warning: this symbol is deprecated: assign properties to load font: ImageUrl, ImageColumns, ImageRows, ImageMargin and (only for display) DisplayMargin
Load font from given image.
Parameters
- AImage
- Image data, becomes owned by this class.
- AImageMargin
- There is a margin in the image between rows and cols.
- ADisplayMargin
- We can display some spacing between characters. This is independent from ImageMargin and image contents.
|
|
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 FontLoaded: Boolean; override; |
|
Properties
|
property ImageUrl: String read FImageUrl write SetImageUrl; |
Image that contains the characters. The characters are placed on the image in their Unicode order, starting from space in the upper-left corner.
The characters are organized in ImageColumns columns and ImageRows rows, and have ImageMargin space between them.
|
|
property ImageColumns: Cardinal read FImageColumns write SetImageColumns default 8; |
Columns of the characters in the image ImageUrl.
|
|
property ImageRows: Cardinal read FImageRows write SetImageRows default 8; |
Rows of the characters in the image ImageUrl.
|
|
property ImageMargin: Cardinal read FImageMargin write SetImageMargin default 0; |
Margin between characters in the image ImageUrl.
|
|
property DisplayMargin: Single read FDisplayMargin write SetDisplayMargin default 2; |
Spacing between characters when rendering the font. This is independent from ImageMargin.
|
Generated by PasDoc 0.16.0.