mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge pull request #417 from awaysoft/add_simplified_chinese_support
Add font support for chinese, japanese, korean.
This commit is contained in:
commit
e8be975f5b
Binary file not shown.
BIN
data/fonts/DejavuWenQuanYiMicroHei.ttf
Normal file
BIN
data/fonts/DejavuWenQuanYiMicroHei.ttf
Normal file
Binary file not shown.
|
@ -52,6 +52,14 @@ italian
|
|||
== Italiano
|
||||
== 380
|
||||
|
||||
japanese
|
||||
== 日本語
|
||||
== 392
|
||||
|
||||
korean
|
||||
== 한국어
|
||||
== 410
|
||||
|
||||
kyrgyz
|
||||
== Кыргызча
|
||||
== 417
|
||||
|
@ -80,6 +88,10 @@ serbian
|
|||
== Srpski
|
||||
== 688
|
||||
|
||||
simplified_chinese
|
||||
== 简体中文
|
||||
== 156
|
||||
|
||||
slovak
|
||||
== Slovensky
|
||||
== 703
|
||||
|
|
|
@ -1187,6 +1187,23 @@ void CMenus::RenderLanguageSelection(CUIRect MainView)
|
|||
{
|
||||
str_copy(g_Config.m_ClLanguagefile, s_Languages[s_SelectedLanguage].m_FileName, sizeof(g_Config.m_ClLanguagefile));
|
||||
g_Localization.Load(s_Languages[s_SelectedLanguage].m_FileName, Storage(), Console());
|
||||
|
||||
// Load Font
|
||||
static CFont *pDefaultFont = 0;
|
||||
char aFilename[512];
|
||||
const char *pFontFile = "fonts/DejaVuSansCJKName.ttf";
|
||||
if (str_find(g_Config.m_ClLanguagefile, "chinese") != NULL || str_find(g_Config.m_ClLanguagefile, "japanese") != NULL ||
|
||||
str_find(g_Config.m_ClLanguagefile, "korean") != NULL)
|
||||
pFontFile = "fonts/DejavuWenQuanYiMicroHei.ttf";
|
||||
IOHANDLE File = Storage()->OpenFile(pFontFile, IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename));
|
||||
if(File)
|
||||
{
|
||||
io_close(File);
|
||||
pDefaultFont = TextRender()->LoadFont(aFilename);
|
||||
TextRender()->SetDefaultFont(pDefaultFont);
|
||||
}
|
||||
if(!pDefaultFont)
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load font. filename='%s'", pFontFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -294,7 +294,11 @@ void CGameClient::OnInit()
|
|||
// load default font
|
||||
static CFont *pDefaultFont = 0;
|
||||
char aFilename[512];
|
||||
IOHANDLE File = Storage()->OpenFile("fonts/DejaVuSans.ttf", IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename));
|
||||
const char *pFontFile = "fonts/DejaVuSansCJKName.ttf";
|
||||
if (str_find(g_Config.m_ClLanguagefile, "chinese") != NULL || str_find(g_Config.m_ClLanguagefile, "japanese") != NULL ||
|
||||
str_find(g_Config.m_ClLanguagefile, "korean") != NULL)
|
||||
pFontFile = "fonts/DejavuWenQuanYiMicroHei.ttf";
|
||||
IOHANDLE File = Storage()->OpenFile(pFontFile, IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename));
|
||||
if(File)
|
||||
{
|
||||
io_close(File);
|
||||
|
@ -302,7 +306,7 @@ void CGameClient::OnInit()
|
|||
TextRender()->SetDefaultFont(pDefaultFont);
|
||||
}
|
||||
if(!pDefaultFont)
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load font. filename='fonts/DejaVuSans.ttf'");
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load font. filename='%s'", pFontFile);
|
||||
|
||||
// init all components
|
||||
for(int i = m_All.m_Num-1; i >= 0; --i)
|
||||
|
|
Loading…
Reference in a new issue