|
OpenEnroth 7c0a0e7
|
#include <GUIFont.h>
Public Member Functions | |
| GUIFont () | |
| ~GUIFont () | |
| void | CreateFontTex () |
| void | ReleaseFontTex () |
| int | GetHeight () const |
| int | AlignText_Center (int width, std::string_view str) |
| int | GetLineWidth (std::string_view str) |
| int | GetTextLenLimitedByWidth (std::string_view str, int maxWidth, int &resultWidth) |
| int | CalcTextHeight (std::string_view str, int width, int x) |
| std::string | GetPageText (std::string_view str, Sizei pageSize, int x, int page) |
| Color | DrawTextLine (std::string_view text, Color startColor, Color defaultColor, Pointi position) |
| void | DrawText (const Recti &rect, Pointi position, Color defaultColor, std::string_view text, int maxY, Color shadowColor) |
| int | DrawTextInRect (const Recti &rect, Pointi position, Color color, std::string_view text, int rect_width, int reverse_text) |
| std::string | WrapText (std::string_view inString, int width, int uX, bool return_on_carriage=false) |
| void | DrawCreditsEntry (GUIFont *pSecondFont, int uFrameX, int uFrameY, unsigned int w, unsigned int h, Color firstColor, Color secondColor, Color shadowColor, std::string_view pString, GraphicsImage *image) |
| int | GetStringHeightWithSecondFont (GUIFont *secondFont, std::string_view text_str, int width, int x) |
Static Public Member Functions | |
| static std::unique_ptr< GUIFont > | LoadFont (std::string_view pFontFile) |
Private Member Functions | |
| std::string | FitTwoFontStringInWindow (std::string_view inString, GUIFont *pFontSecond, int width, int x) |
| void | DrawTextLineToBuff (Color startColor, Color shadowColor, Color *uX_buff_pos, std::string_view text, int line_width) |
Private Attributes | |
| LodFont | _font |
| GraphicsImage * | _mainTexture = nullptr |
| GraphicsImage * | _shadowTexture = nullptr |
Some notes on markup characters supported by GUIFont functions.
\n is a regular line feed.\tXXX, where XXX is decimal offset in pixels. Moves the caret to a position offset by XXX to the right from the start of the line. This is how aligned tables are implemented.\rXXX, where XXX is a decimal offset in pixels. Moves the caret so that the rest of the line is right-justified, with the given offset from the right window border. This is used e.g. in the create party screen.\fXXXXX, where XXXXX is a decimal color code for 16-bit color to use for the text that follows.
|
default |
| GUIFont::~GUIFont | ( | ) |
| int GUIFont::AlignText_Center | ( | int | width, |
| std::string_view | str | ||
| ) |
| width | Width of the rect to position the text in. |
| str | Text to position. |
DrawTextLine to make the text aligned, or 0 if the text overflows. | int GUIFont::CalcTextHeight | ( | std::string_view | str, |
| int | width, | ||
| int | x | ||
| ) |
| str | Text to check. |
| width | Width of the window that the text should fit into. |
| x | Where does the text start relative to the window's left border? |
| void GUIFont::CreateFontTex | ( | ) |
| void GUIFont::DrawCreditsEntry | ( | GUIFont * | pSecondFont, |
| int | uFrameX, | ||
| int | uFrameY, | ||
| unsigned int | w, | ||
| unsigned int | h, | ||
| Color | firstColor, | ||
| Color | secondColor, | ||
| Color | shadowColor, | ||
| std::string_view | pString, | ||
| GraphicsImage * | image | ||
| ) |
| void GUIFont::DrawText | ( | const Recti & | rect, |
| Pointi | position, | ||
| Color | defaultColor, | ||
| std::string_view | text, | ||
| int | maxY, | ||
| Color | shadowColor | ||
| ) |
| int GUIFont::DrawTextInRect | ( | const Recti & | rect, |
| Pointi | position, | ||
| Color | color, | ||
| std::string_view | text, | ||
| int | rect_width, | ||
| int | reverse_text | ||
| ) |
| Color GUIFont::DrawTextLine | ( | std::string_view | text, |
| Color | startColor, | ||
| Color | defaultColor, | ||
| Pointi | position | ||
| ) |
Draws a single line of text. If provided text has more than a single line, only the 1st line is drawn.
| text | Input line of text. |
| startColor | Color that the text should be started to be drawn with - this allows feeding in the color returned from the previous call to maintain correct color when the text is split into multiple lines. |
| defaultColor | The color that the text should return to on hitting a default color tag. |
| position | Position to draw the text line at. |
|
private |
|
private |
| int GUIFont::GetHeight | ( | ) | const |
| int GUIFont::GetLineWidth | ( | std::string_view | str | ) |
| str | Text to check. |
str, in pixels. Note that \t counts as a line break as it essentially starts a new table column. | std::string GUIFont::GetPageText | ( | std::string_view | str, |
| Sizei | pageSize, | ||
| int | x, | ||
| int | page | ||
| ) |
| str | Multipage text to page-wrap. |
| pageSize | Size of a single page, in pixels. |
| x | Where does the text start relative to the page's left border? |
| page | Page number to get the text for, starts at 0. |
page. Note that this function doesn't cut the text's tail. | int GUIFont::GetStringHeightWithSecondFont | ( | GUIFont * | secondFont, |
| std::string_view | text_str, | ||
| int | width, | ||
| int | x | ||
| ) |
| int GUIFont::GetTextLenLimitedByWidth | ( | std::string_view | str, |
| int | maxWidth, | ||
| int & | resultWidth | ||
| ) |
| str | Text to check. Should be a single line without tabs or right-justify. |
| maxWidth | Width of the window that the text should fit into. |
| resultWidth | Width of the substring (in pixels) that fits into maxWidth. |
|
static |
| void GUIFont::ReleaseFontTex | ( | ) |
| std::string GUIFont::WrapText | ( | std::string_view | inString, |
| int | width, | ||
| int | uX, | ||
| bool | return_on_carriage = false |
||
| ) |
|
private |
|
private |
|
private |