TextConceptImpl provides the common base implementation for text rendering nodes. More...
#include <kanzi/ui/node/concept/text_concept.hpp>
Static Public Member Functions | |
static PropertyTypeEditorInfoSharedPtr | makeEditorInfo () |
Static Public Member Functions inherited from kanzi::TextConcept | |
static PropertyTypeEditorInfoSharedPtr | makeEditorInfo () |
Protected Member Functions | |
void | prepareTextFormat (const TextFormatParameters ¶meters, string text) |
Updates the parameters and text of the internal text format. | |
TextConceptImpl ()=default | |
Constructor. | |
Protected Attributes | |
TextFormatPtr | m_textFormat |
The text format for the text that this node displays. | |
Additional Inherited Members | |
Static Public Attributes inherited from kanzi::TextConcept | |
static PropertyType< ColorRGBA > | FontColorProperty |
Sets the text color for the default font material and for the materials with a fragment shader that uses the FontColor uniform. | |
static PropertyType< ResourceSharedPtr > | FontMaterialProperty |
Sets the material whose shader is used to render the text in a 3D text node. | |
static PropertyType< string > | TextProperty |
Sets the text content that a text node renders. | |
static PropertyType< TextFormat::TextHorizontalAlignment > | TextHorizontalAlignmentProperty |
Sets the horizontal alignment of the text in a text node. | |
static PropertyType< TextFormat::TextVerticalAlignment > | TextVerticalAlignmentProperty |
Sets the vertical alignment of the text in a text node. | |
static PropertyType< Vector2 > | HorizontalPaddingProperty |
Sets the padding spaces between the content and the left and right boundaries of a text node. | |
static PropertyType< Vector2 > | VerticalPaddingProperty |
Sets the padding spaces between the content and the top and bottom boundaries of a text node. | |
static PropertyType< string > | OverflowProperty |
Sets the characters that represent the truncated text when the text string to be rendered is too long to fit in a text node. | |
static PropertyType< TextFormat::Truncation > | TruncationProperty |
Sets how to truncate the text when the text string to be rendered is too long to fit in a node. | |
static PropertyType< TextFormat::TruncationDirection > | TruncationDirectionProperty |
Sets which part of the text to truncate when the text string to be rendered is too long to fit in a node. | |
static PropertyType< bool > | RemoveSideBearingsProperty |
Sets the position of the leftmost characters of left-aligned text and rightmost characters of right-aligned text exactly within the boundary of the text node. | |
static PropertyType< bool > | HorizontalFitProperty |
Allows a Text Block to scale glyphs horizontally when the text string is too long to fit in that Text Block. | |
static PropertyType< Vector2 > | HorizontalFitScaleLimitsProperty |
Sets the scale range that the HorizontalFitProperty can use when it scales the text horizontally. | |
TextConceptImpl provides the common base implementation for text rendering nodes.
It encapsulates TextFormat, which is responsible for text layouting and rendering.
TextConceptImpl derives from TextConcept, which defines the data and property types used by the implementation. Do not use these classes directly. Instead use:
To implement your own text rendering node:
Implement the void notifyPostPrepareTextFormat(bool)
method.
Kanzi calls this method after the underlying TextFormat updates the layout of the text. The only boolean parameter of this function indicates whether the text was relayouted.
To update the text layout, call prepareTextFormat().
Kanzi updates the underlying TextFormat with the parameters that you pass to the function and the parameters taken from FontStyleConceptImpl.
|
virtualdefault |
Destructor.
|
explicitprotecteddefault |
Constructor.
|
static |
ColorRGBA kanzi::TextConceptImpl< TDerivedClass >::getFontColor | ( | ) | const |
Gets the value of the FontColorProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setFontColor | ( | ColorRGBA | value | ) |
Sets the value of the FontColorProperty.
value | The ColorRGBA color value of the font material with fragment shader that uses the FontColor uniform. |
MaterialSharedPtr kanzi::TextConceptImpl< TDerivedClass >::getFontMaterial | ( | ) | const |
Gets the value of the FontMaterialProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setFontMaterial | ( | MaterialSharedPtr | value | ) |
Sets the value of the FontMaterialProperty.
value | The font material. |
Vector2 kanzi::TextConceptImpl< TDerivedClass >::getHorizontalPadding | ( | ) | const |
Gets the value of HorizontalPaddingProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setHorizontalPadding | ( | Vector2 | value | ) |
Sets the value of HorizontalPaddingProperty.
value | The space on the left and the right sides of the content. |
string kanzi::TextConceptImpl< TDerivedClass >::getText | ( | ) | const |
Gets the value of TextProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setText | ( | string | value | ) |
Sets the value of TextProperty.
TextFormat::TextHorizontalAlignment kanzi::TextConceptImpl< TDerivedClass >::getTextHorizontalAlignment | ( | ) | const |
Gets the value of the TextHorizontalAlignmentProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setTextHorizontalAlignment | ( | TextFormat::TextHorizontalAlignment | value | ) |
Sets the value of the TextHorizontalAlignmentProperty.
value | One of the TextFormat::TextHorizontalAlignment enumerator values. |
TextFormat::TextVerticalAlignment kanzi::TextConceptImpl< TDerivedClass >::getTextVerticalAlignment | ( | ) | const |
Gets the value of the TextVerticalAlignmentProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setTextVerticalAlignment | ( | TextFormat::TextVerticalAlignment | value | ) |
Sets the value of the TextVerticalAlignmentProperty.
value | One of the TextFormat::TextVerticalAlignment enumerator values. |
Vector2 kanzi::TextConceptImpl< TDerivedClass >::getVerticalPadding | ( | ) | const |
Gets the value of VerticalPaddingProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setVerticalPadding | ( | Vector2 | value | ) |
Sets the value of VerticalPaddingProperty.
value | The space on the top and the bottom of the content. |
string kanzi::TextConceptImpl< TDerivedClass >::getOverflow | ( | ) | const |
Gets the value of the OverflowProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setOverflow | ( | string_view | value | ) |
Sets the value of the OverflowProperty.
value | The characters that represent the truncated text when the text string is too long to fit in the node. |
bool kanzi::TextConceptImpl< TDerivedClass >::getHorizontalFit | ( | ) | const |
Gets the value of the HorizontalFitProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setHorizontalFit | ( | bool | value | ) |
Sets the value of the HorizontalFitProperty.
value | Whether to enable the horizontal scaling of glyphs when the text string is too long to fit in that Text Block. |
Vector2 kanzi::TextConceptImpl< TDerivedClass >::getHorizontalFitScaleLimits | ( | ) | const |
Gets the value of the HorizontalFitScaleLimitsProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setHorizontalFitScaleLimits | ( | Vector2 | value | ) |
Sets the value of the HorizontalFitScaleLimitsProperty.
value | When the HorizontalFitProperty is enabled, sets the minimum and maximum scale for glyphs when the width of text in a Text Block does not match the Layout Width property of that Text Block. For example:
|
bool kanzi::TextConceptImpl< TDerivedClass >::getRemoveSideBearings | ( | ) | const |
Gets the value of the RemoveSideBearingsProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setRemoveSideBearings | ( | bool | value | ) |
Sets the value of the RemoveSideBearingsProperty.
value | The value that determines if the position of the leftmost characters of left-aligned text and rightmost characters of right-aligned text are to be exactly within the boundary of the text node or not. |
void kanzi::TextConceptImpl< TDerivedClass >::setTruncationDirection | ( | TextFormat::TruncationDirection | value | ) |
Sets the value of the TruncationDirectionProperty.
value | The truncation direction for the text that does not fit in the node. |
TextFormat::TruncationDirection kanzi::TextConceptImpl< TDerivedClass >::getTruncationDirection | ( | ) | const |
Gets the value of the TruncationDirectionProperty.
void kanzi::TextConceptImpl< TDerivedClass >::setTruncation | ( | TextFormat::Truncation | value | ) |
Sets the value of the TruncationProperty.
value | Truncation policy for the text that does not fit in the node. |
TextFormat::Truncation kanzi::TextConceptImpl< TDerivedClass >::getTruncation | ( | ) | const |
Gets the value of the TruncationProperty.
|
protected |
Updates the parameters and text of the internal text format.
Calls notifyPostPrepareTextFormat() when the text format is created or reused successfully.
parameters | Collection of parameters that are used to configure the text format. |
text | The text that is layouted using the text format. |
|
protected |
The text format for the text that this node displays.