GrafX2 2.9.3227
The ultimate 256-color painting program
SFont.h File Reference

Text rendering system, that uses bitmaps as fonts. More...

#include "gfx2surface.h"
+ Include dependency graph for SFont.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  SFont_Font
 Declare one variable of this type for each font you are using. More...
 

Functions

SFont_FontSFont_InitFont (T_GFX2_Surface *Font)
 Initializes the font. More...
 
void SFont_FreeFont (SFont_Font *Font)
 Frees the font. More...
 
void SFont_Write (T_GFX2_Surface *Surface, const SFont_Font *Font, int x, int y, const char *text)
 Blits a string to a surface. More...
 
int SFont_TextWidth (const SFont_Font *Font, const char *text)
 Returns the width of "text" in pixels. More...
 
int SFont_TextHeight (const SFont_Font *Font, const char *text)
 Returns the height of "text" in pixels (which is always equal to Font->Surface->h) More...
 

Detailed Description

Text rendering system, that uses bitmaps as fonts.

Not specific to Grafx2, it writes to SDL_Surface.

Function Documentation

◆ SFont_InitFont()

SFont_Font * SFont_InitFont ( T_GFX2_Surface Font)

Initializes the font.

Parameters
Fontthis contains the suface with the font. The Surface must be loaded before calling this function

References SFont_Font::CharBegin, SFont_Font::CharWidth, Get_GFX2_Surface_pixel(), T_GFX2_Surface::h, NULL, SFont_Font::Space, SFont_Font::Surface, and SFont_Font::Transparent.

Referenced by Render_text_SFont().

◆ SFont_FreeFont()

void SFont_FreeFont ( SFont_Font Font)

Frees the font.

Parameters
FontThe font to free The font must be loaded before using this function.

References Free_GFX2_Surface(), and SFont_Font::Surface.

Referenced by Render_text_SFont().

◆ SFont_Write()

void SFont_Write ( T_GFX2_Surface Surface,
const SFont_Font Font,
int  x,
int  y,
const char *  text 
)

Blits a string to a surface.

Parameters
SurfaceThe surface you want to blit to.
FontThe font to use.
textA string containing the text you want to blit.
xCoordinates to start drawing.
yCoordinates to start drawing.

References SFont_Font::CharBegin, SFont_Font::CharWidth, T_GFX2_Surface::h, NULL, T_GFX2_Surface::pixels, SFont_Font::Space, SFont_Font::Surface, and T_GFX2_Surface::w.

Referenced by Render_text_SFont().

◆ SFont_TextWidth()

int SFont_TextWidth ( const SFont_Font Font,
const char *  text 
)

Returns the width of "text" in pixels.

References SFont_Font::CharWidth, NULL, and SFont_Font::Space.

Referenced by Render_text_SFont().

◆ SFont_TextHeight()

int SFont_TextHeight ( const SFont_Font Font,
const char *  text 
)

Returns the height of "text" in pixels (which is always equal to Font->Surface->h)

References T_GFX2_Surface::h, and SFont_Font::Surface.

Referenced by Render_text_SFont().