Otclient  14/8/2020
BitmapFont Class Reference

#include <bitmapfont.h>

Inheritance diagram for BitmapFont:
Collaboration diagram for BitmapFont:

Public Member Functions

 BitmapFont (const std::string &name)
 
void load (const OTMLNodePtr &fontNode)
 Load font from otml node. More...
 
void drawText (const std::string &text, const Point &startPos)
 Simple text render starting at startPos. More...
 
void drawText (const std::string &text, const Rect &screenCoords, Fw::AlignmentFlag align=Fw::AlignTopLeft)
 Advanced text render delimited by a screen region and alignment. More...
 
void calculateDrawTextCoords (CoordsBuffer &coordsBuffer, const std::string &text, const Rect &screenCoords, Fw::AlignmentFlag align=Fw::AlignTopLeft)
 
const std::vector< Point > & calculateGlyphsPositions (const std::string &text, Fw::AlignmentFlag align=Fw::AlignTopLeft, Size *textBoxSize=nullptr)
 Calculate glyphs positions to use on render, also calculates textBoxSize if wanted. More...
 
Size calculateTextRectSize (const std::string &text)
 Simulate render and calculate text size. More...
 
std::string wrapText (const std::string &text, int maxWidth)
 
std::string getName ()
 
int getGlyphHeight ()
 
const RectgetGlyphsTextureCoords ()
 
const SizegetGlyphsSize ()
 
const TexturePtrgetTexture ()
 
int getYOffset ()
 
Size getGlyphSpacing ()
 
- Public Member Functions inherited from stdext::shared_object
 shared_object ()
 
virtual ~shared_object ()
 
void add_ref ()
 
void dec_ref ()
 
refcount_t ref_count ()
 
template<typename T >
stdext::shared_object_ptr< T > static_self_cast ()
 
template<typename T >
stdext::shared_object_ptr< T > dynamic_self_cast ()
 
template<typename T >
stdext::shared_object_ptr< T > const_self_cast ()
 

Detailed Description

Definition at line 32 of file bitmapfont.h.

Constructor & Destructor Documentation

◆ BitmapFont()

BitmapFont::BitmapFont ( const std::string &  name)
inline

Definition at line 35 of file bitmapfont.h.

Member Function Documentation

◆ calculateDrawTextCoords()

void BitmapFont::calculateDrawTextCoords ( CoordsBuffer coordsBuffer,
const std::string &  text,
const Rect screenCoords,
Fw::AlignmentFlag  align = Fw::AlignTopLeft 
)

Definition at line 96 of file bitmapfont.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateGlyphsPositions()

const std::vector< Point > & BitmapFont::calculateGlyphsPositions ( const std::string &  text,
Fw::AlignmentFlag  align = Fw::AlignTopLeft,
Size textBoxSize = nullptr 
)

Calculate glyphs positions to use on render, also calculates textBoxSize if wanted.

Definition at line 172 of file bitmapfont.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculateTextRectSize()

Size BitmapFont::calculateTextRectSize ( const std::string &  text)

Simulate render and calculate text size.

Definition at line 256 of file bitmapfont.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawText() [1/2]

void BitmapFont::drawText ( const std::string &  text,
const Point startPos 
)

Simple text render starting at startPos.

Definition at line 80 of file bitmapfont.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawText() [2/2]

void BitmapFont::drawText ( const std::string &  text,
const Rect screenCoords,
Fw::AlignmentFlag  align = Fw::AlignTopLeft 
)

Advanced text render delimited by a screen region and alignment.

Definition at line 87 of file bitmapfont.cpp.

Here is the call graph for this function:

◆ getGlyphHeight()

int BitmapFont::getGlyphHeight ( )
inline

Definition at line 59 of file bitmapfont.h.

Here is the caller graph for this function:

◆ getGlyphSpacing()

Size BitmapFont::getGlyphSpacing ( )
inline

Definition at line 64 of file bitmapfont.h.

Here is the caller graph for this function:

◆ getGlyphsSize()

const Size* BitmapFont::getGlyphsSize ( )
inline

Definition at line 61 of file bitmapfont.h.

◆ getGlyphsTextureCoords()

const Rect* BitmapFont::getGlyphsTextureCoords ( )
inline

Definition at line 60 of file bitmapfont.h.

◆ getName()

std::string BitmapFont::getName ( )
inline

Definition at line 58 of file bitmapfont.h.

Here is the caller graph for this function:

◆ getTexture()

const TexturePtr& BitmapFont::getTexture ( )
inline

Definition at line 62 of file bitmapfont.h.

Here is the caller graph for this function:

◆ getYOffset()

int BitmapFont::getYOffset ( )
inline

Definition at line 63 of file bitmapfont.h.

Here is the caller graph for this function:

◆ load()

void BitmapFont::load ( const OTMLNodePtr fontNode)

Load font from otml node.

Definition at line 30 of file bitmapfont.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wrapText()

std::string BitmapFont::wrapText ( const std::string &  text,
int  maxWidth 
)

Definition at line 293 of file bitmapfont.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

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