  Platform eXtended Library (PXL)Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Class TBitmapFonts
Unit
PXL.Fonts
Declaration
type TBitmapFonts = class(TObject)
Description
The list that may contain one or more instances of TBitmapFont and provide facilities to search for fonts by their unique names, font loading and handling "device lost" scenario.
Hierarchy
Overview
Methods
Properties
Description
Methods
 |
constructor Create(const ADevice: TCustomDevice); |
|
Creates new instance of TBitmapFonts class bound to the specified device. Elements inside this list will also be bound to this device.
|
 |
function AddFromBinaryAsset(const AssetName: StdString; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer; |
|
Loads binary font from file in /assets sub-folder and adds its to the list with font name equal to file name (without extension). The given pixel format, if specified, will be used as a hint for initializing font letters image. Returns font index in the list when successful and -1 otherwise.
|
 |
function AddFromBinaryFile(const FileName: StdString; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer; |
|
Loads binary font from external file and adds its to the list with font name equal to file name (without extension). The given pixel format, if specified, will be used as a hint for initializing font letters image. Returns font index in the list when successful and -1 otherwise.
|
 |
function AddFromBinaryStream(const Stream: TStream; const FontName: StdString = ''; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer; |
|
Loads binary font from the given stream and adds its to the list with the given name. The given pixel format, if specified, will be used as a hint for initializing font letters image. Returns font index in the list when successful and -1 otherwise.
|
 |
function AddFromXMLAsset(const ImageAssetName: StdString; const XMLAssetName: StdString = ''; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer; |
|
Loads font letter information and letter image from external files in /assets sub-folder and adds the resulting font to the list with the name equal to that of file name (without extension). This methods accepts that one of file names is left empty and will be guessed by either changing extension from ".xml" to ".png" or vice-versa. This uses image format manager reference from associated device. The given pixel format, if specified, will be used as a hint for initializing font letters image. Returns font index in the list when successful and -1 otherwise.
|
 |
function AddFromXMLFile(const ImageFileName: StdString; const XMLFileName: StdString = ''; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer; |
|
Loads font letter information and letter image from external files on disk and adds the resulting font to the list with the name equal to that of file name (without extension). This methods accepts that one of file names is left empty and will be guessed by either changing extension from ".xml" to ".png" or vice-versa. This uses image format manager reference from associated device. The given pixel format, if specified, will be used as a hint for initializing font letters image. Returns font index in the list when successful and -1 otherwise.
|
 |
function AddFromXMLStream(const ImageExtension: StdString; const ImageStream, XMLStream: TStream; const FontName: StdString = ''; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer; |
|
Loads font letter information and letter image from their corresponding streams and adds the resulting font to the list with the given name. This uses image format manager reference from associated device. The image extension indicates what image format for letters image is used. The given pixel format, if specified, will be used as a hint for initializing font letters image. Returns font index in the list when successful and -1 otherwise.
|
 |
function AddSystemFont(const FontImage: TSystemFontImage = TSystemFontImage.Font8x8; const FontName: StdString = ''; const PixelFormat: TPixelFormat = TPixelFormat.Unknown): Integer; |
|
Adds and initializes one of the predefined system fonts to the list with the given name. These are embedded within the final application and can be used at any time. The drawback of this is that these fonts don't look pretty as the pre-rendered ones and typically contain only ASCII characters. The given pixel format, if specified, will be used as a hint for initializing font letters image. Returns font index in the list when successful and -1 otherwise.
|
 |
function Include(const Element: TBitmapFont): Integer; |
|
Includes the specified font to the list, if it wasn't included previously. This implies searching the list before adding the element, which may impact performance.
|
 |
function IndexOf(const FontName: StdString): Integer; overload; |
|
Returns the index of font with given unique name (not case-sensitive) in the list. If no font with such name exists, returns -1.
|
 |
function IndexOf(const Element: TBitmapFont): Integer; overload; |
|
Returns the index of the given font element in the list. If such font is not found, -1 is returned.
|
 |
function Insert(const Font: TBitmapFont): Integer; |
|
Inserts the given font to the list and returns its index.
|
 |
procedure Clear; |
|
Removes all font entries from the list.
|
 |
procedure MarkSearchDirty; |
|
Indicates that one of the fonts had its name changed, so the list needs to be refreshed to make searching by name (IndexOf function and Font property) work properly.
|
 |
procedure Remove(const Index: Integer); |
|
Removes font with the specified index from the list.
|
Properties
 |
property Canvas: TCustomCanvas read FCanvas write SetCanvas; |
|
Destination canvas to which the text should be rendered to. This can be changed between different drawing calls to a different canvas, as long as such canvas is bound to the same device as the fonts. Note that setting this property changes Canvas value for all the fonts in the list to this same value.
|
 |
property Count: Integer read GetCount; |
|
Total number of elements in the list.
|
 |
property Device: TCustomDevice read FDevice; |
|
The device to which this list is bound to.
|
 |
property Font[constName:StdString]: TBitmapFont read GetFont; |
|
Provides access to individual fonts in the list by unique font name (not case-sensitive). If no font with such name is found, Nil is returned.
|
 |
property Items[constIndex:Integer]: TBitmapFont read GetItem; |
|
Provides access to individual fonts in the list by the corresponding index. If the index is outside of valid range, Nil is returned.
|
 |
property StyleTags: TBitmapFont.TStyleTags read FStyleTags; |
|
Global font style tags that can be shared among all fonts contained in this list.
|
Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.
|