FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::GuiFont Class Reference

#include <gui_font.h>

+ Inheritance diagram for FIFE::GuiFont:
+ Collaboration diagram for FIFE::GuiFont:

Public Member Functions

 GuiFont (IFont *font)
 Constructor Takes the ownership of given font. More...
 
virtual ~GuiFont ()
 
int32_t getStringIndexAt (const std::string &text, int32_t x) const
 
void drawString (fcn::Graphics *graphics, const std::string &text, int32_t x, int32_t y)
 
void drawMultiLineString (fcn::Graphics *graphics, const std::string &text, int32_t x, int32_t y)
 
std::string splitTextToWidth (const std::string &text, int32_t render_width)
 
void setRowSpacing (int32_t spacing)
 Sets the spacing between rows in pixels. More...
 
int32_t getRowSpacing () const
 Gets the spacing between rows in pixels. More...
 
void setGlyphSpacing (int32_t spacing)
 Sets the spacing between letters in pixels. More...
 
int32_t getGlyphSpacing () const
 Gets the spacing between letters in pixels. More...
 
void setAntiAlias (bool antiAlias)
 Sets the use of anti aliasing. More...
 
bool isAntiAlias () const
 Checks if anti aliasing is used. More...
 
void setBoldStyle (bool style)
 Sets the use of bold style. More...
 
bool isBoldStyle () const
 Checks if bold style is used. More...
 
void setItalicStyle (bool style)
 Sets the use of italic style. More...
 
bool isItalicStyle () const
 Checks if italic style is used. More...
 
void setUnderlineStyle (bool style)
 Sets the use of underline style. More...
 
bool isUnderlineStyle () const
 Checks if underline style is used. More...
 
void setStrikethroughStyle (bool style)
 Sets the use of strikethrough style. More...
 
bool isStrikethroughStyle () const
 Checks if strikethrough style is used. More...
 
void setDynamicColoring (bool coloring)
 
bool isDynamicColoring () const
 
ImagegetAsImage (const std::string &text)
 Gets given text as Image The rsulting image is pooled, so it's not that time critical. More...
 
ImagegetAsImageMultiline (const std::string &text)
 Gets given text as Image. More...
 
void setColor (uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)
 Set the color the text should be rendered in. More...
 
SDL_Color getColor () const
 Get the color the text was rendered in. More...
 
int32_t getWidth (const std::string &text) const
 gets width of given text More...
 
int32_t getHeight () const
 gets height of this font More...
 
void invalidate ()
 
- Public Member Functions inherited from FIFE::IFont
virtual ~IFont ()
 

Private Attributes

IFontm_font
 

Detailed Description

Definition at line 39 of file gui_font.h.

Constructor & Destructor Documentation

◆ GuiFont()

FIFE::GuiFont::GuiFont ( IFont font)

Constructor Takes the ownership of given font.

Definition at line 38 of file gui_font.cpp.

◆ ~GuiFont()

FIFE::GuiFont::~GuiFont ( )
virtual

Definition at line 42 of file gui_font.cpp.

References m_font.

Member Function Documentation

◆ drawMultiLineString()

void FIFE::GuiFont::drawMultiLineString ( fcn::Graphics *  graphics,
const std::string &  text,
int32_t  x,
int32_t  y 
)

◆ drawString()

void FIFE::GuiFont::drawString ( fcn::Graphics *  graphics,
const std::string &  text,
int32_t  x,
int32_t  y 
)

◆ getAsImage()

Image * FIFE::GuiFont::getAsImage ( const std::string &  text)
virtual

Gets given text as Image The rsulting image is pooled, so it's not that time critical.

Implements FIFE::IFont.

Definition at line 174 of file gui_font.cpp.

References FIFE::IFont::getAsImage(), and m_font.

Referenced by drawString().

+ Here is the caller graph for this function:

◆ getAsImageMultiline()

Image * FIFE::GuiFont::getAsImageMultiline ( const std::string &  text)
virtual

Gets given text as Image.

Text is splitted on multiple lines based "\n" marks The rsulting image is pooled, so it's not that time critical

