mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-08-20 09:57:10 +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);
|
BufferedImage bimg(sfontdata.m_wstrFilename);
|
||||||
int *bimgData = bimg.getData();
|
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);
|
m_cFontData = new CFontData(sfontdata, bimgData);
|
||||||
|
|
||||||
//delete [] bimgData;
|
//delete [] bimgData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,16 @@ CFontData::CFontData(SFontData &sFontData, int *pbRawImage)
|
||||||
{
|
{
|
||||||
this->m_sFontData = &sFontData;
|
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 //
|
// INITIALISE ALPHA CHANNEL //
|
||||||
|
|
||||||
// Glyph Archive (1Byte per pixel).
|
// Glyph Archive (1Byte per pixel).
|
||||||
|
|
|
||||||
|
|
@ -669,15 +669,8 @@ app.DebugPrintf("---ReadProductCodes()\n");
|
||||||
|
|
||||||
app.loadMediaArchive();
|
app.loadMediaArchive();
|
||||||
app.loadStringTable();
|
app.loadStringTable();
|
||||||
// Use the actual framebuffer dimensions so the UI scales to whatever
|
// fuck you
|
||||||
// window/fullscreen resolution was chosen at startup.
|
ui.init(1920, 1080);
|
||||||
{
|
|
||||||
int uiW = 1920, uiH = 1080;
|
|
||||||
RenderManager.GetFramebufferSize(uiW, uiH);
|
|
||||||
if (uiW < 1) uiW = 1920;
|
|
||||||
if (uiH < 1) uiH = 1080;
|
|
||||||
ui.init(uiW, uiH);
|
|
||||||
}
|
|
||||||
// storage manager is needed for the trial key check
|
// 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,"");
|
StorageManager.Init(0,app.GetString(IDS_DEFAULT_SAVENAME),"savegame.dat",FIFTY_ONE_MB,&CConsoleMinecraftApp::DisplaySavingMessage,(LPVOID)&app,"");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue