raylib-cpp
C++ object-oriented wrapper library for raylib.
Public Member Functions | Protected Member Functions | List of all members
raylib::Font Class Reference

Public Member Functions

 Font ()
 
 Font (const ::Font &font)
 
 Font (const ::Image &image, ::Color key, int firstChar)
 
 Font (const std::string &fileName)
 
 Font (const std::string &fileName, int fontSize, int *fontChars, int charCount)
 
 Font (const std::string &fileType, const unsigned char *fileData, int dataSize, int fontSize, int *fontChars, int charsCount)
 
 ~Font ()
 
Font & DrawText (const std::string &text, ::Rectangle rec, float fontSize, float spacing, bool wordWrap, ::Color tint, int selectStart, int selectLength, ::Color selectText, ::Color selectBack)
 Draw text using font inside rectangle limits with support for text selection. More...
 
Font & DrawText (const std::string &text, ::Rectangle rec, float fontSize, float spacing, bool wordWrap=false, ::Color tint=WHITE)
 
Font & DrawText (const std::string &text, ::Vector2 position, float fontSize, float spacing, ::Color tint=WHITE)
 Draw text using font and additional parameters. More...
 
Font & DrawText (int codepoint, ::Vector2 position, float fontSize, ::Color tint={ 255, 255, 255, 255 })
 Draw one character (codepoint) More...
 
int GetBaseSize () const
 
inline ::CharInfo * GetChars () const
 
int GetCharsCount () const
 
int GetCharsPadding () const
 
int GetGlyphIndex (int character) const
 Get index position for a unicode character on font. More...
 
inline ::Rectangle * GetRecs () const
 
inline ::Texture2D GetTexture () const
 
inline ::Image ImageText (const std::string &text, float fontSize, float spacing, ::Color tint) const
 Create an image from text (custom sprite font) More...
 
Vector2 MeasureText (const std::string &text, float fontSize, float spacing) const
 Measure string size for Font. More...
 
Font & operator= (const ::Font &font)
 
void SetBaseSize (int value)
 
void SetChars (::CharInfo *value)
 
void SetCharsCount (int value)
 
void SetCharsPadding (int value)
 
void SetRecs (::Rectangle *value)
 
void SetTexture (::Texture2D value)
 
void Unload ()
 

Protected Member Functions

void set (const ::Font &font)
 

Detailed Description

Definition at line 34 of file Font.hpp.

Constructor & Destructor Documentation

◆ Font() [1/6]

raylib::Font::Font ( )
inline

Definition at line 36 of file Font.hpp.

References set().

◆ Font() [2/6]

raylib::Font::Font ( const ::Font &  font)
inline

Definition at line 40 of file Font.hpp.

References set().

◆ Font() [3/6]

raylib::Font::Font ( const std::string &  fileName)
inline

Definition at line 44 of file Font.hpp.

References set().

◆ Font() [4/6]

raylib::Font::Font ( const std::string &  fileName,
int  fontSize,
int *  fontChars,
int  charCount 
)
inline

Definition at line 48 of file Font.hpp.

References set().

◆ Font() [5/6]

raylib::Font::Font ( const ::Image &  image,
::Color  key,
int  firstChar 
)
inline

Definition at line 52 of file Font.hpp.

References set().

◆ Font() [6/6]

raylib::Font::Font ( const std::string &  fileType,
const unsigned char *  fileData,
int  dataSize,
int  fontSize,
int *  fontChars,
int  charsCount 
)
inline

Definition at line 56 of file Font.hpp.

References set().

◆ ~Font()

raylib::Font::~Font ( )
inline

Definition at line 62 of file Font.hpp.

References Unload().

Member Function Documentation

◆ DrawText() [1/4]

Font& raylib::Font::DrawText ( const std::string &  text,
::Rectangle  rec,
float  fontSize,
float  spacing,
bool  wordWrap,
::Color  tint,
int  selectStart,
int  selectLength,
::Color  selectText,
::Color  selectBack 
)
inline

