UFO: Alien Invasion
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"
Include dependency graph for ui_font.cpp:

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

◆ MAX_FONTS

#define MAX_FONTS   16

Definition at line 34 of file ui_font.cpp.

Function Documentation

◆ UI_FontGetHeight()

◆ UI_FontShutdown()

void UI_FontShutdown ( void  )

Definition at line 184 of file ui_font.cpp.

References numFonts.

Referenced by UI_Shutdown().

◆ UI_GetFontByID()

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 fonts, i, name, numFonts, and Q_streq.

Referenced by UI_DrawString(), and UI_ParseFont().

◆ UI_GetFontFromNode()

◆ UI_InitFonts()

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(), fonts, i, numFonts, and UI_RegisterFont().

Referenced by CL_NewLanguage(), and UI_Reinit().

◆ UI_ParseFont()

◆ UI_RegisterFont()

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_t::name, uiFont_t::path, R_FontRegister(), uiFont_t::size, and uiFont_t::style.

Referenced by UI_InitFonts(), and UI_ParseFont().

Variable Documentation

◆ fonts

uiFont_t fonts[MAX_FONTS]
static

Definition at line 36 of file ui_font.cpp.

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

◆ fontValues

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}
}
voidpf void uLong size
Definition: ioapi.h:42
@ V_TRANSLATION_STRING
Definition: scripts.h:59
@ V_HUNK_STRING
Definition: scripts.h:69
@ V_NULL
Definition: scripts.h:49
@ V_INT
Definition: scripts.h:52
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34

Definition at line 38 of file ui_font.cpp.

Referenced by UI_ParseFont().

◆ numFonts

int numFonts = 0
static

Definition at line 35 of file ui_font.cpp.

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