Fix language fonts

This commit is contained in:
Federico Cecchetto 2022-07-15 23:07:01 +02:00
parent 48ae6bcf96
commit 1588647a9b
7 changed files with 71 additions and 16 deletions

BIN
data/fonts/chinese.ttf Normal file

Binary file not shown.

BIN
data/fonts/japanese.ttf Normal file

Binary file not shown.

BIN
data/fonts/korean.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -116,6 +116,61 @@ if (lang == 5 or lang == 6 or lang == 17) then
} }
end end
local arabicfont = RegisterFont("fonts/arabic.ttf", 30)
local koreanfont = RegisterFont("fonts/korean.ttf", 30)
local polrusfont = RegisterFont("polrus/fonts/default.otf", 30)
local japanesefont = RegisterFont("fonts/japanese.ttf", 30)
local chinesefont = RegisterFont("fonts/chinese.ttf", 30)
local function setchinesefont(lang)
if (lang ~= CoD.Language.Traditional_chinese and lang ~= CoD.Language.Simplified_chinese) then
return
end
LUI.MenuGenericButtons.ButtonLabelFont.Font = chinesefont
LUI.MenuGenericButtons.ButtonLabelFont.Height = 22
overrideyoffset = 1
end
local function setjapanesefont(lang)
if (lang ~= CoD.Language.Japanese_full and lang ~= CoD.Language.Japanese_partial) then
return
end
LUI.MenuGenericButtons.ButtonLabelFont.Font = japanesefont
LUI.MenuGenericButtons.ButtonLabelFont.Height = 18
overrideyoffset = 1
end
local function setkoreanfont(lang)
if (lang ~= CoD.Language.Korean) then
return
end
LUI.MenuGenericButtons.ButtonLabelFont.Font = koreanfont
LUI.MenuGenericButtons.ButtonLabelFont.Height = 25
overrideyoffset = 1
end
local function setarabicfont(lang)
if (lang ~= CoD.Language.Arabic) then
return
end
LUI.MenuGenericButtons.ButtonLabelFont.Font = arabicfont
LUI.MenuGenericButtons.ButtonLabelFont.Height = 28
overrideyoffset = 0
end
local function setpolrusfont(lang)
if (lang ~= CoD.Language.Russian and lang ~= CoD.Language.Russian_partial and lang ~= CoD.Language.Polish) then
return
end
LUI.MenuGenericButtons.ButtonLabelFont.Font = polrusfont
overrideyoffset = nil
end
LUI.MenuBuilder.registerType("choose_language_menu", function(a1) LUI.MenuBuilder.registerType("choose_language_menu", function(a1)
local menu = LUI.MenuTemplate.new(a1, { local menu = LUI.MenuTemplate.new(a1, {
menu_title = "@LUA_MENU_CHOOSE_LANGUAGE", menu_title = "@LUA_MENU_CHOOSE_LANGUAGE",
@ -131,22 +186,22 @@ LUI.MenuBuilder.registerType("choose_language_menu", function(a1)
local prevheight = LUI.MenuGenericButtons.ButtonLabelFont.Height local prevheight = LUI.MenuGenericButtons.ButtonLabelFont.Height
local id = languages[i].id local id = languages[i].id
if (not usingspeciallanguage()) then local lang = Engine.GetCurrentLanguage()
if (id == 5 or id == 6 or id == 17) then
LUI.MenuGenericButtons.ButtonLabelFont.Font = RegisterFont("polrus/fonts/default.otf", 30) if (lang == CoD.Language.Traditional_chinese or lang == CoD.Language.Simplified_chinese) then
elseif (id >= 8 and id < 12) then setjapanesefont(id)
LUI.MenuGenericButtons.ButtonLabelFont.Font = RegisterFont("fonts/noto_sans_sc.otf", 30) setkoreanfont(id)
overrideyoffset = 0 setarabicfont(id)
LUI.MenuGenericButtons.ButtonLabelFont.Height = 17 elseif (lang == CoD.Language.Japanese_full or lang == CoD.Language.Japanese_partial) then
elseif (id == 12) then setchinesefont(id)
LUI.MenuGenericButtons.ButtonLabelFont.Font = RegisterFont("fonts/noto_sans_arabic.ttf", 30) setkoreanfont(id)
LUI.MenuGenericButtons.ButtonLabelFont.Height = 28 setarabicfont(id)
overrideyoffset = 0 elseif (lang ~= CoD.Language.Arabic and lang ~= CoD.Language.Korean) then
elseif (id == 15) then setpolrusfont(id)
LUI.MenuGenericButtons.ButtonLabelFont.Font = RegisterFont("fonts/noto_sans_kr.otf", 30) setchinesefont(id)
LUI.MenuGenericButtons.ButtonLabelFont.Height = 18 setjapanesefont(id)
overrideyoffset = 0 setkoreanfont(id)
end setarabicfont(id)
end end
local button = menu:AddButton("", function() local button = menu:AddButton("", function()