Base class for abstracting the layout for text.
Concrete classes implement specific layout engines.
#include <graphics/YiTextLayout.h>
Public Types | |
enum | TextDirection { TextDirection::LeftToRight = 0, TextDirection::RightToLeft = 1, TextDirection::Mixed = 2, TextDirection::Undefined = 3 } |
Enumeration for direction types used in text layout. More... | |
Public Member Functions | |
CYITextLayout () | |
virtual | ~CYITextLayout () |
virtual bool | LayoutText (const CYITextEngine::RenderInfo &TextRenderInfo, const CYITextRenderer *pTextRenderer)=0 |
virtual size_t | GetLineCount () const =0 |
virtual const CYITextLayoutLine * | GetTextLine (size_t index) const =0 |
virtual CYITextLayout::TextDirection | GetTextDirection () const =0 |
virtual bool | IsComplex () const =0 |
virtual int32_t | GetAscent () const =0 |
virtual int32_t | GetDescent () const =0 |
virtual int32_t | GetLeading () const =0 |
virtual float | GetGlyphBoxVerticalOffset () const =0 |
virtual float | GetFirstBaselineVerticalOffset () const =0 |
virtual void | Clear ()=0 |
virtual CYITextEngine::PositionInString | GetIndexOfPosition (float x, float y, float horizontalPixelRatio, float verticalPixelRatio) const =0 |
virtual CYITextEngine::PositionInString | GetOffsetPosition (CYITextEngine::PositionInString initialPosition, int8_t offset) const =0 |
virtual YI_FLOAT_RECT | GetRectForTextRange (size_t startIndex, size_t endIndex, float horizontalPixelRatio, float verticalPixelRatio) const =0 |
virtual float | GetAdjustedFontSizeScale () const =0 |
virtual bool | IsCharacterRightToLeft (size_t characterIndex) const =0 |
virtual TextDirection | GetCharacterTextDirection (size_t characterIndex) const =0 |
virtual TextDirection | GetBaseTextDirection () const =0 |
virtual bool | HasEllipsis () const |
|
strong |
|
inline |
|
inlinevirtual |
|
pure virtual |
Method to clear all of the stored layout information.
|
pure virtual |
Returns the ratio of the font size after adjusting to fit to the text node, to the original font size. Returns 1 if the font size did not get scaled.
|
pure virtual |
Returns the maximum ascent value for all the fonts in the text.
|
pure virtual |
Returns the base text direction of the text being laid out.
|
pure virtual |
Returns the text direction of the character at index characterIndex. Returns TextDirection::Undefined if characterIndex is greater-than or equal to the number of characters.
|
pure virtual |
Returns the maximum descent value for all the fonts in the text.
|
pure virtual |
Returns the offset applied to all glyphs so that the top of the first line aligns to the top of the text rect. Subtract this value from all glyph positions in order to get the baseline of the first line aligned to the top of the text rect (e.g. to get the 'point text' behaviour)
|
pure virtual |
Returns the vertical offset needed to get a glyph box that is vertically 'centered' on the text. The centering here isn't actual centering, but takes the ascender of the first line and the descender of the last line into account.
|
pure virtual |
Returns the index of the space between two characters in the text closest to the specified local coordinate position, relative to the top left corner of the node containing the text. The return value is an instance of CYITextEngine::PositionInString, which contains information about the logical position in the string, and where it should be visually represented.
|
pure virtual |
Returns the maximum leading value for all the fonts in the text.
|
pure virtual |
Returns the number of lines the text was split up into when the LayoutText() method was called.
|
pure virtual |
Given a position within a string initialPosition, which describes the logical position between characters and where it's represented visually, this function returns the position visually offset from that position by a number of characters described by offset. The return value is an instance of CYITextEngine::PositionInString, which contains information about the logical position in the string, and where it should be visually represented.
|
pure virtual |
Get the rect surrounding characters from startIndex to endIndex for the cached layout of text that has been rendered.
|
pure virtual |
Returns the directions of the text: left to right, right to left, mixed, or undefined if no text has been laid out yet or the text contains not LTR or RTL characters.
|
pure virtual |
Returns a specific line of text specified by the index parameter.
|
inlinevirtual |
|
pure virtual |
Returns true if the chracter at index characterIndex is in a right-to-left run of characters. Returns false otherwise or if characterIndex is greater than or equal to the number of characters.
|
pure virtual |
Returns true if the text contains characters in any script which require complex processing to be rendered correctly.
|
pure virtual |
Layout the specified text in the text parameter using the font specified in the fontID parameter. The layout breaks the text into multiple lines depending on the width specified in the width parameter. The lines can be accessed by calling the method GetTextLine(). The pTextRenderer is a pointer to a text renderer so that the layout can get at font information required to perform the layout. true is returned if the layout was successful.