You.i Engine
CYITextLayout Class Referenceabstract

Detailed Description

Base class for abstracting the layout for text.

Concrete classes implement specific layout engines.

#include <graphics/YiTextLayout.h>

Public Member Functions

 CYITextLayout ()
 
virtual ~CYITextLayout ()
 
virtual bool LayoutText (const YI_TEXT_RENDER_INFO &TextRenderInfo, const CYITextRenderer *pTextRenderer)=0
 
virtual uint32_t GetLineCount () const =0
 
virtual const CYITextLayoutLine * GetTextLine (uint32_t nIndex) const =0
 
virtual YI_TEXT_DIRECTION 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 int32_t GetIndexOfPosition (float fX, float fY, float fHorizontalPixelRatio, float fVerticalPixelRatio) const =0
 
virtual YI_FLOAT_RECT GetRectForTextRange (int32_t nStartIndex, int32_t nEndIndex, float fHorizontalPixelRatio, float fVerticalPixelRatio) const =0
 

Constructor & Destructor Documentation

CYITextLayout::CYITextLayout ( )
inline
virtual CYITextLayout::~CYITextLayout ( )
inlinevirtual

Member Function Documentation

virtual void CYITextLayout::Clear ( )
pure virtual

Method to clear all of the stored layout information.

virtual int32_t CYITextLayout::GetAscent ( ) const
pure virtual

Returns the maximum ascent value for all the fonts in the text.

virtual int32_t CYITextLayout::GetDescent ( ) const
pure virtual

Returns the maximum descent value for all the fonts in the text.

virtual float CYITextLayout::GetFirstBaselineVerticalOffset ( ) const
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)

virtual float CYITextLayout::GetGlyphBoxVerticalOffset ( ) const
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.

virtual int32_t CYITextLayout::GetIndexOfPosition ( float  fX,
float  fY,
float  fHorizontalPixelRatio,
float  fVerticalPixelRatio 
) const
pure virtual

Returns the index in the text closest to the specified local coordinate position, relative to the top left corner of the node containing the text. The horizontal and vertical pixel ratios can be obtained from the camera and are based on the scaling type used to load the After Effects composition. Currently this is only supported for single line text but the y position and vertical pixel ratios are added for future multiline support.

virtual int32_t CYITextLayout::GetLeading ( ) const
pure virtual

Returns the maximum leading value for all the fonts in the text.

virtual uint32_t CYITextLayout::GetLineCount ( ) const
pure virtual

Returns the number of lines the text was split up into when the LayoutText() method was called.

virtual YI_FLOAT_RECT CYITextLayout::GetRectForTextRange ( int32_t  nStartIndex,
int32_t  nEndIndex,
float  fHorizontalPixelRatio,
float  fVerticalPixelRatio 
) const
pure virtual

Get the rect for the cached layout of text that has been rendered. If no text has been rendered, by calling RenderText previously, or invalid index values are passed then the rect will be set to 0 for all values.

virtual YI_TEXT_DIRECTION CYITextLayout::GetTextDirection ( ) const
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.

virtual const CYITextLayoutLine* CYITextLayout::GetTextLine ( uint32_t  nIndex) const
pure virtual

Returns a specific line of text specified by the nIndex parameter.

virtual bool CYITextLayout::IsComplex ( ) const
pure virtual

Returns true if the text contains characters in any script which require complex processing to be rendered correctly.

virtual bool CYITextLayout::LayoutText ( const YI_TEXT_RENDER_INFO TextRenderInfo,
const CYITextRenderer *  pTextRenderer 
)
pure virtual

Layout the specified text in the sText parameter using the font specified in the nFontID parameter. The layout breaks the text into multiple lines depending on the width specified in the nWidth 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.


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