![]() |
Gorgon Game Engine
|
This class allows printing text on the screen. More...
Public Member Functions | |
virtual | ~TextRenderer () |
virtual float | GetBaseLine () const =0 |
Get the distance of baseline from the top of the text. More... | |
virtual int | GetCharacterIndex (const std::string &text, Geometry::Point location) const =0 |
Returns the character index of glyph immediately after the given location. This function is Unicode aware. More... | |
virtual int | GetCharacterIndex (const std::string &text, int w, Geometry::Point location, bool wrap=true) const =0 |
Returns the character index of glyph immediately after the given location. This function is Unicode aware. More... | |
virtual int | GetEMSize () const =0 |
Returns the size of the EM dash. More... | |
virtual const GlyphRenderer & | GetGlyphRenderer () const =0 |
Returns the glyphrenderer that is used by this text renderer. More... | |
virtual int | GetHeight () const =0 |
Get the distance of baseline from the top of the text. More... | |
virtual Geometry::Rectangle | GetPosition (const std::string &text, int index) const =0 |
Returns the position of the glyph at the character index. More... | |
virtual Geometry::Rectangle | GetPosition (const std::string &text, int w, int index, bool wrap=true) const =0 |
Returns the position of the glyph at the character index. More... | |
virtual Geometry::Size | GetSize (const std::string &text) const =0 |
Returns the size of the given text. More... | |
virtual Geometry::Size | GetSize (const std::string &text, int width) const =0 |
Returns the size of the given text. More... | |
virtual bool | IsReady () const =0 |
Whether the render can render text. More... | |
void | Print (TextureTarget &target, const std::string &text) |
void | Print (TextureTarget &target, const std::string &text, Geometry::Point location) const |
void | Print (TextureTarget &target, const std::string &text, Geometry::Point location, int w) const |
void | Print (TextureTarget &target, const std::string &text, Geometry::Point location, int w, TextAlignment align_override) const |
void | Print (TextureTarget &target, const std::string &text, Geometry::Pointf location) const |
Prints the given text to the target. More... | |
void | Print (TextureTarget &target, const std::string &text, int x, int y) const |
void | Print (TextureTarget &target, const std::string &text, int x, int y, int w) const |
void | Print (TextureTarget &target, const std::string &text, int x, int y, int w, TextAlignment align_override) const |
void | PrintNoWrap (TextureTarget &target, const std::string &text, Geometry::Point location, int w) const |
void | PrintNoWrap (TextureTarget &target, const std::string &text, Geometry::Point location, int w, TextAlignment align_override) const |
void | PrintNoWrap (TextureTarget &target, const std::string &text, int x, int y, int w) const |
void | PrintNoWrap (TextureTarget &target, const std::string &text, int x, int y, int w, TextAlignment align_override) const |
Protected Member Functions | |
virtual void | print (TextureTarget &target, const std::string &text, Geometry::Point location) const =0 |
virtual void | print (TextureTarget &target, const std::string &text, Geometry::Rectangle location) const =0 |
virtual void | print (TextureTarget &target, const std::string &text, Geometry::Rectangle location, TextAlignment align_override) const =0 |
Should print the given text to the specified location and color. More... | |
virtual void | printnowrap (TextureTarget &target, const std::string &text, Geometry::Rectangle location) const =0 |
Should print the given text to the specified location and color. More... | |
virtual void | printnowrap (TextureTarget &target, const std::string &text, Geometry::Rectangle location, TextAlignment align_override) const =0 |
Should print the given text to the specified location and color. More... | |
This class allows printing text on the screen.
All fonts should support basic left aligned print, aligned rectangular area printing. Additionally, all fonts should support basic info functions. TextRenderers must be accept utf-8. internal::decode function should be preferred to decode utf-8, among regular utf-8 decoding, this function will map \r
to
.
|
virtual |
|
pure virtual |
Get the distance of baseline from the top of the text.
Implemented in FreeType, StyledRenderer, BasicFont, and BitmapFont.
|
pure virtual |
Returns the character index of glyph immediately after the given location. This function is Unicode aware.
Implemented in StyledRenderer, and BasicFont.
|
pure virtual |
Returns the character index of glyph immediately after the given location. This function is Unicode aware.
Implemented in StyledRenderer, and BasicFont.
|
pure virtual |
Returns the size of the EM dash.
Implemented in FreeType, StyledRenderer, BasicFont, and BitmapFont.
|
pure virtual |
Returns the glyphrenderer that is used by this text renderer.
It might be the text renderer itself. It is only safe to call this function if IsReady function has returned true.
Implemented in StyledRenderer, BasicFont, and BitmapFont.
|
pure virtual |
Get the distance of baseline from the top of the text.
Implemented in FreeType, StyledRenderer, BasicFont, and BitmapFont.
|
pure virtual |
Returns the position of the glyph at the character index.
If the character is not found, this will return std::numeric_limit<int>::min for x and y position. Size could be 0 if it cannot be determined.
Implemented in StyledRenderer, and BasicFont.
|
pure virtual |
Returns the position of the glyph at the character index.
If the character is not found, this will return std::numeric_limit<int>::min for x and y position. Size could be 0 if it cannot be determined.
Implemented in StyledRenderer, and BasicFont.
|
pure virtual |
Returns the size of the given text.
Implemented in StyledRenderer, and BasicFont.
|
pure virtual |
Returns the size of the given text.
Implemented in StyledRenderer, and BasicFont.
|
pure virtual |
Whether the render can render text.
Implemented in FreeType, StyledRenderer, and BasicFont.
void Print | ( | TextureTarget & | target, |
const std::string & | text | ||
) |
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location | ||
) | const |
|
protectedpure virtual |
Implemented in StyledRenderer, and BasicFont.
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location, | ||
int | w | ||
) | const |
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location, | ||
int | w, | ||
TextAlignment | align_override | ||
) | const |
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Pointf | location | ||
) | const |
Prints the given text to the target.
y coordinate is the top if the text. However, depending on the font, this value might exclude uppercase accents.
|
protectedpure virtual |
Implemented in StyledRenderer, and BasicFont.
|
protectedpure virtual |
Should print the given text to the specified location and color.
Width should be used to align the text. Unless width is 0, text should be wrapped. Even if width is 0, the alignment should be respected. For instance if width is 0 and align is right, text should end at the given location. Height of the rectangle can be left 0, thus unless explicitly requested, it should be ignored.
Implemented in StyledRenderer, and BasicFont.
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y | ||
) | const |
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y, | ||
int | w | ||
) | const |
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y, | ||
int | w, | ||
TextAlignment | align_override | ||
) | const |
void PrintNoWrap | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location, | ||
int | w | ||
) | const |
References TextRenderer::printnowrap().
void PrintNoWrap | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location, | ||
int | w, | ||
TextAlignment | align_override | ||
) | const |
References TextRenderer::printnowrap().
|
protectedpure virtual |
Should print the given text to the specified location and color.
Width should be used to align the text. Automatic wrapping should not be used.
Implemented in StyledRenderer, and BasicFont.
|
protectedpure virtual |
Should print the given text to the specified location and color.
Width should be used to align the text. Automatic wrapping should not be used.
Implemented in StyledRenderer, and BasicFont.
void PrintNoWrap | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y, | ||
int | w | ||
) | const |
References TextRenderer::printnowrap().
void PrintNoWrap | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y, | ||
int | w, | ||
TextAlignment | align_override | ||
) | const |
References TextRenderer::printnowrap().