OldSchool Library
SFont

Functions to manage SFonts. More...

Data Structures

struct  OSL_SFLETTER
 Struct describing a single SFont letter. More...
 
struct  OSL_SFONT
 Struct describing a SFont. More...
 

Functions

OSL_SFONToslLoadSFontFile (char *filename, int pixelFormat)
 Load an SFont from a file.
 
void oslDeleteSFont (OSL_SFONT *sfont)
 Delete a loaded SFont.
 
int oslGetSFontTextWidth (OSL_SFONT *sfont, char *text)
 Get the text width using an SFont.
 
int oslSFontDrawText (OSL_SFONT *sfont, int x, int y, char *text)
 Print a string using an SFont.
 

Detailed Description

Functions to manage SFonts.

Function Documentation

◆ oslLoadSFontFile()

OSL_SFONT * oslLoadSFontFile ( char * filename,
int pixelFormat )

Load an SFont from a file.

Parameters
filenameThe name of the file to load the SFont from.
pixelFormatThe pixel format to use for the SFont.
Returns
A pointer to the loaded OSL_SFONT, or NULL on failure.

◆ oslDeleteSFont()

void oslDeleteSFont ( OSL_SFONT * sfont)

Delete a loaded SFont.

Parameters
sfontThe SFont to delete.

◆ oslGetSFontTextWidth()

int oslGetSFontTextWidth ( OSL_SFONT * sfont,
char * text )

Get the text width using an SFont.

Parameters
sfontThe SFont to use for measurement.
textThe text string to measure.
Returns
The width in pixels of the string rendered with the given SFont.

◆ oslSFontDrawText()

int oslSFontDrawText ( OSL_SFONT * sfont,
int x,
int y,
char * text )

Print a string using an SFont.

Parameters
sfontThe SFont to use for printing.
xThe X position on the screen to start printing.
yThe Y position on the screen to start printing.
textThe text string to print.
Returns
The X position of the end of the rendered string.