#include <th_gfx_font.h>
|
| virtual | ~font ()=default |
| |
| virtual text_layout | get_text_dimensions (const char *sMessage, size_t iMessageLength, int iMaxWidth=INT_MAX) const =0 |
| | Get the size of drawn text.
|
| |
| virtual void | draw_text (render_target *pCanvas, const char *sMessage, size_t iMessageLength, int iX, int iY) const =0 |
| | Draw a single line of text.
|
| |
| virtual text_layout | draw_text_wrapped (render_target *pCanvas, const char *sMessage, size_t iMessageLength, int iX, int iY, int iWidth, int iMaxRows=INT_MAX, int iSkipRows=0, text_alignment eAlign=text_alignment::left) const =0 |
| | Draw a single line of text, splitting it at word boundaries.
|
| |
◆ ~font()
◆ draw_text()
Draw a single line of text.
- Parameters
-
| pCanvas | The render target to draw onto. |
| sMessage | A UTF-8 encoded string containing a single line of text to draw. |
| iMessageLength | The length, in bytes (not characters), of the string at sMessage. |
| iX | The X coordinate of the top-left corner of the bounding rectangle for the drawn text. |
| iY | The Y coordinate of the top-left corner of the bounding rectangle for the drawn text. |
Implemented in bitmap_font, and freetype_font.
◆ draw_text_wrapped()
Draw a single line of text, splitting it at word boundaries.
This function still only draws a single line of text (i.e. any line breaks like \r and \n in sMessage are ignored), but inserts line breaks between words so that no single line is wider than iWidth pixels. If iMaxRows is specified it will simply cut after that many rows.
- Parameters
-
| pCanvas | The canvas on which to draw. Can be nullptr, in which case nothing is drawn, but other calculations are still made. |
| sMessage | The line of text to draw, encoded in CP437. |
| iMessageLength | The length (in bytes) of sMessage. |
| iX | The X position to start drawing on the canvas. |
| iY | The Y position to start drawing on the canvas. |
| iWidth | The maximum width of each line of text. |
| iMaxRows | The maximum number of rows to draw. Default is INT_MAX. |
| iSkipRows | Start rendering text after skipping this many rows. |
| eAlign | How to align each line of text if the width of the line of text is smaller than iWidth. |
Implemented in bitmap_font, and freetype_font.
◆ get_text_dimensions()
Get the size of drawn text.
If iMaxWidth is specified the text will wrap, so that the height can span multiple rows. Otherwise gets the size of a single line of text.
- Parameters
-
| sMessage | A UTF-8 encoded string containing a single line of text to measure the width and height of. |
| iMessageLength | The length, in bytes (not characters), of the string at sMessage. |
| iMaxWidth | The maximum length, in pixels, that the text may occupy. Default is INT_MAX. |
Implemented in bitmap_font, and freetype_font.
The documentation for this class was generated from the following file: