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

Functions related to rendering text as a brush, using TrueType or SFont. More...

+ This graph shows which files directly or indirectly include this file:

Functions

void Init_text (void)
 Initialization of text settings, needs to be called once on program startup. More...
 
void Uninit_text (void)
 text settings cleanup. called on program shutdown More...
 
int TrueType_is_supported (void)
 Returns true if text.c was compiled with TrueType support. More...
 
void Add_font (const char *name)
 Add a new font to the list to propose to the user. More...
 
byteRender_text (const char *str, int font_number, int size, int antialias, int bold, int italic, int *width, int *height, T_Palette palette)
 Creates a brush, from the parameters given: More...
 
const char * Font_label (int index)
 Finds a label to display for a font declared with Add_font(). More...
 
const char * Font_name (int index)
 Finds the filename of a font declared with Add_font(). More...
 
int TrueType_font (int index)
 Returns true if the font of this number is TrueType, false if it's a SFont bitmap. More...
 
int Font_count (void)
 Number of fonts declared with a series of Add_font() More...
 

Detailed Description

Functions related to rendering text as a brush, using TrueType or SFont.

Function Documentation

◆ Init_text()

void Init_text ( void  )

Initialization of text settings, needs to be called once on program startup.

References Add_font(), Config_directory, Data_directory, Filepath_append_to_dir(), font_list_start, FONTS_SUBDIRECTORY, For_each_file(), and NULL.

Referenced by Init_program().

◆ Uninit_text()

void Uninit_text ( void  )

text settings cleanup. called on program shutdown

References font_list_start, T_Font::Name, T_Font::Next, and NULL.

Referenced by Program_shutdown().

◆ TrueType_is_supported()

int TrueType_is_supported ( void  )

Returns true if text.c was compiled with TrueType support.

Referenced by Button_Stats().

◆ Add_font()

void Add_font ( const char *  name)

Add a new font to the list to propose to the user.

◆ Render_text()

byte * Render_text ( const char *  str,
int  font_number,
int  size,
int  antialias,
int  bold,
int  italic,
int *  width,
int *  height,
T_Palette  palette 
)

Creates a brush, from the parameters given:

Parameters
strThe text to render
font_numberThe index of the font to use. Pass 0 for the first font you declared with Add_font(), 1 for the second etc.
sizeThe size in points (unused for bitmap fonts)
antialiasBoolean, true to use antialiasing in TrueType
boldBoolean, true to use bold rendering in TrueType
italicBoolean, true to use italic rendering in TrueType
widthReturns the width of the created brush, in pixels.
heightReturns the height of the created brush, in pixels.
paletteReturns the custom palette for the brush. Returns true on success.

References font_list_start, T_Font::Is_truetype, T_Font::Next, NULL, Render_text_SFont(), and Render_text_TTF().

Referenced by Button_Text().

◆ Font_label()

const char * Font_label ( int  index)

Finds a label to display for a font declared with Add_font().

References font_list_start, T_Font::Label, T_Font::Next, and NULL.

Referenced by Draw_one_font_name().

◆ Font_name()

const char * Font_name ( int  index)

Finds the filename of a font declared with Add_font().

References font_list_start, T_Font::Name, T_Font::Next, and NULL.

Referenced by Render_text_SFont(), and Render_text_TTF().

◆ TrueType_font()

int TrueType_font ( int  index)

Returns true if the font of this number is TrueType, false if it's a SFont bitmap.

References font_list_start, T_Font::Is_truetype, T_Font::Next, and NULL.

Referenced by Button_Text().

◆ Font_count()

int Font_count ( void  )

Number of fonts declared with a series of Add_font()

References font_list_start, T_Font::Next, and NULL.

Referenced by Button_Text().