kanzi::TextBlockConcept Class Reference

TextConcept is base class for nodes that implement text rendering. More...

#include <kanzi/ui/node/concept/text_block.hpp>

Inheritance diagram for kanzi::TextBlockConcept:
kanzi::TextBlockConceptImpl< TBaseClass, TDerivedClass > kanzi::TextBlockConceptImpl< Node2D, TextBlock2D > kanzi::TextBlockConceptImpl< Node3D, TextBlock3D > kanzi::TextBlock2D kanzi::TextBlock3D

Public Types

enum  TextHorizontalAlignment { TextHorizontalAlignmentLeft, TextHorizontalAlignmentRight, TextHorizontalAlignmentCenter }
 Horizontal alignment options for text layout. More...
 
enum  TextVerticalAlignment { TextVerticalAlignmentTop, TextVerticalAlignmentBaseline, TextVerticalAlignmentCenter, TextVerticalAlignmentBottom }
 Vertical alignment options for text layout. More...
 

Static Public Member Functions

static PropertyTypeEditorInfoSharedPtr makeEditorInfo ()
 

Static Public Attributes

Properties
static PropertyType< ColorRGBAFontColorProperty
 Use the Font Color property to set the text color for the default font material and for the materials with a fragment shader that uses the FontColor uniform. More...
 
static PropertyType< float > FontSizeProperty
 Use the Font Size property to set the size of the font in device-independent pixels. More...
 
static PropertyType< ResourceSharedPtrFontMaterialProperty
 Use the Font Material property to set the material whose shader is used to render the text. More...
 
static PropertyType< TextBlockConcept::TextHorizontalAlignmentTextHorizontalAlignmentProperty
 Use the Text Horizontal Alignment property to set the horizontal alignment of the text. More...
 
static PropertyType< TextBlockConcept::TextVerticalAlignmentTextVerticalAlignmentProperty
 Use the Text Vertical Alignment property to set the vertical alignment of the text. More...
 
static PropertyType< float > LineSpacingProperty
 Use the Line Spacing property to set the line spacing in multiples of the normal line height of the selected font. More...
 
static PropertyType< float > CharacterSpacingProperty
 Use the Character Spacing property to set the character spacing in device-independent pixels. More...
 
static PropertyType< string > OverflowProperty
 Use the Overflow property to set the characters that represent the clipped text when the text string to be rendered is too long to fit in the node. More...
 
static PropertyType< string > TextProperty
 Use the Text property to set the text content that the text block renders. More...
 
static PropertyType< bool > WordWrapProperty
 Use the Word Wrap property to break long text lines to multiple lines to make the text fit within the boundaries of the text block. More...
 
static PropertyType< bool > ConstrainContentHeightProperty
 Use the Constrain Content Height property to cut out the last lines that do not fit within the boundaries of the text block. More...
 
static PropertyType< float > FixedCharacterWidthProperty
 Use the Fixed Character Width property to override the font advance widths and make each character take a fixed amount of space specified in device-independent pixels. More...
 
static PropertyType< Vector2HorizontalPaddingProperty
 Use the Horizontal Padding property to set the padding spaces between the content and the left and right boundaries of the text block. More...
 
static PropertyType< Vector2VerticalPaddingProperty
 Use the Vertical Padding property to set the padding spaces between the content and the top and bottom boundaries of the text block. More...
 
static PropertyType< bool > RemoveSideBearingsProperty
 Use the Remove Side Bearings property to position the leftmost characters of left-aligned text and rightmost characters of right-aligned text exactly within the boundary of the text block. More...
 
static PropertyType< bool > FractionalCharacterWidthProperty
 Sets whether Kanzi uses fractional or rounded character widths to lay out text. More...
 
static PropertyType< bool > SnapCharacterToPixelProperty
 Sets whether Kanzi positions characters in 2D rendering to the nearest pixel: More...
 
static PropertyType< FontHintingPreferenceHintingPreferenceProperty
 Sets the hinting preference of the selected font. More...
 

Detailed Description

TextConcept is base class for nodes that implement text rendering.

Member Enumeration Documentation

Horizontal alignment options for text layout.

Enumerator
TextHorizontalAlignmentLeft 

Text is aligned to the left.

TextHorizontalAlignmentRight 

Text is aligned to the right.

TextHorizontalAlignmentCenter 

Text is centered horizontally.

Vertical alignment options for text layout.

Enumerator
TextVerticalAlignmentTop 

Text is aligned to the top.

TextVerticalAlignmentBaseline 

Text is aligned to the baseline of the first line of the text.

TextVerticalAlignmentCenter 

Text is centered vertically.

TextVerticalAlignmentBottom 

Text is aligned to the bottom.

Member Function Documentation

static PropertyTypeEditorInfoSharedPtr kanzi::TextBlockConcept::makeEditorInfo ( )
static

Member Data Documentation

PropertyType<ColorRGBA> kanzi::TextBlockConcept::FontColorProperty
static

Use the Font Color property to set the text color for the default font material and for the materials with a fragment shader that uses the FontColor uniform.

The default value is ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f).

See also
TextBlockConceptImpl::setFontColor(), TextBlockConceptImpl::getFontColor()
PropertyType<float> kanzi::TextBlockConcept::FontSizeProperty
static

Use the Font Size property to set the size of the font in device-independent pixels.

The default value is 36.0f.

See also
TextBlockConceptImpl::setFontSize(), TextBlockConceptImpl::getFontSize()
PropertyType<ResourceSharedPtr> kanzi::TextBlockConcept::FontMaterialProperty
static

Use the Font Material property to set the material whose shader is used to render the text.

The shader must use the ContentTexture uniform which is automatically filled with glyph data. The default value is ResourceSharedPtr().

