mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-11 00:48:08 +00:00
fixed font
This commit is contained in:
parent
1f37e1d422
commit
fddd777399
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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,"");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue