Skip to content

Commit

Permalink
Simplify the font handling.
Browse files Browse the repository at this point in the history
Now all the fonts are kept in memory all the time. The shuffling of the fixed and normal variable fonts was causing mix-ups.
  • Loading branch information
skyjake committed Feb 19, 2009
1 parent 6e9a55d commit 5d93997
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions doomsday/engine/portable/include/gl_main.h
Expand Up @@ -70,8 +70,8 @@ void GL_BlendMode(blendmode_t mode);
void GL_InitRefresh(void);
void GL_ShutdownRefresh(void);
void GL_UseFog(int yes);
void GL_InitVarFont(void);
void GL_ShutdownVarFont(void);
//void GL_InitVarFont(void);
//void GL_ShutdownVarFont(void);
const char* GL_ChooseFixedFont(void);
const char* GL_ChooseVariableFont(glfontstyle_t style, int resX, int resY);
void GL_ActiveTexture(const GLenum texture);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/dd_main.c
Expand Up @@ -828,7 +828,7 @@ void DD_UpdateEngineState(void)
Demo_StopPlayback();
S_Reset();

GL_InitVarFont();
//GL_InitVarFont();

/*glMatrixMode(GL_PROJECTION);
glPushMatrix();
Expand All @@ -849,7 +849,7 @@ void DD_UpdateEngineState(void)
| (verbose? BUSYF_CONSOLE_OUTPUT : 0), "Updating engine state...",
DD_UpdateWorker, NULL);

GL_ShutdownVarFont();
//GL_ShutdownVarFont();

/*glMatrixMode(GL_PROJECTION);
glPopMatrix();*/
Expand Down
33 changes: 19 additions & 14 deletions doomsday/engine/portable/src/gl_main.c
Expand Up @@ -438,13 +438,13 @@ void GL_InitFont(void)
{
FR_Init();
FR_PrepareFont(GL_ChooseFixedFont());
glFontFixed =
glFontVariable[GLFS_NORMAL] =
glFontVariable[GLFS_LIGHT] = FR_GetCurrent();
glFontFixed = FR_GetCurrent();

Con_SetMaxLineLength();

// Also keep the bold and light fonts loaded.
FR_PrepareFont(GL_ChooseVariableFont(GLFS_NORMAL, theWindow->width, theWindow->height));
glFontVariable[GLFS_NORMAL] = FR_GetCurrent();

FR_PrepareFont(GL_ChooseVariableFont(GLFS_BOLD, theWindow->width, theWindow->height));
glFontVariable[GLFS_BOLD] = FR_GetCurrent();

Expand All @@ -471,14 +471,16 @@ void GL_ShutdownFont(void)
glFontVariable[GLFS_LIGHT] = 0;
}

#if 0
void GL_InitVarFont(void)
{
int oldFont;
int i;
//int i;

if(novideo || varFontInited)
if(novideo) //|| varFontInited)
return;

/*
VERBOSE2(Con_Message("GL_InitVarFont.\n"));
oldFont = FR_GetCurrent();
Expand All @@ -498,18 +500,19 @@ void GL_InitVarFont(void)
FR_SetFont(oldFont);
VERBOSE2(Con_Message("GL_InitVarFont: Restored old font %i.\n", oldFont));

varFontInited = true;
*/
//varFontInited = true;
}

void GL_ShutdownVarFont(void)
{
int i;
// int i;

if(novideo || !varFontInited)
if(novideo) // || !varFontInited)
return;

FR_SetFont(glFontFixed);
//FR_SetFont(glFontFixed);
/*
for(i = 0; i < NUM_GLFS; ++i)
{
// Keep the bold and light fonts loaded.
Expand All @@ -519,8 +522,10 @@ void GL_ShutdownVarFont(void)
FR_DestroyFont(glFontVariable[i]);
glFontVariable[i] = glFontFixed;
}
varFontInited = false;
*/
//varFontInited = false;
}
#endif

/**
* One-time initialization of DGL and the renderer. This is done very early
Expand Down Expand Up @@ -856,7 +861,7 @@ void GL_TotalReset(void)
if(isDedicated)
return;

GL_ShutdownVarFont();
//GL_ShutdownVarFont();

// Update the secondary title and the game status.
Con_InitUI();
Expand All @@ -882,7 +887,7 @@ void GL_TotalRestore(void)
// Getting back up and running.
GL_ReserveNames();
GL_InitFont();
GL_InitVarFont();
//GL_InitVarFont();
GL_Init2DState();
GL_InitPalette();

Expand Down
6 changes: 1 addition & 5 deletions doomsday/engine/portable/src/ui_main.c
Expand Up @@ -164,9 +164,6 @@ void UI_Init(boolean halttime, boolean tckui, boolean tckframe, boolean drwgame,
gameDrawHUD = false;
I_SetUIMouseMode(true);

// Setup state.
GL_InitVarFont();

// Change font.
FR_SetFont(glFontVariable[GLFS_NORMAL]);
uiFontHgt = FR_TextHeight("W");
Expand Down Expand Up @@ -199,8 +196,7 @@ void UI_End(void)
// Restore full alpha.
uiAlpha = uiTargetAlpha = 1.0;

// Restore old state.
GL_ShutdownVarFont();
FR_SetFont(glFontFixed);

// Update the secondary title and the game status.
Con_InitUI();
Expand Down

0 comments on commit 5d93997

Please sign in to comment.