You.i Engine
YiTextLayout.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_TEXT_LAYOUT_H_
3 #define _YI_TEXT_LAYOUT_H_
4 
5 #include "framework/YiPredef.h"
7 
8 class CYITextLayoutLine;
9 class CYITextRenderer;
10 class CYIString;
11 
23 {
24 public:
28  enum class TextDirection
29  {
30  LeftToRight = 0, /*< Text flows from left to right */
31  RightToLeft = 1, /*< Text flows from rigth to left */
32  Mixed = 2, /*< Text contains both left to right and right to left flowing text */
33  Undefined = 3 /*< Text has not been specified or contains no left to right or right to left characters */
34  };
35 
37 
38  virtual ~CYITextLayout(){};
39 
46  virtual bool LayoutText(const CYITextEngine::RenderInfo &TextRenderInfo, const CYITextRenderer *pTextRenderer) = 0;
47 
51  virtual size_t GetLineCount() const = 0;
52 
56  virtual const CYITextLayoutLine *GetTextLine(size_t index) const = 0;
57 
63 
67  virtual bool IsComplex() const = 0;
68 
72  virtual int32_t GetAscent() const = 0;
73 
77  virtual int32_t GetDescent() const = 0;
78 
82  virtual int32_t GetLeading() const = 0;
83 
87  virtual float GetGlyphBoxVerticalOffset() const = 0;
88 
92  virtual float GetFirstBaselineVerticalOffset() const = 0;
93 
97  virtual void Clear() = 0;
98 
108  virtual CYITextEngine::PositionInString GetIndexOfPosition(float x, float y, float horizontalPixelRatio, float verticalPixelRatio) const = 0;
109 
118  virtual CYITextEngine::PositionInString GetOffsetPosition(CYITextEngine::PositionInString initialPosition, int8_t offset) const = 0;
119 
127  virtual YI_FLOAT_RECT GetRectForTextRange(size_t startIndex, size_t endIndex, float horizontalPixelRatio, float verticalPixelRatio) const = 0;
128 
132  virtual float GetAdjustedFontSizeScale() const = 0;
133 
137  virtual bool IsCharacterRightToLeft(size_t characterIndex) const = 0;
138 
142  virtual TextDirection GetCharacterTextDirection(size_t characterIndex) const = 0;
143 
147  virtual TextDirection GetBaseTextDirection() const = 0;
148 
149  virtual bool HasEllipsis() const { return false; };
150 };
151 
154 #endif // _YI_TEXT_LAYOUT_H_
Struct used to pass information when rendering text.
Definition: YiTextEngine.h:210
virtual size_t GetLineCount() const =0
virtual TextDirection GetBaseTextDirection() const =0
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:32
virtual float GetFirstBaselineVerticalOffset() const =0
virtual int32_t GetLeading() const =0
virtual ~CYITextLayout()
Definition: YiTextLayout.h:38
virtual bool IsCharacterRightToLeft(size_t characterIndex) const =0
TextDirection
Enumeration for direction types used in text layout.
Definition: YiTextLayout.h:28
virtual void Clear()=0
CYITextLayout()
Definition: YiTextLayout.h:36
virtual TextDirection GetCharacterTextDirection(size_t characterIndex) const =0
virtual int32_t GetDescent() const =0
Definition: YiRectangle.h:61
Base class for abstracting the layout for text.
Definition: YiTextLayout.h:22
virtual float GetGlyphBoxVerticalOffset() const =0
virtual const CYITextLayoutLine * GetTextLine(size_t index) const =0
virtual int32_t GetAscent() const =0
virtual bool IsComplex() const =0
virtual CYITextEngine::PositionInString GetOffsetPosition(CYITextEngine::PositionInString initialPosition, int8_t offset) const =0
Definition: YiTextEngine.h:117
virtual CYITextEngine::PositionInString GetIndexOfPosition(float x, float y, float horizontalPixelRatio, float verticalPixelRatio) const =0
virtual bool HasEllipsis() const
Definition: YiTextLayout.h:149
virtual YI_FLOAT_RECT GetRectForTextRange(size_t startIndex, size_t endIndex, float horizontalPixelRatio, float verticalPixelRatio) const =0
virtual CYITextLayout::TextDirection GetTextDirection() const =0
virtual float GetAdjustedFontSizeScale() const =0
virtual bool LayoutText(const CYITextEngine::RenderInfo &TextRenderInfo, const CYITextRenderer *pTextRenderer)=0