mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Add japanese condensed font
This commit is contained in:
parent
d8926c347b
commit
66caa896b9
|
@ -1081,6 +1081,7 @@ set(EXPECTED_DATA
|
|||
emoticons.png
|
||||
file_icons.png
|
||||
fonts/DejaVuSans.ttf
|
||||
fonts/GlowSansJCompressed-Book.otf
|
||||
fonts/Icons.ttf
|
||||
fonts/SourceHanSansSC-Regular.otf
|
||||
game.png
|
||||
|
|
BIN
data/fonts/GlowSansJCompressed-Book.otf
Normal file
BIN
data/fonts/GlowSansJCompressed-Book.otf
Normal file
Binary file not shown.
|
@ -4056,8 +4056,13 @@ void CClient::LoadFont()
|
|||
static CFont *pDefaultFont = 0;
|
||||
static bool LoadedFallbackFont = false;
|
||||
char aFilename[512];
|
||||
char aBuff[1024];
|
||||
const char *pFontFile = "fonts/DejaVuSans.ttf";
|
||||
const char *pFallbackFontFile = "fonts/SourceHanSansSC-Regular.otf";
|
||||
const char *apFallbackFontFiles[] =
|
||||
{
|
||||
"fonts/GlowSansJCompressed-Book.otf",
|
||||
"fonts/SourceHanSansSC-Regular.otf",
|
||||
};
|
||||
IOHANDLE File = Storage()->OpenFile(pFontFile, IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename));
|
||||
if(File)
|
||||
{
|
||||
|
@ -4070,6 +4075,9 @@ void CClient::LoadFont()
|
|||
if(pDefaultFont == NULL)
|
||||
pDefaultFont = pTextRender->LoadFont(aFilename, pBuf, Size);
|
||||
|
||||
for(auto &pFallbackFontFile : apFallbackFontFiles)
|
||||
{
|
||||
bool FontLoaded = false;
|
||||
File = Storage()->OpenFile(pFallbackFontFile, IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename));
|
||||
if(File)
|
||||
{
|
||||
|
@ -4078,25 +4086,25 @@ void CClient::LoadFont()
|
|||
io_read(File, pBuf, Size);
|
||||
io_close(File);
|
||||
IEngineTextRender *pTextRender = Kernel()->RequestInterface<IEngineTextRender>();
|
||||
LoadedFallbackFont = pTextRender->LoadFallbackFont(pDefaultFont, aFilename, pBuf, Size);
|
||||
FontLoaded = pTextRender->LoadFallbackFont(pDefaultFont, aFilename, pBuf, Size);
|
||||
}
|
||||
LoadedFallbackFont |= FontLoaded;
|
||||
|
||||
if(!FontLoaded)
|
||||
{
|
||||
str_format(aBuff, sizeof(aBuff) / sizeof(aBuff[0]), "failed to load the fallback font. filename='%s'", pFallbackFontFile);
|
||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", aBuff);
|
||||
}
|
||||
}
|
||||
|
||||
Kernel()->RequestInterface<IEngineTextRender>()->SetDefaultFont(pDefaultFont);
|
||||
}
|
||||
|
||||
char aBuff[1024];
|
||||
|
||||
if(!pDefaultFont)
|
||||
{
|
||||
str_format(aBuff, sizeof(aBuff) / sizeof(aBuff[0]), "failed to load font. filename='%s'", pFontFile);
|
||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", aBuff);
|
||||
}
|
||||
|
||||
if(!LoadedFallbackFont)
|
||||
{
|
||||
str_format(aBuff, sizeof(aBuff) / sizeof(aBuff[0]), "failed to load the fallback font. filename='%s'", pFallbackFontFile);
|
||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", aBuff);
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::Notify(const char *pTitle, const char *pMessage)
|
||||
|
|
Loading…
Reference in a new issue