Castor3D 0.16.0
Multiplatform 3D engine
Classes | Public Member Functions | List of all members
castor::Font Class Reference

#include <Font.hpp>

Inheritance diagram for castor::Font:
Inheritance graph
[legend]
Collaboration diagram for castor::Font:
Collaboration graph
[legend]

Classes

class  BinaryLoader
 Font loader. More...
 
struct  SFontImpl
 Structure used to load glyphs on demand. More...
 

Public Member Functions

 CU_DeclareVector (Glyph, Glyph)
 
CU_API Font (String const &name, uint32_t height)
 Constructor.
 
CU_API Font (String const &name, uint32_t height, Path const &path)
 Constructor.
 
virtual CU_API ~Font () noexcept=default
 Destructor.
 
CU_API void loadGlyph (char32_t c)
 Loads wanted glyph.
 
CU_API TextMetrics getTextMetrics (std::u32string const &v, uint32_t maxWidth, bool splitLines) const
 Retrieves the metrics of given text.
 
bool hasGlyphAt (char32_t c) const
 Tells if the font already has load ed the wanted glyph.
 
Glyph const & getGlyphAt (char32_t c) const
 Retrieves the glyph of wanted chaaracter.
 
GlyphgetGlyphAt (char32_t c)
 Retrieves the glyph of wanted chaaracter.
 
Glyph const & operator[] (char32_t c) const
 Retrieves the glyph of wanted chaaracter.
 
Glyphoperator[] (char32_t c)
 Retrieves the glyph of wanted chaaracter.
 
uint32_t getHeight () const noexcept
 Retrieves the height of the font.
 
uint32_t getMaxHeight () const noexcept
 Retrieves the max height of the glyphs.
 
Point2i getMaxRange () const noexcept
 Retrieves the max height of the glyphs.
 
uint32_t getMaxWidth () const noexcept
 Retrieves the max width of the glyphs.
 
void setGlyphLoader (castor::RawUniquePtr< SFontImpl > loader) noexcept
 sets the glyph loader
 
bool hasGlyphLoader () const noexcept
 Tells if the font has a glyph loader.
 
SFontImplgetGlyphLoader () const noexcept
 Retrieves the glyph loader.
 
auto begin () noexcept
 Retrieves an iterator on the first glyph.
 
auto begin () const noexcept
 Retrieves an iterator on the first glyph.
 
auto end () noexcept
 Retrieves an iterator on the glyph array end.
 
auto end () const noexcept
 Retrieves an iterator on the glyph array end.
 
void setFaceName (String name) noexcept
 sets The font face name
 
String const & getFaceName () const noexcept
 Retrieves The font face name.
 
Path const & getFilePath () const noexcept
 Retrieves The font file path.
 
void initialise () const noexcept
 
void cleanup () const noexcept
 
bool isSerialisable () const noexcept
 
void setSerialisable (bool v) noexcept
 
- Public Member Functions inherited from castor::NamedBaseT< T >
 NamedBaseT (T name) noexcept
 Constructor.
 
T const & getName () const noexcept
 Retrieves the name.
 
void rename (T name) noexcept
 

Additional Inherited Members

- Protected Attributes inherited from castor::NamedBaseT< T >
m_name
 

Constructor & Destructor Documentation

◆ Font() [1/2]

CU_API castor::Font::Font ( String const & name,
uint32_t height )

Constructor.

Parameters
[in]nameThe font name
[in]heightThe font char height

◆ Font() [2/2]

CU_API castor::Font::Font ( String const & name,
uint32_t height,
Path const & path )

Constructor.

Parameters
[in]pathThe font file path
[in]nameThe font name
[in]heightThe font char height

◆ ~Font()

virtual CU_API castor::Font::~Font ( )
virtualdefaultnoexcept

Destructor.

Remarks
Virtual to enable use as ResourceT.

Member Function Documentation

◆ begin() [1/2]

auto castor::Font::begin ( ) const
inlinenoexcept

Retrieves an iterator on the first glyph.

Returns
The iterator

◆ begin() [2/2]

auto castor::Font::begin ( )
inlinenoexcept

Retrieves an iterator on the first glyph.

Returns
The iterator

◆ cleanup()

void castor::Font::cleanup ( ) const
inlinenoexcept

◆ CU_DeclareVector()