Implements FIFE::IFont.

Definition at line 178 of file gui_font.cpp.

References FIFE::IFont::getAsImageMultiline(), and m_font.

Referenced by fcn::ClickLabel::adjustSize(), fcn::ClickLabel::draw(), and drawMultiLineString().

+ Here is the caller graph for this function:

◆ getColor()

SDL_Color FIFE::GuiFont::getColor ( ) const
virtual

Get the color the text was rendered in.

Implements FIFE::IFont.

Definition at line 190 of file gui_font.cpp.

References FIFE::IFont::getColor(), and m_font.

Referenced by drawMultiLineString(), and drawString().

+ Here is the caller graph for this function:

◆ getGlyphSpacing()

int32_t FIFE::GuiFont::getGlyphSpacing ( ) const
virtual

Gets the spacing between letters in pixels.

Returns
the spacing.

Implements FIFE::IFont.

Definition at line 122 of file gui_font.cpp.

References FIFE::IFont::getGlyphSpacing(), and m_font.

◆ getHeight()

int32_t FIFE::GuiFont::getHeight ( ) const
virtual

gets height of this font

Implements FIFE::IFont.

Definition at line 198 of file gui_font.cpp.

References FIFE::IFont::getHeight(), and m_font.

Referenced by drawString().

+ Here is the caller graph for this function:

◆ getRowSpacing()

int32_t FIFE::GuiFont::getRowSpacing ( ) const
virtual

Gets the spacing between rows in pixels.

Returns
the spacing.

Implements FIFE::IFont.

Definition at line 114 of file gui_font.cpp.

References FIFE::IFont::getRowSpacing(), and m_font.

Referenced by drawMultiLineString(), and drawString().

+ Here is the caller graph for this function:

◆ getStringIndexAt()

int32_t FIFE::GuiFont::getStringIndexAt ( const std::string &  text,
int32_t  x 
) const
virtual

Implements FIFE::IFont.

Definition at line 46 of file gui_font.cpp.

References FIFE::IFont::getStringIndexAt(), and m_font.

◆ getWidth()

int32_t FIFE::GuiFont::getWidth ( const std::string &  text) const
virtual

gets width of given text

Implements FIFE::IFont.

Definition at line 194 of file gui_font.cpp.

References FIFE::IFont::getWidth(), and m_font.

Referenced by drawString().

+ Here is the caller graph for this function:

◆ invalidate()

void FIFE::GuiFont::invalidate ( )
virtual

Implements FIFE::IFont.

Definition at line 202 of file gui_font.cpp.

References FIFE::IFont::invalidate(), and m_font.

◆ isAntiAlias()

bool FIFE::GuiFont::isAntiAlias ( ) const
virtual

Checks if anti aliasing is used.

Returns
true if anti aliasing is used.

Implements FIFE::IFont.

Definition at line 130 of file gui_font.cpp.

References FIFE::IFont::isAntiAlias(), and m_font.

◆ isBoldStyle()

bool FIFE::GuiFont::isBoldStyle ( ) const
virtual

Checks if bold style is used.

Returns
true if bold style is used.

Implements FIFE::IFont.

Definition at line 138 of file gui_font.cpp.

References FIFE::IFont::isBoldStyle(), and m_font.

◆ isDynamicColoring()

bool FIFE::GuiFont::isDynamicColoring ( ) const
virtual

Implements FIFE::IFont.

Definition at line 170 of file gui_font.cpp.

References FIFE::IFont::isDynamicColoring(), and m_font.

Referenced by drawMultiLineString(), and drawString().

+ Here is the caller graph for this function:

◆ isItalicStyle()

bool FIFE::GuiFont::isItalicStyle ( ) const
virtual

Checks if italic style is used.

Returns
true if italic style is used.

Implements FIFE::IFont.

Definition at line 146 of file gui_font.cpp.

References FIFE::IFont::isItalicStyle(), and m_font.

◆ isStrikethroughStyle()

bool FIFE::GuiFont::isStrikethroughStyle ( ) const
virtual

Checks if strikethrough style is used.

Returns
true if strikethrough style is used.

