Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
Loading...
Searching...
No Matches
Font Class Reference

#include <definitions.hpp>

Public Member Functions

 Font ()
 
 Font (const std::string &path)
 
 ~Font ()
 
FontsetKerning (bool enabled)
 
FontsetHinting (FontHinting setting)
 
FontsetLanguage (const std::string &language)
 
FontsetLineSpacing (int spacing)
 
FontsetOutline (int outline)
 
FontsetSDF (bool enabled)
 
FontsetSize (int ptSize)
 
FontsetStyle (FontStyle style)
 
FontsetAlignment (FontAlignment positioning)
 
TTF_Font * getHandle () const
 
FontloadFromPath (const std::string &path)
 
template<class Archive >
void save (Archive &ar) const
 
template<class Archive >
void load (Archive &ar)
 

Public Attributes

std::string path
 
int size = 30
 

Detailed Description

Font

Defines a TrueType font and a myriad of properties.

Example usage:

Font font = Font("path/to/font");
Definition definitions.hpp:88
Font * setLineSpacing(int spacing)
Definition definitions.cpp:107
Font()
Definition definitions.cpp:57
Font * setKerning(bool enabled)
Definition definitions.cpp:86
Font * setStyle(FontStyle style)
Definition definitions.cpp:135
Font * setSize(int ptSize)
Definition definitions.cpp:128

Properties and usages

You can...

font.setKerning(true); // Enable or disable kerning on the font
font.setHinting(FontHinting::MONO); // Change the hinting of the font
font.setLanguage("en-US"); // Set the language of the font
font.setLineSpacing(20); // Set the amount of spacing between lines
font.setOutline(true); // Enable/Disable an outline
font.setSDF(false); // DISABLE SDF. It's bad... please don't use it :(
font.setSize(40); // Set the font size
font.setStyle(FontStyle::UNDERLINE); // Change the font style!
font.setAlignment(FontAlignment::CENTER) // And finally, set the alingment of the font!

Constructor & Destructor Documentation

◆ Font() [1/2]

Font::Font ( )

◆ Font() [2/2]

Font::Font ( const std::string &  path)

◆ ~Font()

Font::~Font ( )

Member Function Documentation

◆ getHandle()

TTF_Font * Font::getHandle ( ) const

◆ load()

template<class Archive >
void Font::load ( Archive &  ar)
inline

◆ loadFromPath()

Font * Font::loadFromPath ( const std::string &  path)

◆ save()

template<class Archive >
void Font::save ( Archive &  ar) const
inline

◆ setAlignment()

Font * Font::setAlignment ( FontAlignment  positioning)

◆ setHinting()

Font * Font::setHinting ( FontHinting  setting)

◆ setKerning()

Font * Font::setKerning ( bool  enabled)

◆ setLanguage()

Font * Font::setLanguage ( const std::string &  language)

◆ setLineSpacing()

Font * Font::setLineSpacing ( int  spacing)

◆ setOutline()

Font * Font::setOutline ( int  outline)

◆ setSDF()

Font * Font::setSDF ( bool  enabled)

◆ setSize()

Font * Font::setSize ( int  ptSize)

◆ setStyle()

Font * Font::setStyle ( FontStyle  style)

Member Data Documentation

◆ path

std::string Font::path

◆ size

int Font::size = 30

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