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.

See manual about displaying text and fonts. See manual about TCastleText in a viewport.

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;

This item has no description. Showing description inherited from TCastleComponent.TranslateProperties.

Enumerate all properties that are possible to translate in this component. E.g. in TCastleLabel it will return TCastleLabel.Caption, in TCastleEdit it will return TCastleEdit.Text and TCastleEdit.Placeholder.

Returns only non-empty properties, thus assuming that if current (by convention, English) text is empty, then there is no point in translating it. Moreover descendants may define boolean properties to exclude particular text from translating, e.g. TCastleLabel.CaptionTranslate, TCastleEdit.TextTranslate, TCastleEdit.PlaceholderTranslate.

It is not recursive (it doesn't enumerate children properties). Use global TranslateProperties procedure to call this on a hierarchy of TComponent.

You usually don't want to call this method (it is called by other engine routines). But you may find it useful to override this, if you define new component.

Protected function GetInternalText: String; override;

This item has no description.

Protected procedure SetInternalText(const Value: String); override;

This item has no description.

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public 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.

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-snapshot.