Draw text using font inside rectangle limits with support for text selection.

Definition at line 100 of file Font.hpp.

◆ DrawText() [2/4]

Font& raylib::Font::DrawText ( const std::string &  text,
::Rectangle  rec,
float  fontSize,
float  spacing,
bool  wordWrap = false,
::Color  tint = WHITE 
)
inline

Definition at line 91 of file Font.hpp.

◆ DrawText() [3/4]

Font& raylib::Font::DrawText ( const std::string &  text,
::Vector2  position,
float  fontSize,
float  spacing,
::Color  tint = WHITE 
)
inline

Draw text using font and additional parameters.

Definition at line 85 of file Font.hpp.

◆ DrawText() [4/4]

Font& raylib::Font::DrawText ( int  codepoint,
::Vector2  position,
float  fontSize,
::Color  tint = { 255, 255, 255, 255 } 
)
inline

Draw one character (codepoint)

Definition at line 111 of file Font.hpp.

◆ GetBaseSize()

int raylib::Font::GetBaseSize ( ) const
inline

Definition at line 70 of file Font.hpp.

◆ GetChars()

inline ::CharInfo* raylib::Font::GetChars ( ) const
inline

Definition at line 75 of file Font.hpp.

◆ GetCharsCount()

int raylib::Font::GetCharsCount ( ) const
inline

Definition at line 71 of file Font.hpp.

◆ GetCharsPadding()

int raylib::Font::GetCharsPadding ( ) const
inline

Definition at line 72 of file Font.hpp.

◆ GetGlyphIndex()

int raylib::Font::GetGlyphIndex ( int  character) const
inline

Get index position for a unicode character on font.

Definition at line 129 of file Font.hpp.

◆ GetRecs()

inline ::Rectangle* raylib::Font::GetRecs ( ) const
inline

Definition at line 74 of file Font.hpp.

◆ GetTexture()

inline ::Texture2D raylib::Font::GetTexture ( ) const
inline

Definition at line 73 of file Font.hpp.

◆ ImageText()

inline ::Image raylib::Font::ImageText ( const std::string &  text,
float  fontSize,
float  spacing,
::Color  tint 
) const
inline

Create an image from text (custom sprite font)

Definition at line 136 of file Font.hpp.

◆ MeasureText()

Vector2 raylib::Font::MeasureText ( const std::string &  text,
float  fontSize,
float  spacing 
) const
inline

Measure string size for Font.

Definition at line 122 of file Font.hpp.

◆ operator=()

Font& raylib::Font::operator= ( const ::Font &  font)
inline

Definition at line 77 of file Font.hpp.

References set().

◆ set()

void raylib::Font::set ( const ::Font &  font)
inlineprotected

Definition at line 142 of file Font.hpp.

Referenced by Font(), and operator=().

◆ SetBaseSize()

void raylib::Font::SetBaseSize ( int  value)
inline

Definition at line 70 of file Font.hpp.

◆ SetChars()

void raylib::Font::SetChars ( ::CharInfo *  value)
inline

Definition at line 75 of file Font.hpp.

◆ SetCharsCount()

void raylib::Font::SetCharsCount ( int  value)
inline

Definition at line 71 of file Font.hpp.

◆ SetCharsPadding()

void raylib::Font::SetCharsPadding ( int  value)
inline

Definition at line 72 of file Font.hpp.

◆ SetRecs()

void raylib::Font::SetRecs ( ::Rectangle *  value)
inline

Definition at line 74 of file Font.hpp.

◆ SetTexture()

void raylib::Font::SetTexture ( ::Texture2D  value)
inline

Definition at line 73 of file Font.hpp.

◆ Unload()

void raylib::Font::Unload ( )
inline

Definition at line 66 of file Font.hpp.

Referenced by ~Font().