See also
TextBlockConceptImpl::setFontMaterial(), TextBlockConceptImpl::getFontMaterial()
PropertyType<TextBlockConcept::TextHorizontalAlignment> kanzi::TextBlockConcept::TextHorizontalAlignmentProperty
static

Use the Text Horizontal Alignment property to set the horizontal alignment of the text.

The default value is TextBlockConcept::TextHorizontalAlignmentLeft.

See also
TextBlockConceptImpl::setTextHorizontalAlignment(), TextBlockConceptImpl::getTextHorizontalAlignment()
PropertyType<TextBlockConcept::TextVerticalAlignment> kanzi::TextBlockConcept::TextVerticalAlignmentProperty
static

Use the Text Vertical Alignment property to set the vertical alignment of the text.

The default value is TextBlockConcept::TextVerticalAlignmentTop.

See also
TextBlockConceptImpl::setTextVerticalAlignment(), TextBlockConceptImpl::getTextVerticalAlignment()
PropertyType<float> kanzi::TextBlockConcept::LineSpacingProperty
static

Use the Line Spacing property to set the line spacing in multiples of the normal line height of the selected font.

The default value is 1.0f.

See also
TextBlockConceptImpl::setLineSpacing(), TextBlockConceptImpl::getLineSpacing()
PropertyType<float> kanzi::TextBlockConcept::CharacterSpacingProperty
static

Use the Character Spacing property to set the character spacing in device-independent pixels.

The default value is 0.0f.

See also
TextBlockConceptImpl::setCharacterSpacing(), TextBlockConceptImpl::getCharacterSpacing()
PropertyType<string> kanzi::TextBlockConcept::OverflowProperty
static

Use the Overflow property to set the characters that represent the clipped text when the text string to be rendered is too long to fit in the node.

The default value is "...".

See also
TextBlockConceptImpl::setOverflow(), TextBlockConceptImpl::getOverflow()
PropertyType<string> kanzi::TextBlockConcept::TextProperty
static

Use the Text property to set the text content that the text block renders.

The default value is "Text".

See also
TextBlockConceptImpl::setText(), TextBlockConceptImpl::getText()
PropertyType<bool> kanzi::TextBlockConcept::WordWrapProperty
static

Use the Word Wrap property to break long text lines to multiple lines to make the text fit within the boundaries of the text block.

The default value is true.

See also
TextBlockConceptImpl::setWordWrap(), TextBlockConceptImpl::isWordWrap()
PropertyType<bool> kanzi::TextBlockConcept::ConstrainContentHeightProperty
static

Use the Constrain Content Height property to cut out the last lines that do not fit within the boundaries of the text block.

The default value is true.

See also
TextBlockConceptImpl::setConstrainContentHeight(), TextBlockConceptImpl::isConstrainContentHeight()
PropertyType<float> kanzi::TextBlockConcept::FixedCharacterWidthProperty
static

Use the Fixed Character Width property to override the font advance widths and make each character take a fixed amount of space specified in device-independent pixels.

The default value is -1.0f.

See also
TextBlockConceptImpl::setFixedCharacterWidth(), TextBlockConceptImpl::getFixedCharacterWidth()
PropertyType<Vector2> kanzi::TextBlockConcept::HorizontalPaddingProperty
static

Use the Horizontal Padding property to set the padding spaces between the content and the left and right boundaries of the text block.

The default value is Vector2(0.0f, 0.0f).

See also
TextBlockConceptImpl::setHorizontalPadding(), TextBlockConceptImpl::getHorizontalPadding()
PropertyType<Vector2> kanzi::TextBlockConcept::VerticalPaddingProperty
static

Use the Vertical Padding property to set the padding spaces between the content and the top and bottom boundaries of the text block.

The default value is Vector2(0.0f, 0.0f).

See also
TextBlockConceptImpl::setVerticalPadding(), TextBlockConceptImpl::getVerticalPadding()
PropertyType<bool> kanzi::TextBlockConcept::RemoveSideBearingsProperty
static

Use the Remove Side Bearings property to position the leftmost characters of left-aligned text and rightmost characters of right-aligned text exactly within the boundary of the text block.

The default value is false.

PropertyType<bool> kanzi::TextBlockConcept::FractionalCharacterWidthProperty
static

Sets whether Kanzi uses fractional or rounded character widths to lay out text.

In most cases fractional widths provide the best result. However, with small font sizes, fractional widths can cause the characters to run together or have too much space, making it difficult to read.

  • When enabled, Kanzi uses fractional character widths, which means that the spacing between characters varies and can be a fraction of a pixel.
  • When disabled, Kanzi uses character widths rounded to the nearest pixel. Disable fractional widths when you want to fix character spacing in whole-pixel increments and prevent characters in small font sizes from running together. The default value is true.
    Since
    Kanzi 3.6.18
PropertyType<bool> kanzi::TextBlockConcept::SnapCharacterToPixelProperty
static

Sets whether Kanzi positions characters in 2D rendering to the nearest pixel:

  • When enabled, text sharpness improves, but some characters can shift a fraction of a pixel.
  • When disabled, certain combinations of screen resolution, use of anti-aliasing, and font size can cause the text to appear blurry. In that case, you can improve the appearance of the text with the FractionalCharacterWidthProperty and CharacterSpacingProperty properties. The default value is true.
    Since
    Kanzi 3.6.18
PropertyType<FontHintingPreference> kanzi::TextBlockConcept::HintingPreferenceProperty
static

Sets the hinting preference of the selected font.

The default value is FontHintingPreference::NativeHinting.

Since
Kanzi 3.6.18

The documentation for this class was generated from the following file: