FS2_Open
Open source remastering of the Freespace 2 engine
font.h File Reference

Go to the source code of this file.

Classes

struct  font_char
 
struct  font_kernpair
 
struct  font
 

Macros

#define MAX_FONTS   5
 
#define FONT_VERSION   0
 
#define WIDEST_DIGIT   "4"
 
#define WIDEST_CHAR   "W"
 
#define FONT1   0
 
#define FONT2   1
 
#define FONT3   2
 

Typedefs

typedef struct font_char font_char
 
typedef struct font_kernpair font_kernpair
 
typedef struct font font
 

Functions

void gr_stuff_first_font (char *first_font, size_t first_font_size)
 
int gr_get_current_fontnum ()
 
int gr_get_fontnum (const char *filename)
 
void gr_set_font (int fontnum)
 
void gr_print_timestamp (int x, int y, fix timestamp, int resize_mode)
 
int gr_force_fit_string (char *str, int max_str, int max_width)
 
void gr_font_init ()
 
void gr_font_close ()
 
int get_char_width (ubyte c1, ubyte c2, int *width, int *spacing)
 
int get_centered_x (const char *s, bool scaled)
 

Variables

int Num_fonts
 
font Fonts [MAX_FONTS]
 
fontCurrent_font
 

Macro Definition Documentation

#define FONT1   0

Definition at line 65 of file font.h.

#define FONT2   1

Definition at line 66 of file font.h.

#define FONT3   2

Definition at line 67 of file font.h.

#define FONT_VERSION   0

Definition at line 19 of file font.h.

#define MAX_FONTS   5

Definition at line 17 of file font.h.

#define WIDEST_CHAR   "W"

Definition at line 21 of file font.h.

#define WIDEST_DIGIT   "4"

Definition at line 20 of file font.h.

Typedef Documentation

typedef struct font font
typedef struct font_char font_char
typedef struct font_kernpair font_kernpair

Function Documentation

int get_centered_x ( const char *  s,
bool  scaled 
)

Definition at line 114 of file font.cpp.

int get_char_width ( ubyte  c1,
ubyte  c2,
int width,
int spacing 
)

Takes the character BEFORE being offset into current font

Returns
the letter code

Definition at line 75 of file font.cpp.

void gr_font_close ( )

Definition at line 356 of file font.cpp.

void gr_font_init ( )

Definition at line 699 of file font.cpp.

int gr_force_fit_string ( char *  str,
int  max_str,
int  max_width 
)

Crops a string if required to force it to not exceed max_width pixels when printed. Does this by dropping characters at the end of the string and adding '...' to the end.

Parameters
strstring to crop. Modifies this string directly
max_strmax characters allowed in str
max_widthnumber of pixels to limit string to (less than or equal to).
Returns
Returns the width of the string as given by gr_get_string_size().

Definition at line 48 of file font.cpp.

int gr_get_current_fontnum ( )

Definition at line 545 of file font.cpp.

int gr_get_fontnum ( const char *  filename)

Definition at line 554 of file font.cpp.

void gr_print_timestamp ( int  x,
int  y,
fix  timestamp,
int  resize_mode 
)

Definition at line 143 of file font.cpp.

void gr_set_font ( int  fontnum)

Definition at line 566 of file font.cpp.

void gr_stuff_first_font ( char *  first_font,
size_t  first_font_size 
)

Definition at line 694 of file font.cpp.

Variable Documentation

font* Current_font

Definition at line 80 of file font.h.

font Fonts[MAX_FONTS]

Definition at line 35 of file font.cpp.

int Num_fonts

Definition at line 34 of file font.cpp.