mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-02-17 01:31:47 +00:00
Fix font loading for x86_64
Font file sizes are always 20548 bytes, but the sizeof(struct) check doesn't work on x86_64 because of alignment. Hardcode the expected file size.
This commit is contained in:
parent
04ec1794ba
commit
052021d178
1 changed files with 4 additions and 1 deletions
|
@ -32,6 +32,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "tr_local.h"
|
||||
|
||||
#define FILESIZE_fontInfo_t (20548)
|
||||
|
||||
#ifdef BUILD_FREETYPE
|
||||
#include "../ft2/fterrors.h"
|
||||
#include "../ft2/ftsystem.h"
|
||||
|
@ -344,7 +346,7 @@ bool idRenderSystemLocal::RegisterFont( const char *fontName, fontInfoEx_t &font
|
|||
idStr::Copynz( outFont->name, name, sizeof( outFont->name ) );
|
||||
|
||||
len = fileSystem->ReadFile( name, NULL, &ftime );
|
||||
if ( len != sizeof( fontInfo_t ) ) {
|
||||
if ( len != FILESIZE_fontInfo_t ) {
|
||||
common->Warning( "RegisterFont: couldn't find font: '%s'", name );
|
||||
return false;
|
||||
}
|
||||
|
@ -513,6 +515,7 @@ bool idRenderSystemLocal::RegisterFont( const char *fontName, fontInfoEx_t &font
|
|||
memcpy( ®isteredFont[registeredFontCount++], &font, sizeof( fontInfo_t ) );
|
||||
|
||||
if ( r_saveFontData->integer ) {
|
||||
common->Warning( "FIXME: font saving doesnt respect alignment!" );
|
||||
fileSystem->WriteFile( va( "fonts/fontImage_%i.dat", pointSize), &font, sizeof( fontInfo_t ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue