Class TCastleText

Unit

Declaration

type TCastleText = class(TCastleAbstractPrimitive)

Description

Text that is displayed and transformed as TCastleTransform, inside TCastleViewport, and can be manipulated in 3D.

Hierarchy

Overview

Methods

Protected procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); override;
Protected function GetInternalText: String; override;
Protected procedure SetInternalText(const Value: String); override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;

Properties

Published property Caption: String read GetCaption write SetCaption stored false;
Published property Text: TStrings read FText write SetText;
Published property CaptionTranslate: Boolean read FCaptionTranslate write FCaptionTranslate default true;
Published property Material default pmUnlit;
Published property DoubleSided: Boolean read FDoubleSided write SetDoubleSided default true;
Published property Alignment: THorizontalPosition read FAlignment write SetAlignment default hpLeft;
Published property VerticalAlignment: TVerticalPosition read FVerticalAlignment write SetVerticalAlignment default vpBottom;
Published property Size: Single read FSize write SetSize default 1.0;
Published property Spacing: Single read FSpacing write SetSpacing default 1.0;
Published property CustomFont: TCastleFont read FCustomFont write SetCustomFont;

Description

Methods

Protected procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); override;
 
Protected function GetInternalText: String; override;
 
Protected procedure SetInternalText(const Value: String); override;
 
Public constructor Create(AOwner: TComponent); override;
 
Public destructor Destroy; override;
 
Public function PropertySections(const PropertyName: String): TPropertySections; override;
 

Properties

Published property Caption: String read GetCaption write SetCaption stored false;

Text displayed, expressed by a simple String. This is just a shortcut to get/set Text as a single String.

Use LineEnding or NL constant when setting this to indicate a newline. The two examples below are equivalent:

// one way
MyText.Text.Clear;
MyText.Text.Add('First line');
MyText.Text.Add('Second line');

// alternative way to do the same
MyText.Caption := 'First line' + LineEnding + 'Second line';

Published property Text: TStrings read FText write SetText;

Text displayed, with each line as a separate String. Setting this property merely copies the contents using TStrings.Assign.

Published property CaptionTranslate: Boolean read FCaptionTranslate write FCaptionTranslate default true;

Should the Caption be localized (translated into other languages). Determines if the property is enumerated by TCastleComponent.TranslateProperties, which affects the rest of localization routines.

Published property Material default pmUnlit;

Text is by default unlit.

Published property DoubleSided: Boolean read FDoubleSided write SetDoubleSided default true;

When this is True, the object is visible (and lit) from both sides.

Note that the default for TCastleText is different than the default for most other primitives, like TCastleBox and TCastleSphere: by default text is double-sided, while most other primitives by default are not double-sided. Set this property to False for more performance in case camera may be behind the text. The reason for different default is that text object doesn't have an obvious "interior", unlike a box of sphere, so you can more easily land behind the text (and get confused why is it not displayed). This follows X3D TTextNode.Solid default.

Published property Alignment: THorizontalPosition read FAlignment write SetAlignment default hpLeft;

Horizontal alignment of the text.

Published property VerticalAlignment: TVerticalPosition read FVerticalAlignment write SetVerticalAlignment default vpBottom;

Vertical alignment of the text.

Published property Size: Single read FSize write SetSize default 1.0;

Size of the text, given as height of a single line of text. See https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD/Part01/components/text.html#FontStyle for an illustrative image.

Published property Spacing: Single read FSpacing write SetSpacing default 1.0;

Spacing between lines of text, to make lines more distant (with values > 1) or more squeezed (with values < 1). See https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD/Part01/components/text.html#FontStyle for an illustrative image.

Published property CustomFont: TCastleFont read FCustomFont write SetCustomFont;

Adjust the font.


Generated by PasDoc 0.16.0.