![]() |
Gorgon Game Engine
|
This is the basic font, performing the minimal amount of operations necessary to render text on the screen. More...
Public Member Functions | |
BasicFont (const GlyphRenderer &renderer, RGBAf color=1.f, TextAlignment defaultalign=TextAlignment::Left) | |
virtual float | GetBaseLine () const override |
Get the distance of baseline from the top of the text. More... | |
virtual int | GetCharacterIndex (const std::string &text, Geometry::Point location) const override |
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 override |
Returns the character index of glyph immediately after the given location. This function is Unicode aware. More... | |
RGBAf | GetColor () const |
Returns the current text color. More... | |
TextAlignment | GetDefaultAlignment () const |
Returns the current default alignment. More... | |
virtual int | GetEMSize () const override |
Returns the size of the EM dash. More... | |
virtual const GlyphRenderer & | GetGlyphRenderer () const override |
Returns the glyphrenderer that is used by this text renderer. More... | |
virtual int | GetHeight () const override |
Get the distance of baseline from the top of the text. More... | |
virtual Geometry::Rectangle | GetPosition (const std::string &text, int index) const override |
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 override |
Returns the position of the glyph at the character index. More... | |
virtual Geometry::Size | GetSize (const std::string &text) const override |
Returns the size of the given text. More... | |
virtual Geometry::Size | GetSize (const std::string &text, int width) const override |
Returns the size of the given text. More... | |
virtual bool | IsReady () const override |
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, RGBAf color) 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::Point location, int w, TextAlignment align_override, RGBAf color) const |
void | Print (TextureTarget &target, const std::string &text, Geometry::Point location, RGBAf color) 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, RGBAf color) const |
void | Print (TextureTarget &target, const std::string &text, int x, int y, int w, TextAlignment align_override) const |
void | Print (TextureTarget &target, const std::string &text, int x, int y, int w, TextAlignment align_override, RGBAf color) const |
void | Print (TextureTarget &target, const std::string &text, int x, int y, RGBAf color) const |
void | Print (TextureTarget &target, const std::string &text, RGBAf color) const |
void | PrintNoWrap (TextureTarget &target, const std::string &text, Geometry::Point location, int w, RGBAf color) const |
void | PrintNoWrap (TextureTarget &target, const std::string &text, Geometry::Point location, int w, TextAlignment align_override, RGBAf color) const |
void | PrintNoWrap (TextureTarget &target, const std::string &text, int x, int y, int w, RGBAf color) const |
void | PrintNoWrap (TextureTarget &target, const std::string &text, int x, int y, int w, TextAlignment align_override, RGBAf color) const |
void | SetColor (RGBAf value) |
Changes the the color of the text. Color can only be overridden through BasicFont interface. More... | |
void | SetDefaultAlignment (TextAlignment value) |
Changes the default alignment. It is possible to override default alignment through TextRenderer interface. More... | |
![]() | |
virtual | ~TextRenderer () |
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 override |
virtual void | print (TextureTarget &target, const std::string &text, Geometry::Point location, RGBAf color) const |
virtual void | print (TextureTarget &target, const std::string &text, Geometry::Rectangle location) const override |
virtual void | print (TextureTarget &target, const std::string &text, Geometry::Rectangle location, RGBAf color) const |
virtual void | print (TextureTarget &target, const std::string &text, Geometry::Rectangle location, TextAlignment align) const override |
Should print the given text to the specified location and color. More... | |
virtual void | print (TextureTarget &target, const std::string &text, Geometry::Rectangle location, TextAlignment align, RGBAf color) const |
virtual void | printnowrap (TextureTarget &target, const std::string &text, Geometry::Rectangle location) const override |
Should print the given text to the specified location and color. More... | |
virtual void | printnowrap (TextureTarget &target, const std::string &text, Geometry::Rectangle location, RGBAf color) const |
virtual void | printnowrap (TextureTarget &target, const std::string &text, Geometry::Rectangle location, TextAlignment align) const override |
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, RGBAf color) const |
Protected Attributes | |
RGBAf | color |
Color of this renderer, can be overridden. More... | |
TextAlignment | defaultalign |
Default alignment if none is specified. More... | |
This is the basic font, performing the minimal amount of operations necessary to render text on the screen.
It requires a single GlyphRenderer to work.
BasicFont | ( | const GlyphRenderer & | renderer, |
RGBAf | color = 1.f , |
||
TextAlignment | defaultalign = TextAlignment::Left |
||
) |
|
overridevirtual |
Get the distance of baseline from the top of the text.
Implements TextRenderer.
Reimplemented in FreeType, and BitmapFont.
References GlyphRenderer::GetBaseLine().
|
overridevirtual |
Returns the character index of glyph immediately after the given location. This function is Unicode aware.
Implements TextRenderer.
References GlyphRenderer::GetMaxWidth(), GlyphRenderer::NeedsPrepare(), GlyphRenderer::Prepare(), and Gorgon::Graphics::internal::simplelayout().
|
overridevirtual |
Returns the character index of glyph immediately after the given location. This function is Unicode aware.
Implements TextRenderer.
References Gorgon::begin(), Gorgon::Graphics::internal::boundedlayout(), BasicFont::defaultalign, Gorgon::end(), GlyphRenderer::NeedsPrepare(), GlyphRenderer::Prepare(), Gorgon::Graphics::Right, and basic_Point< T_ >::X.
RGBAf GetColor | ( | ) | const |
Returns the current text color.
References BasicFont::color.
TextAlignment GetDefaultAlignment | ( | ) | const |
Returns the current default alignment.
References BasicFont::defaultalign.
|
overridevirtual |
Returns the size of the EM dash.
Implements TextRenderer.
Reimplemented in FreeType, and BitmapFont.
References GlyphRenderer::GetEMSize().
|
overridevirtual |
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.
Implements TextRenderer.
Reimplemented in BitmapFont.
|
overridevirtual |
Get the distance of baseline from the top of the text.
Implements TextRenderer.
Reimplemented in FreeType, and BitmapFont.
References GlyphRenderer::GetHeight().
|
overridevirtual |
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.
Implements TextRenderer.
References GlyphRenderer::NeedsPrepare(), GlyphRenderer::Prepare(), and Gorgon::Graphics::internal::simplelayout().
|
overridevirtual |
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.
Implements TextRenderer.
References Gorgon::begin(), Gorgon::Graphics::internal::boundedlayout(), Gorgon::end(), GlyphRenderer::NeedsPrepare(), GlyphRenderer::Prepare(), and Gorgon::Input::Keyboard::Keycodes::Right.
|
overridevirtual |
Returns the size of the given text.
Implements TextRenderer.
References GlyphRenderer::GetMaxWidth(), GlyphRenderer::NeedsPrepare(), GlyphRenderer::Prepare(), and Gorgon::Graphics::internal::simpleprint().
|
overridevirtual |
Returns the size of the given text.
Implements TextRenderer.
References Gorgon::begin(), Gorgon::Graphics::internal::boundedprint(), Gorgon::end(), GlyphRenderer::GetMaxWidth(), GlyphRenderer::NeedsPrepare(), and GlyphRenderer::Prepare().
|
overridevirtual |
void Print |
References TextureTarget::GetTargetSize(), and TextRenderer::print().
void Print |
References TextRenderer::print().
|
overrideprotectedvirtual |
Implements TextRenderer.
References BasicFont::color.
void Print |
References TextRenderer::print().
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location, | ||
int | w, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::print().
void Print |
References TextRenderer::print().
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location, | ||
int | w, | ||
TextAlignment | align_override, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::print().
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::print().
|
protectedvirtual |
void Print |
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.
References TextRenderer::print().
|
overrideprotectedvirtual |
Implements TextRenderer.
References BasicFont::defaultalign, and BasicFont::print().
|
protectedvirtual |
References BasicFont::color, BasicFont::defaultalign, and BasicFont::print().
|
overrideprotectedvirtual |
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.
Implements TextRenderer.
References BasicFont::color, and BasicFont::print().
|
protectedvirtual |
void Print |
References TextRenderer::print().
void Print |
References TextRenderer::print().
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y, | ||
int | w, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::print().
void Print |
References TextRenderer::print().
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y, | ||
int | w, | ||
TextAlignment | align_override, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::print().
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::print().
void Print | ( | TextureTarget & | target, |
const std::string & | text, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, TextureTarget::GetTargetSize(), and BasicFont::print().
void PrintNoWrap | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location, | ||
int | w, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::printnowrap().
void PrintNoWrap | ( | TextureTarget & | target, |
const std::string & | text, | ||
Geometry::Point | location, | ||
int | w, | ||
TextAlignment | align_override, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::printnowrap().
|
overrideprotectedvirtual |
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.
Implements TextRenderer.
References BasicFont::defaultalign, and BasicFont::printnowrap().
|
protectedvirtual |
References BasicFont::color, BasicFont::defaultalign, and BasicFont::printnowrap().
|
overrideprotectedvirtual |
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.
Implements TextRenderer.
References BasicFont::color, and BasicFont::printnowrap().
|
protectedvirtual |
void PrintNoWrap | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y, | ||
int | w, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::printnowrap().
void PrintNoWrap | ( | TextureTarget & | target, |
const std::string & | text, | ||
int | x, | ||
int | y, | ||
int | w, | ||
TextAlignment | align_override, | ||
RGBAf | color | ||
) | const |
References BasicFont::color, and BasicFont::printnowrap().
void SetColor | ( | RGBAf | value | ) |
Changes the the color of the text. Color can only be overridden through BasicFont interface.
References BasicFont::color.
void SetDefaultAlignment | ( | TextAlignment | value | ) |
Changes the default alignment. It is possible to override default alignment through TextRenderer interface.
References BasicFont::defaultalign.
|
protected |
Default alignment if none is specified.