Implements FIFE::IFont.

Definition at line 162 of file gui_font.cpp.

References FIFE::IFont::isStrikethroughStyle(), and m_font.

◆ isUnderlineStyle()

bool FIFE::GuiFont::isUnderlineStyle ( ) const
virtual

Checks if underline style is used.

Returns
true if underline style is used.

Implements FIFE::IFont.

Definition at line 154 of file gui_font.cpp.

References FIFE::IFont::isUnderlineStyle(), and m_font.

◆ setAntiAlias()

void FIFE::GuiFont::setAntiAlias ( bool  antiAlias)
virtual

Sets the use of anti aliasing.

Parameters
antiAliastrue for use of anti aliasing.

Implements FIFE::IFont.

Definition at line 126 of file gui_font.cpp.

References m_font, and FIFE::IFont::setAntiAlias().

◆ setBoldStyle()

void FIFE::GuiFont::setBoldStyle ( bool  style)
virtual

Sets the use of bold style.

Parameters
stlyeTrue for use of bold style.

Implements FIFE::IFont.

Definition at line 134 of file gui_font.cpp.

References m_font, and FIFE::IFont::setBoldStyle().

◆ setColor()

void FIFE::GuiFont::setColor ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a = 255 
)
virtual

Set the color the text should be rendered in.

Implements FIFE::IFont.

Definition at line 186 of file gui_font.cpp.

References m_font, and FIFE::IFont::setColor().

Referenced by FIFE::Console::Console(), drawMultiLineString(), and drawString().

+ Here is the caller graph for this function:

◆ setDynamicColoring()

void FIFE::GuiFont::setDynamicColoring ( bool  coloring)
virtual

Implements FIFE::IFont.

Definition at line 166 of file gui_font.cpp.

References m_font, and FIFE::IFont::setDynamicColoring().

◆ setGlyphSpacing()

void FIFE::GuiFont::setGlyphSpacing ( int32_t  spacing)
virtual

Sets the spacing between letters in pixels.

Default is 0 pixels. The spacing can be negative.

Parameters
spacingthe spacing in pixels.

Implements FIFE::IFont.

Definition at line 118 of file gui_font.cpp.

References m_font, and FIFE::IFont::setGlyphSpacing().

◆ setItalicStyle()

void FIFE::GuiFont::setItalicStyle ( bool  style)
virtual

Sets the use of italic style.

Parameters
stlyeTrue for use of italic style.

Implements FIFE::IFont.

Definition at line 142 of file gui_font.cpp.

References m_font, and FIFE::IFont::setItalicStyle().

◆ setRowSpacing()

void FIFE::GuiFont::setRowSpacing ( int32_t  spacing)
virtual

Sets the spacing between rows in pixels.

Default is 0 pixels. The spacing can be negative.

Parameters
spacingthe spacing in pixels.

Implements FIFE::IFont.

Definition at line 110 of file gui_font.cpp.

References m_font, and FIFE::IFont::setRowSpacing().

◆ setStrikethroughStyle()

void FIFE::GuiFont::setStrikethroughStyle ( bool  style)
virtual

Sets the use of strikethrough style.

Parameters
stlyeTrue for use of strikethrough style.

Implements FIFE::IFont.

Definition at line 158 of file gui_font.cpp.

References m_font, and FIFE::IFont::setStrikethroughStyle().

◆ setUnderlineStyle()

void FIFE::GuiFont::setUnderlineStyle ( bool  style)
virtual

Sets the use of underline style.

Parameters
stlyeTrue for use of underline style.

Implements FIFE::IFont.

Definition at line 150 of file gui_font.cpp.

References m_font, and FIFE::IFont::setUnderlineStyle().

◆ splitTextToWidth()

std::string FIFE::GuiFont::splitTextToWidth ( const std::string &  text,
int32_t  render_width 
)
virtual

Implements FIFE::IFont.

Definition at line 182 of file gui_font.cpp.

References m_font, and FIFE::IFont::splitTextToWidth().

Referenced by fcn::ClickLabel::adjustSize(), and fcn::ClickLabel::wrapText().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_font


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