UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_font.cpp File Reference
#include "ui_main.h"
#include "ui_internal.h"
#include "ui_font.h"
#include "ui_parse.h"
#include "../cl_shared.h"
#include "../../shared/parse.h"
#include "../renderer/r_font.h"

Go to the source code of this file.

Macros

#define MAX_FONTS   16
 

Functions

static void UI_RegisterFont (const uiFont_t *font)
 Registers a new TTF font. More...
 
bool UI_ParseFont (const char *name, const char **text)
 
const char * UI_GetFontFromNode (const uiNode_t *const node)
 Return the font for a specific node or default font. More...
 
const uiFont_tUI_GetFontByID (const char *name)
 Return the font for a specific id. More...
 
int UI_FontGetHeight (const char *fontID)
 
void UI_InitFonts (void)
 after a video restart we have to reinitialize the fonts More...
 
void UI_FontShutdown (void)
 

Variables

static int numFonts = 0
 
static uiFont_t fonts [MAX_FONTS]
 
static const value_t fontValues []
 

Macro Definition Documentation

#define MAX_FONTS   16

Definition at line 34 of file ui_font.cpp.

Referenced by UI_ParseFont().

Function Documentation

void UI_FontShutdown ( void  )

Definition at line 184 of file ui_font.cpp.

References numFonts.

Referenced by UI_Shutdown().

const uiFont_t* UI_GetFontByID ( const char *  name)

Return the font for a specific id.

Definition at line 157 of file ui_font.cpp.

References i, numFonts, and Q_streq.

Referenced by UI_DrawString(), and UI_ParseFont().

void UI_InitFonts ( void  )

after a video restart we have to reinitialize the fonts

Definition at line 177 of file ui_font.cpp.

References Com_Printf(), i, numFonts, and UI_RegisterFont().

Referenced by CL_NewLanguage(), and UI_Reinit().

static void UI_RegisterFont ( const uiFont_t font)
static

Registers a new TTF font.

Note
The TTF font path is translated via gettext to be able to use different fonts for every translation
Parameters
[in]fontFont to register

Definition at line 52 of file ui_font.cpp.

References _, Com_Error(), ERR_FATAL, FS_CheckFile(), uiFont_s::name, uiFont_s::path, R_FontRegister(), uiFont_s::size, and uiFont_s::style.

Referenced by UI_InitFonts(), and UI_ParseFont().

Variable Documentation

uiFont_t fonts[MAX_FONTS]
static

Definition at line 36 of file ui_font.cpp.

const value_t fontValues[]
static
Initial value:
= {
{"font", V_TRANSLATION_STRING, offsetof(uiFont_t, path), 0},
{"size", V_INT, offsetof(uiFont_t, size), MEMBER_SIZEOF(uiFont_t, size)},
{"style", V_HUNK_STRING, offsetof(uiFont_t, style), 0},
{nullptr, V_NULL, 0, 0}
}
GLsizei size
Definition: r_gl.h:152
Definition: scripts.h:49
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52

Definition at line 38 of file ui_font.cpp.

int numFonts = 0
static

Definition at line 35 of file ui_font.cpp.

Referenced by UI_FontShutdown(), UI_GetFontByID(), UI_InitFonts(), and UI_ParseFont().