class::sgfx::Font

class sgfx::Font
  : public api::SgfxWorkObject

Members

Font()
u16 bits_per_pixel() const
int calculate_length(

const var::ConstString & str
) const

const sg_font_char_t & character() const
u16 character_count() const
int draw(

const var::ConstString & const_string,
Bitmap & dest,
const Point & point
) const

int draw(

char c,
Bitmap & dest,
const Point & point
) const

sg_size_t get_height() const
sg_size_t get_width() const
bool is_kerning_enabled() const
u16 kerning_pair_count() const
sg_size_t letter_spacing() const
int offset_x() const
int offset_y() const
void set_kerning_enabled(

bool value
)

void set_letter_spacing(

sg_size_t spacing
)

void set_space_size(

int s
)

int size() const
int space_size() const
static const var::ConstString & ascii_character_set()

Details

Font()

u16 bits_per_pixel() const

Accesses the number of bits per pixel in the font.


int calculate_length(

const var::ConstString & str
) const

Calculates the length (pixels on x-axis) of the specified string.


const sg_font_char_t & character() const

u16 character_count() const

Accesses the number of characters in the font.


int draw(

const var::ConstString & const_string,
Bitmap & dest,
const Point & point
) const

Draws the string on the specified bitmap.

Parameters

  • str The string to draw (or set)

  • dest The bitmap to draw the string on

  • point The top left corner to start drawing the string

Returns

Zero on success


int draw(

char c,
Bitmap & dest,
const Point & point
) const

Draws a character on the bitmap.

Parameters

  • c The character to draw

  • dest The destination bitmap

  • point The top-left corner where to draw on dest

Returns

Zero on success (-1 if character fails to load)


sg_size_t get_height() const

Returns the maximum height of any character in the font.


sg_size_t get_width() const

Returns the maximum width of any character in the font.


bool is_kerning_enabled() const

Returns true if kerning is enabled.


u16 kerning_pair_count() const

Accesses the number of kerning pairs in the font.


sg_size_t letter_spacing() const

Returns the spacing of the letters within a word.


int offset_x() const

int offset_y() const

void set_kerning_enabled(

bool value
)

Enables (or disables) kerning.


void set_letter_spacing(

sg_size_t spacing
)

Sets the spacing between letters within a word.


void set_space_size(

int s
)

Sets the number of pixels in a space between words.


int size() const

Returns the number of characters in the font.


int space_size() const

Returns the number of pixels between words.


static const var::ConstString & ascii_character_set()

Returns a string of the available character set


X

Thanks for Coming!

Subscribe to news and updates