OpenEnroth 4aaa0a0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
GUIFont Class Reference

#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< GUIFontLoadFont (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
 

Detailed Description

Some notes on markup characters supported by GUIFont functions.

See also
Color::fromC16

Constructor & Destructor Documentation

◆ GUIFont()

GUIFont::GUIFont ( )
default

◆ ~GUIFont()

GUIFont::~GUIFont ( )

Member Function Documentation

◆ AlignText_Center()

int GUIFont::AlignText_Center ( int  width,
std::string_view  str 
)
Parameters
widthWidth of the rect to position the text in.
strText to position.
Returns
X-offset for a call to DrawTextLine to make the text aligned, or 0 if the text overflows.

◆ CalcTextHeight()

int GUIFont::CalcTextHeight ( std::string_view  str,
int  width,
int  x 
)
Parameters
strText to check.
widthWidth of the window that the text should fit into.
xWhere does the text start relative to the window's left border?
Returns
Wrapped text height, in pixels.

◆ CreateFontTex()

void GUIFont::CreateFontTex ( )

◆ DrawCreditsEntry()

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 
)

◆ DrawText()

void GUIFont::DrawText ( GUIWindow window,
Pointi  position,
Color  color,
std::string_view  text,
int  maxHeight,
Color  shadowColor 
)

◆ DrawTextInRect()

int GUIFont::DrawTextInRect ( GUIWindow window,
Pointi  position,
Color  color,
std::string_view  text,
int  rect_width,
int  reverse_text 
)

◆ DrawTextLine()

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.

Parameters
textInput line of text.
startColorColor 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.
defaultColorThe color that the text should return to on hitting a default color tag.
positionPosition to draw the text line at.
Returns
Color that was used to draw text at the end of the line.

◆ DrawTextLineToBuff()

void GUIFont::DrawTextLineToBuff ( Color  color,
Color  shadowColor,
Color uX_buff_pos,
std::string_view  text,
int  line_width 
)
private

◆ FitTwoFontStringINWindow()

std::string GUIFont::FitTwoFontStringINWindow ( std::string_view  inString,
GUIFont pFontSecond,
GUIWindow pWindow,
int  startPixlOff,
bool  return_on_carriage = false 
)
private

◆ GetHeight()

int GUIFont::GetHeight ( ) const

◆ GetLineWidth()

int GUIFont::GetLineWidth ( std::string_view  str)
Parameters
strText to check.
Returns
Width of the first line of str, in pixels. Note that \t counts as a line break as it essentially starts a new table column.

◆ GetPageText()

std::string GUIFont::GetPageText ( std::string_view  str,
Sizei  pageSize,
int  x,
int  page 
)
Parameters
strMultipage text to page-wrap.
pageSizeSize of a single page, in pixels.
xWhere does the text start relative to the page's left border?
pagePage number to get the text for, starts at 0.
Returns
Text at the given page. Note that this function doesn't cut the text's tail.

◆ GetStringHeight2()

int GUIFont::GetStringHeight2 ( GUIFont secondFont,
std::string_view  text_str,
GUIWindow pWindow,
int  startX,
int  a6 
)

◆ IsCharValid()

bool GUIFont::IsCharValid ( unsigned char  c) const
private

◆ LoadFont()

std::unique_ptr< GUIFont > GUIFont::LoadFont ( std::string_view  pFontFile)
static

◆ ReleaseFontTex()

void GUIFont::ReleaseFontTex ( )

◆ WrapText()

std::string GUIFont::WrapText ( std::string_view  inString,
int  width,
int  uX,
bool  return_on_carriage = false 
)

Member Data Documentation

◆ _font

LodFont GUIFont::_font
private

◆ _mainTexture

GraphicsImage* GUIFont::_mainTexture = nullptr
private

◆ _shadowTexture

GraphicsImage* GUIFont::_shadowTexture = nullptr
private

The documentation for this class was generated from the following files: