public |
Inheritance Graph
graph BT
TextRenderer
click TextRenderer "classRendering_1_1TextRenderer"
Description
Text rendering using bitmap fonts.
Display text by using a bitmap that contains pre-rendered glyphs.
Author: Benjamin Eikel
Date: 2013-07-10
Public Functions
TextRenderer(const Util::Bitmap & glyphBitmap, const Util::FontInfo & fontInfo) | |
~TextRenderer() Free resources. |
|
TextRenderer(const TextRenderer & other) Default copy constructor. |
|
TextRenderer( TextRenderer && other) Default move constructor. |
|
void | draw( RenderingContext & context, const std::u32string & text, const Geometry::Vec2i & textPosition, const Util::Color4f & textColor) const |
Geometry::Rect_i | getTextSize(const std::u32string & text) const |
int | getHeightOfX() const |
int | getWidthOfM() const |
Documentation
function
Rendering::TextRenderer::TextRenderer
public |
TextRenderer( | const Util::Bitmap & | glyphBitmap, |
const Util::FontInfo & | fontInfo | |
) |
Create a text renderer using a glyph bitmap with the associated glyph mapping.
Parameters
- glyphBitmap
- Bitmap containing pre-rendered glyphs
- fontInfo
- Information about font metrics and mapping from characters to information about the glyphs
See also: Util::BitmapFont
Defined in Rendering/TextRenderer.h:54
function
Rendering::TextRenderer::~TextRenderer
public |
~TextRenderer( | ) |
Free resources.
Defined in Rendering/TextRenderer.h:58
function
Rendering::TextRenderer::TextRenderer
public |
TextRenderer( | const TextRenderer & | other ) |
Default copy constructor.
Defined in Rendering/TextRenderer.h:61
function
Rendering::TextRenderer::TextRenderer
public |
TextRenderer( | TextRenderer && | other ) |
Default move constructor.
Defined in Rendering/TextRenderer.h:64
function
Rendering::TextRenderer::draw
public | const |
void draw( | RenderingContext & | context, |
const std::u32string & | text, | |
const Geometry::Vec2i & | textPosition, | |
const Util::Color4f & | textColor | |
) const |
Draw the given text to the screen.
Parameters
- context
- Rendering context that is used for drawing
- text
- String that is to be drawn
- textPosition
- Screen position in pixels where to place the text. The position specifies the top left corner of the rendered text.
- textColor
- Color that is used to draw the text
Note: the 2D-rendering mode must be enabled (
See also: Draw::enable2DMode(…) )
Defined in Rendering/TextRenderer.h:77
function
Rendering::TextRenderer::getTextSize
public | const |
Geometry::Rect_i getTextSize( | const std::u32string & | text ) const |
Calculate the size that would be needed by the text when it was drawn.
Returns
Rectangle of the text on the screen in pixels
Defined in Rendering/TextRenderer.h:88
function
Rendering::TextRenderer::getHeightOfX
public | const |
int getHeightOfX( | ) const |
Return the height of the lower-case character ‘x’.
Note: This is similar to the unit ex in LaTeX.
Returns
Height of ‘x’ in pixels, or zero if ‘x’ is not in the glyph map
Defined in Rendering/TextRenderer.h:97
function
Rendering::TextRenderer::getWidthOfM
public | const |
int getWidthOfM( | ) const |
Return the width of the upper-case character ‘M’.
Note: This is similar to the unit em in LaTeX.
Returns
Width of ‘M’ in pixels, or zero if ‘M’ is not in the glyph map
Defined in Rendering/TextRenderer.h:106