OpenEnroth 4aaa0a0
|
#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 | 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 (GUIWindow *window, Pointi position, Color color, std::string_view text, int maxHeight, Color shadowColor) |
int | DrawTextInRect (GUIWindow *window, 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 | GetStringHeight2 (GUIFont *secondFont, std::string_view text_str, GUIWindow *pWindow, int startX, int a6) |
Static Public Member Functions | |
static std::unique_ptr< GUIFont > | LoadFont (std::string_view pFontFile) |
Private Member Functions | |
bool | IsCharValid (unsigned char c) const |
std::string | FitTwoFontStringINWindow (std::string_view inString, GUIFont *pFontSecond, GUIWindow *pWindow, int startPixlOff, bool return_on_carriage=false) |
void | DrawTextLineToBuff (Color color, 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 | ( | GUIWindow * | window, |
Pointi | position, | ||
Color | color, | ||
std::string_view | text, | ||
int | maxHeight, | ||
Color | shadowColor | ||
) |
int GUIFont::DrawTextInRect | ( | GUIWindow * | window, |
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::GetStringHeight2 | ( | GUIFont * | secondFont, |
std::string_view | text_str, | ||
GUIWindow * | pWindow, | ||
int | startX, | ||
int | a6 | ||
) |
|
private |
|
static |
void GUIFont::ReleaseFontTex | ( | ) |
std::string GUIFont::WrapText | ( | std::string_view | inString, |
int | width, | ||
int | uX, | ||
bool | return_on_carriage = false |
||
) |
|
private |
|
private |
|
private |