castor::Font::CU_DeclareVector ( Glyph ,
Glyph  )

◆ end() [1/2]

auto castor::Font::end ( ) const
inlinenoexcept

Retrieves an iterator on the glyph array end.

Returns
The iterator

◆ end() [2/2]

auto castor::Font::end ( )
inlinenoexcept

Retrieves an iterator on the glyph array end.

Returns
The iterator

◆ getFaceName()

String const & castor::Font::getFaceName ( ) const
inlinenoexcept

Retrieves The font face name.

Returns
The value

◆ getFilePath()

Path const & castor::Font::getFilePath ( ) const
inlinenoexcept

Retrieves The font file path.

Returns
The value.

◆ getGlyphAt() [1/2]

Glyph & castor::Font::getGlyphAt ( char32_t c)
inline

Retrieves the glyph of wanted chaaracter.

Parameters
[in]cThe wanted character
Returns
A reference on the glyph

◆ getGlyphAt() [2/2]

Glyph const & castor::Font::getGlyphAt ( char32_t c) const
inline

Retrieves the glyph of wanted chaaracter.

Parameters
[in]cThe wanted character
Returns
A constant reference on the glyph

◆ getGlyphLoader()

SFontImpl & castor::Font::getGlyphLoader ( ) const
inlinenoexcept

Retrieves the glyph loader.

Returns
The loader

◆ getHeight()

uint32_t castor::Font::getHeight ( ) const
inlinenoexcept

Retrieves the height of the font.

Returns
The font height

◆ getMaxHeight()

uint32_t castor::Font::getMaxHeight ( ) const
inlinenoexcept

Retrieves the max height of the glyphs.

Returns
The glyphs max height

◆ getMaxRange()

Point2i castor::Font::getMaxRange ( ) const
inlinenoexcept

Retrieves the max height of the glyphs.

Returns
The glyphs max height

◆ getMaxWidth()

uint32_t castor::Font::getMaxWidth ( ) const
inlinenoexcept

Retrieves the max width of the glyphs.

Returns
The glyphs max width

◆ getTextMetrics()

CU_API TextMetrics castor::Font::getTextMetrics ( std::u32string const & v,
uint32_t maxWidth,
bool splitLines ) const

Retrieves the metrics of given text.

Parameters
[in]vThe text.
[in]maxWidthThe maximum width if splitLines is true.
[in]splitLinestrue to split lines according to maxWidth.

◆ hasGlyphAt()

bool castor::Font::hasGlyphAt ( char32_t c) const
inline

Tells if the font already has load ed the wanted glyph.

Parameters
[in]cThe character.
Returns
false if not.

Referenced by operator[](), and operator[]().

Here is the caller graph for this function:

◆ hasGlyphLoader()

bool castor::Font::hasGlyphLoader ( ) const
inlinenoexcept

Tells if the font has a glyph loader.

Returns
The status

◆ initialise()

void castor::Font::initialise ( ) const
inlinenoexcept

◆ isSerialisable()

bool castor::Font::isSerialisable ( ) const
inlinenoexcept

◆ loadGlyph()

CU_API void castor::Font::loadGlyph ( char32_t c)

Loads wanted glyph.

Parameters
[in]cThe character.

◆ operator[]() [1/2]

Glyph & castor::Font::operator[] ( char32_t c)
inline

Retrieves the glyph of wanted chaaracter.

Parameters
[in]cThe wanted character
Returns
A reference on the glyph

References CU_Ensure, and hasGlyphAt().

Here is the call graph for this function:

◆ operator[]() [2/2]

Glyph const & castor::Font::operator[] ( char32_t c) const
inline

Retrieves the glyph of wanted chaaracter.

Parameters
[in]cThe wanted character
Returns
A reference on the glyph

References CU_Ensure, and hasGlyphAt().

Here is the call graph for this function:

◆ setFaceName()

void castor::Font::setFaceName ( String name)
inlinenoexcept

sets The font face name

Parameters
[in]nameThe value

◆ setGlyphLoader()

void castor::Font::setGlyphLoader ( castor::RawUniquePtr< SFontImpl > loader)
inlinenoexcept

sets the glyph loader

Parameters
[in]loaderThe value

◆ setSerialisable()

void castor::Font::setSerialisable ( bool v)
inlinenoexcept

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