Skip to content

Commit

Permalink
Fonts|Resources|Client: Fixed BitmapFont::glInit() and "runtime" font…
Browse files Browse the repository at this point in the history
… scheme clearing
  • Loading branch information
danij-deng committed Nov 15, 2013
1 parent bf96265 commit 7597bce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions doomsday/client/src/resource/bitmapfont.cpp
Expand Up @@ -265,16 +265,17 @@ Rectanglei const &BitmapFont::glyphTexCoords(uchar ch)

void BitmapFont::glInit()
{
if(d->texGLName) return; // Already prepared.
if(!d->needGLInit) return;
if(novideo || isDedicated || BusyMode_Active()) return;

glDeinit();

try
{
// Relative paths are relative to the native working directory.
String path = (NativePath::workPath() / NativePath(d->filePath).expand()).withSeparators('/');
de::FileHandle *hndl = &App_FileSystem().openFile(path, "rb");

glDeinit();

// Load the font glyph map from the file.
int version = inByte(hndl);

Expand Down Expand Up @@ -308,6 +309,8 @@ void BitmapFont::glInit()
}
catch(FS1::NotFoundError const&)
{} // Ignore error.

d->needGLInit = false;
}

void BitmapFont::glDeinit()
Expand All @@ -316,6 +319,7 @@ void BitmapFont::glDeinit()

d->needGLInit = true;
if(BusyMode_Active()) return;

if(d->texGLName)
{
glDeleteTextures(1, (GLuint const *) &d->texGLName);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/resource/resourcesystem.cpp
Expand Up @@ -982,7 +982,7 @@ Fonts &ResourceSystem::fonts()

void ResourceSystem::clearRuntimeFontSchemes()
{
d->fonts.scheme("Flats").clear();
d->fonts.scheme("Game").clear();
}

void ResourceSystem::clearSystemFontSchemes()
Expand Down

0 comments on commit 7597bce

Please sign in to comment.