class::sgfx::FontInfo

class sgfx::FontInfo
  : public api::SgfxInfoObject

This class contains information that describes a font.

The information can be used to allow various classes to auto select a font installed in the system to best match what the user specifies.

See sys::Assets for font installation locations.

Font names MUST follow the naming conventions for this class to parse the font correctly:

<name>-<style>-<point size>.sbf
  • name: the name of the font
  • style: the font style (see enum FontInfo::style for details).
  • point size: the pixel height of the tallest character in the font

Summary

FontInfo(

u8 point_size,
u8 style,
Font * font
)

FontInfo(

const arg::SourceFilePath & path
)

Font * font() const

bool is_valid() const

const var::ConstString & name() const

const var::String & path() const

u8 point_size() const

void set_font(

Font * font
)

u8 style() const

static int ascending_point_size(

const void * a,
const void * b
)

static int ascending_style(

const void * a,
const void * b
)

enum style

Members

FontInfo(

u8 point_size,
u8 style,
Font * font
)


FontInfo(

const arg::SourceFilePath & path
)

Contsructs an object by parsing the path.

Parameters

  • path Path to the font. The font name needs to follow the rules below:

The font name should be name-style-size.ext

  • name is the name of the font
  • style can be t, ti, el, eli, l, li, r, ri, m, mi, sb, sbi, b, bi, eb, ebi, ico (see enum style for details)

Examples include:

  • roboto-l-28.sbf which is Roboto Light size 28 in Stratify bitmap font format.
  • opensans-b-32.sbf which is Opensans bold 32

Font * font() const

Returns a pointer to the Font that can be used to draw characters and strings on a bitmap.


bool is_valid() const

Returns true if the object is valid.


const var::ConstString & name() const

Returns the name of the font.


const var::String & path() const

Returns the file path of the font.


u8 point_size() const

Returns the point size of the font.


void set_font(

Font * font
)

Assigns a pointer to the font that is used for drawing.


u8 style() const

Returns the font style (see enum FontInfo::style).


static int ascending_point_size(

const void * a,
const void * b
)

Enables sorting FontInfo objects by point size.


static int ascending_style(

const void * a,
const void * b
)

Enables sorting FontInfo objects by style.


enum style
  • ANY
  • THIN Thin font (t)
  • THIN_ITALIC Thin italic (ti)
  • EXTRA_LIGHT Extra light (el)
  • EXTRA_LIGHT_ITALIC Extra light italic (eli)
  • LIGHT Light (l)
  • LIGHT_ITALIC Light italic (li)
  • REGULAR Regular ®
  • REGULAR_ITALIC Regular Italic (ri)
  • MEDIUM Medium (m)
  • MEDIUM_ITALIC Medium italic (m)
  • SEMI_BOLD Semi bold (sb)
  • SEMI_BOLD_ITALIC Semi bold italic (sbi)
  • BOLD Bold (b)
  • BOLD_ITALIC Bold italic (bi)
  • EXTRA_BOLD Extra bold (eb)
  • EXTRA_BOLD_ITALIC Extra bold italic (ebi)
  • ICONS Font is a collection of bitmap icons (ico)

Lists the font styles that are available.


X

Thanks for Coming!

Subscribe to news and updates