NDEVR
API Documentation
Font

Information for how to display text data. More...

Collaboration diagram for Font:
[legend]

Public Member Functions

bool executeAnsiiCode (uint04 ansii_code, const Font &default_font)
 Applies an ANSI escape code to modify the font style.
const Filefile () const
 Gets the file path associated with this font.
bool findBestFileIfNeeded (bool allow_backup_file=true)
 Locates the best matching font file if one has not been set.
bool hasBoldFamily () const
 Checks whether a bold variant of this font family exists.
bool hasItalicFamily () const
 Checks whether an italic variant of this font family exists.
bool isBold () const
 Checks whether the font style is bold.
bool isItalic () const
 Checks whether the font style is italic.
StringView name () const
 Gets the font family name.
bool operator!= (const Font &font) const
 Checks inequality between two Font objects.
bool operator== (const Font &font) const
 Checks equality between two Font objects.
void setFile (const File &file)
 Sets the file path for this font.
void setHasBoldFamily (bool has_bold_family)
 Sets whether a bold variant of this font family exists.
void setHasItalicFamily (bool has_italic_family)
 Sets whether an italic variant of this font family exists.
void setIsBold (bool is_bold)
 Sets whether the font style is bold.
void setIsItalic (bool is_italic)
 Sets whether the font style is italic.
void setName (const StringView &name)
 Sets the font family name.

Public Attributes

String app_font_name
 Application-specific font identifier name.
RGBColor color = Constant<RGBColor>::Invalid
 Font rendering color.
fltp08 fixed_width = Constant<fltp08>::Invalid
 Fixed character width override.
uint04 index = 0
 Index of the font face within a font file.
bool is_overstrike = false
 Whether the font style includes overstrike.
bool is_strikethrough = false
 Whether the font style includes strikethrough.
bool is_underline = false
 Whether the font style includes underline.
fltp08 pixel_size = Constant<fltp08>::Invalid
 Font size in pixels.
fltp08 point_size = Constant<fltp08>::Invalid
 Font size in points.
fltp08 tab_advance = Constant<fltp08>::Invalid
 Horizontal advance distance for tab characters.

Protected Attributes

std::function< Font(wchar_t character)> m_fallback_font
 Callback to find a fallback font for unsupported characters.
File m_file
 Cached file path for the font.
bool m_has_bold_family = false
 Whether a bold variant of this font family exists.
bool m_has_italic_family = false
 Whether an italic variant of this font family exists.
bool m_is_bold = false
 Whether the font is bold.
bool m_is_italic = false
 Whether the font is italic.
String m_name
 The font family name.

Detailed Description

Information for how to display text data.


Definition at line 45 of file Font.h.

Member Function Documentation

◆ executeAnsiiCode()

bool Font::executeAnsiiCode ( uint04 ansii_code,
const Font & default_font )

Applies an ANSI escape code to modify the font style.

Parameters
[in]ansii_codeThe ANSI code to execute.
[in]default_fontThe default font to revert to when a reset code is encountered.
Returns
True if the code was recognized and applied.

◆ file()

const File & Font::file ( ) const
inline

Gets the file path associated with this font.

Returns
A const reference to the font file.

Definition at line 139 of file Font.h.

References m_file.

Referenced by setFile().

◆ findBestFileIfNeeded()

bool Font::findBestFileIfNeeded ( bool allow_backup_file = true)

Locates the best matching font file if one has not been set.

Parameters
[in]allow_backup_fileWhether to fall back to a backup font file if exact match is not found.
Returns
True if a suitable font file was found.

◆ hasBoldFamily()

bool Font::hasBoldFamily ( ) const

Checks whether a bold variant of this font family exists.

Returns
True if a bold family variant is available.

◆ hasItalicFamily()

bool Font::hasItalicFamily ( ) const

Checks whether an italic variant of this font family exists.

Returns
True if an italic family variant is available.

◆ isBold()

bool Font::isBold ( ) const
inline

Checks whether the font style is bold.

Returns
True if the font is bold.

Definition at line 71 of file Font.h.

References m_is_bold.

◆ isItalic()

bool Font::isItalic ( ) const
inline

Checks whether the font style is italic.

Returns
True if the font is italic.

Definition at line 77 of file Font.h.

References m_is_italic.

◆ name()

StringView Font::name ( ) const
inline

Gets the font family name.

Returns
The font name as a StringView.

Definition at line 65 of file Font.h.

References m_name.

Referenced by setName().

◆ operator!=()

bool Font::operator!= ( const Font & font) const

Checks inequality between two Font objects.

Parameters
[in]fontThe font to compare against.
Returns
True if any font properties differ.

◆ operator==()

bool Font::operator== ( const Font & font) const

Checks equality between two Font objects.

Parameters
[in]fontThe font to compare against.
Returns
True if all font properties are equal.

◆ setFile()

void Font::setFile ( const File & file)
inline

Sets the file path for this font.

Parameters
[in]fileThe font file to assign.

Definition at line 152 of file Font.h.

References file(), and m_file.

◆ setHasBoldFamily()

void Font::setHasBoldFamily ( bool has_bold_family)
inline

Sets whether a bold variant of this font family exists.

Parameters
[in]has_bold_familyTrue if a bold family variant is available.

Definition at line 83 of file Font.h.

References m_has_bold_family.

◆ setHasItalicFamily()

void Font::setHasItalicFamily ( bool has_italic_family)
inline

Sets whether an italic variant of this font family exists.

Parameters
[in]has_italic_familyTrue if an italic family variant is available.

Definition at line 89 of file Font.h.

References m_has_italic_family.

◆ setIsBold()

void Font::setIsBold ( bool is_bold)

Sets whether the font style is bold.

Parameters
[in]is_boldTrue to make the font bold.

◆ setIsItalic()

void Font::setIsItalic ( bool is_italic)

Sets whether the font style is italic.

Parameters
[in]is_italicTrue to make the font italic.

◆ setName()

void Font::setName ( const StringView & name)

Sets the font family name.

Parameters
[in]nameThe font family name to set.

References name().


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