Class TCastleUserInterfaceFont
Unit
Declaration
type TCastleUserInterfaceFont = class(TCastleUserInterface)
Description
Base class for all user interface controls using a font. Allows to customize font and font size per-control, or use defaults.
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleUserInterface
- TCastleUserInterfaceFont
Overview
Methods
![]() |
procedure InternalSetTooltipExists(const Value: Boolean); override; |
![]() |
procedure UIScaleChanged; override; |
![]() |
procedure Notification(AComponent: TComponent; Operation: TOperation); override; |
![]() |
constructor Create(AOwner: TComponent); override; |
![]() |
destructor Destroy; override; |
![]() |
function TooltipExists: boolean; override; |
![]() |
procedure TooltipRender(const TooltipPosition: TVector2); override; |
![]() |
procedure Render; override; |
![]() |
function PropertySections(const PropertyName: String): TPropertySections; override; |
![]() |
procedure AssignFont(const Source: TCastleUserInterfaceFont); |
![]() |
function Font: TCastleAbstractFont; |
![]() |
procedure CheckFontChanged; |
![]() |
procedure FontChanged; virtual; |
Properties
![]() |
property OwnsCustomFont: boolean
read FOwnsCustomFont write FOwnsCustomFont default false; deprecated 'use TCastleAbstractFont (inherited from TComponent) owner mechanism'; |
![]() |
property SmallFont: boolean read FSmallFont write SetSmallFont default false; deprecated 'use "FontScale := 0.5" or "CustomFont := MySmalFont" instead of "SmallFont := true", this is more flexible'; |
![]() |
property OutlineColor: TCastleColor read FOutlineColor write SetOutlineColor; |
![]() |
property Tooltip: string read FTooltip write FTooltip; |
![]() |
property CustomFont: TCastleAbstractFont
read FCustomFont write SetCustomFont; |
![]() |
property FontSize: Single read FFontSize write SetFontSize default 0.0; |
![]() |
property FontScale: Single read FFontScale write SetFontScale default 1.0; |
![]() |
property Outline: Cardinal read FOutline write SetOutline default 0; |
![]() |
property OutlineHighQuality: boolean
read FOutlineHighQuality write SetOutlineHighQuality default false; |
![]() |
property OutlineColorPersistent: TCastleColorPersistent read FOutlineColorPersistent ; |
Description
Methods
![]() |
procedure InternalSetTooltipExists(const Value: Boolean); override; |
This item has no description. |
![]() |
procedure UIScaleChanged; override; |
This item has no description. |
![]() |
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. |
![]() |
function TooltipExists: boolean; override; |
This item has no description. Showing description inherited from TCastleUserInterface.TooltipExists.
Render a tooltip of this control. If you want to have tooltip for this control detected, you have to override TooltipRender is called in the same way as Render. TooltipRender is always called as a last (front-most) control. Argument TooltipPosition is the left-bottom (in screen space, regardless of UIScaling) suggested position of the tooltip. It is simplest to descend from TCastleUserInterfaceFont, that implements simple TCastleUserInterfaceFont.Tooltip property and overrides these two methods as necessary. |
![]() |
procedure TooltipRender(const TooltipPosition: TVector2); override; |
This item has no description. |
![]() |
procedure Render; override; |
This item has no description. Showing description inherited from TCastleUserInterface.Render. Render a control. Called only when Exists and GLInitialized, you can depend on it in the implementation of this method. Do not explicitly call this method. Instead, render controls by adding them to the TCastleContainer.Controls list, or render them explicitly (for off-screen rendering) by TCastleContainer.RenderControl. This is method should only be overridden in your own code. Before calling this method we always set some OpenGL state, and you can depend on it (and you can carelessly change it, as it will be reset again before rendering other control). OpenGL state always set:
Beware that GLSL RenderContext.CurrentProgram has undefined value when this is called. You should always set it, before making direct OpenGL drawing calls (all the engine drawing routines of course do it already, this is only a concern if you make direct OpenGL / OpenGLES calls). |
![]() |
function PropertySections(const PropertyName: String): TPropertySections; override; |
This item has no description. Showing description inherited from TCastleComponent.PropertySections. Section where to show property in the editor. |
![]() |
procedure AssignFont(const Source: TCastleUserInterfaceFont); |
Copy font properties from another control. |
![]() |
function Font: TCastleAbstractFont; |
Font used for rendering and measuring this control. Depending on which one is set, this method returns CustomFont or TCastleContainer.DefaultFont or global UIFont. It may also return a TCastleFontFamily instance that wraps (and scales) one of them. |
![]() |
procedure CheckFontChanged; |
Check does currently used font (see Font) changed, and eventually call FontChanged method now. You only need to explicitly call this in very specific circumstances, when you just changed UIFont or TCastleContainer.DefaultFont and you want control size to be updated immediately (for example, you need EffectiveHeight to be immediately valid). Without calling this, it could be updated only at next Render call. Changing CustomFont automatically calls this. |
![]() |
procedure FontChanged; virtual; |
Force considering font changed (font instance, or glyphs, or sizes changed). Usually, you don't need to call this explicitly from the outside. Changing font, like CustomFont or TCastleContainer.DefaultFont or UIFont, or any property that may affect the font is automatically applied. But there are exceptions: right now, if you call Load on a font, it's measurements will change but some controls using it will not recalculate sizes automatically. In this case, call this method. |
Properties
![]() |
property OutlineColor: TCastleColor read FOutlineColor write SetOutlineColor; |
Outline color, used only if Outline <> 0. Default is black. See also
|
![]() |
property Tooltip: string read FTooltip write FTooltip; |
Tooltip string, displayed when user hovers the mouse over a control. Note that you can override TCastleUserInterface.TooltipExists and TCastleUserInterface.TooltipRender to customize the tooltip drawing. |
![]() |
property CustomFont: TCastleAbstractFont
read FCustomFont write SetCustomFont; |
Font used to render text of this control. When this is |
![]() |
property FontSize: Single read FFontSize write SetFontSize default 0.0; |
Use given font size when drawing. Leave at default zero to use the default size of the current font. |
![]() |
property FontScale: Single read FFontScale write SetFontScale default 1.0; |
Scale the font. This additionally scales the font defined by all other properties of this class, thus you can use it to reliably scale the font (regardless if you use CustomFont or not, regardless if you set FontSize or not). |
![]() |
property Outline: Cardinal read FOutline write SetOutline default 0; |
Outline size around the font. Note that the current implementation is very simple, it will only look sensible for small outline values (like 1 or 2). See TCastleAbstractFont.Outline for more details. Specifying a non-zero outline for a label overrides the default outline settings for the current font. By default, fonts do not have an outline. TODO: UI scaling (TCastleContainer.UIScaling) doesn't affect outline size now. See also
|
![]() |
property OutlineHighQuality: boolean
read FOutlineHighQuality write SetOutlineHighQuality default false; |
Optionally force better outline quality. Used only if Outline <> 0. High quality outline looks better, but is about 2x more expensive to draw. See also
|
![]() |
property OutlineColorPersistent: TCastleColorPersistent read FOutlineColorPersistent ; |
OutlineColor that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write OutlineColor directly. See also
|
Generated by PasDoc 0.16.0.