fixed font

This commit is contained in:
JuiceyDev 2026-03-06 00:34:36 +01:00
parent 1f37e1d422
commit fddd777399
3 changed files with 22 additions and 11 deletions

View file

@ -98,9 +98,17 @@ UIBitmapFont::UIBitmapFont( SFontData &sfontdata )
BufferedImage bimg(sfontdata.m_wstrFilename);
int *bimgData = bimg.getData();
if (bimgData == nullptr)
{
fprintf(stderr, "[UIBitmapFont] ERROR: failed to load font image for '%s' — font file missing or corrupt.\n",
sfontdata.m_strFontName.c_str());
m_cFontData = new CFontData(); // default/empty — avoids null deref downstream
return;
}
m_cFontData = new CFontData(sfontdata, bimgData);
//delete [] bimgData;
}

View file

@ -155,6 +155,16 @@ CFontData::CFontData(SFontData &sFontData, int *pbRawImage)
{
this->m_sFontData = &sFontData;
if (pbRawImage == nullptr)
{
// Font image failed to load; leave raw buffers null so the font renders nothing
// rather than crashing. UIBitmapFont already logs an error in this case.
m_pbRawImage = nullptr;
m_kerningTable = nullptr;
m_pfAdvanceTable = nullptr;
return;
}
// INITIALISE ALPHA CHANNEL //
// Glyph Archive (1Byte per pixel).

View file

@ -669,15 +669,8 @@ app.DebugPrintf("---ReadProductCodes()\n");
app.loadMediaArchive();
app.loadStringTable();
// Use the actual framebuffer dimensions so the UI scales to whatever
// window/fullscreen resolution was chosen at startup.
{
int uiW = 1920, uiH = 1080;
RenderManager.GetFramebufferSize(uiW, uiH);
if (uiW < 1) uiW = 1920;
if (uiH < 1) uiH = 1080;
ui.init(uiW, uiH);
}
// fuck you
ui.init(1920, 1080);
// storage manager is needed for the trial key check
StorageManager.Init(0,app.GetString(IDS_DEFAULT_SAVENAME),"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,(LPVOID)&app,"");