From 72eda99c6533f2529e8bb44e0681e2da4913363f Mon Sep 17 00:00:00 2001 From: Vlad Loktionov Date: Fri, 24 Feb 2023 05:52:55 +0300 Subject: [PATCH 1/2] Fonts/localizations: refinements * Use font replacements from csv * Add 'Apply built-in fonts' button for languages with fallback fonts * Arabic localization: Workaround for forced RTL text conversion * Czech localization: Fixes * Russian Partial localization: Fix Y offset in built-in fonts --- data/cdata/ui_scripts/settings/language.lua | 236 ++++++++++-------- data/zone_source/h2_mod_pre_gfx.csv | 5 + .../h2_mod_pre_gfx/font_replacements.csv | 23 ++ .../ibmplexsansarabic-semibold_custom.ttf} | Bin .../h2_mod_pre_gfx/fonts/mix.ttf} | Bin .../h2_mod_pre_gfx/fonts/mix_gothic.ttf} | Bin .../h2_mod_pre_gfx/fonts/mix_open.ttf} | Bin data/zonetool/localizedstrings/arabic.json | 42 ++-- data/zonetool/localizedstrings/czech.json | 10 +- data/zonetool/localizedstrings/english.json | 4 +- data/zonetool/localizedstrings/french.json | 2 + data/zonetool/localizedstrings/german.json | 2 + data/zonetool/localizedstrings/italian.json | 2 + .../localizedstrings/japanese_full.json | 2 + .../localizedstrings/japenese_partial.json | 2 + data/zonetool/localizedstrings/korean.json | 2 + data/zonetool/localizedstrings/polish.json | 2 + .../zonetool/localizedstrings/portuguese.json | 2 + data/zonetool/localizedstrings/russian.json | 2 + .../localizedstrings/russian_partial.json | 2 + .../localizedstrings/simplified_chinese.json | 2 + data/zonetool/localizedstrings/spanish.json | 2 + data/zonetool/localizedstrings/spanishna.json | 2 + .../localizedstrings/traditional_chinese.json | 2 + src/client/component/config.cpp | 1 + src/client/component/fonts.cpp | 6 + src/client/component/ui_scripting.cpp | 8 + 27 files changed, 239 insertions(+), 124 deletions(-) create mode 100644 data/zone_source/h2_mod_pre_gfx.csv create mode 100644 data/zonetool/h2_mod_pre_gfx/font_replacements.csv rename data/{cdata/arabic/fonts/defaultBold.otf => zonetool/h2_mod_pre_gfx/fonts/ibmplexsansarabic-semibold_custom.ttf} (100%) rename data/{cdata/fallback/fonts/default.otf => zonetool/h2_mod_pre_gfx/fonts/mix.ttf} (100%) rename data/{cdata/polrus/fonts/bank.ttf => zonetool/h2_mod_pre_gfx/fonts/mix_gothic.ttf} (100%) rename data/{cdata/fallback/fonts/defaultBold.otf => zonetool/h2_mod_pre_gfx/fonts/mix_open.ttf} (100%) diff --git a/data/cdata/ui_scripts/settings/language.lua b/data/cdata/ui_scripts/settings/language.lua index aebab5ed..b5af4f43 100644 --- a/data/cdata/ui_scripts/settings/language.lua +++ b/data/cdata/ui_scripts/settings/language.lua @@ -10,129 +10,169 @@ game:addlocalizedstring("MENU_japanese_full", "日本語") game:addlocalizedstring("MENU_japanese_partial", "日本語(一部)") game:addlocalizedstring("MENU_traditional_chinese", "繁體中文") game:addlocalizedstring("MENU_simplified_chinese", "简体中文") -game:addlocalizedstring("MENU_arabic", "العربية") -game:addlocalizedstring("MENU_czech", "České") +game:addlocalizedstring("MENU_arabic", "ةيبرعلا") +game:addlocalizedstring("MENU_czech", "Čeština") -- text only (English dubbing) game:addlocalizedstring("MENU_spanishna", "Español (América Latina)") -- text only (English dubbing) game:addlocalizedstring("MENU_korean", "한국어") game:addlocalizedstring("MENU_english_safe", "English (Safe)") game:addlocalizedstring("MENU_russian_partial", "Русский (Англ. озвучка)") -- text only (English dubbing) LUI.addmenubutton("pc_controls", { - index = 4, - text = "@LUA_MENU_CHOOSE_LANGUAGE", - description = Engine.Localize("@LUA_MENU_CHOOSE_LANGUAGE_DESC"), - callback = function() - LUI.FlowManager.RequestAddMenu(nil, "choose_language_menu") - end + index = 4, + text = "@LUA_MENU_CHOOSE_LANGUAGE", + description = Engine.Localize("@LUA_MENU_CHOOSE_LANGUAGE_DESC"), + callback = function() + LUI.FlowManager.RequestAddMenu(nil, "choose_language_menu") + end }) -local universalfont = RegisterFont("fallback/fonts/default.otf", 30) +local universalfont = RegisterFont("fonts/mix.ttf", 30) local function setuniversalfont(lang) - LUI.MenuGenericButtons.ButtonLabelFont.Font = universalfont + LUI.MenuGenericButtons.ButtonLabelFont.Font = universalfont +end + +local function togglecustomfonts() + LUI.FlowManager.RequestAddMenu(nil, "generic_yesno_popup", false, nil, true, { + popup_title = Engine.Localize("@MENU_CCS_RESTART_CONFIRMATION_TITLE"), + message_text = Engine.Localize("@MENU_HDR_REBOOT_DESC"), + yes_action = function() + config.set("disable_custom_fonts", not config.get("disable_custom_fonts")) + updater.relaunch() + end + }) end LUI.MenuBuilder.registerType("choose_language_menu", function(a1) - local menu = LUI.MenuTemplate.new(a1, { - menu_title = "@LUA_MENU_CHOOSE_LANGUAGE", - menu_list_divider_top_offset = -(LUI.H1MenuTab.tabChangeHoldingElementHeight + H1MenuDims.spacing), - menu_width = 240, - uppercase_title = true - }) + local menu = LUI.MenuTemplate.new(a1, { + menu_title = "@LUA_MENU_CHOOSE_LANGUAGE", + menu_list_divider_top_offset = -(LUI.H1MenuTab.tabChangeHoldingElementHeight + H1MenuDims.spacing), + menu_width = 240, + uppercase_title = true + }) - local languages = Engine.GetSupportedLanguages() - local originalfont = LUI.MenuGenericButtons.ButtonLabelFont.Font + local languages = Engine.GetSupportedLanguages() + local originalfont = LUI.MenuGenericButtons.ButtonLabelFont.Font - for i = 1, #languages do - local id = languages[i].id + for i = 1, #languages do + local id = languages[i].id - local lang = Engine.GetCurrentLanguage() + local lang = Engine.GetCurrentLanguage() - setuniversalfont(id) - - local button = menu:AddButton("", function() - LUI.FlowManager.RequestAddMenu(nil, "choose_language_confirm_popup", false, nil, true, { - language = languages[i].id - }) - end, languages[i].id == Engine.GetCurrentLanguage(), true, nil, { - desc_text = Engine.Localize("LOCALE_" .. (languages[i].id)) - }) + if language.isasian or not language.isnonlatin() or not config.get("disable_custom_fonts") then + setuniversalfont(id) + end - local label = button:getFirstDescendentById("text_label") - label:setText(Engine.ToUpperCase(languages[i].name)) - end + local button = menu:AddButton("", function() + LUI.FlowManager.RequestAddMenu(nil, "choose_language_confirm_popup", false, nil, true, { + language = languages[i].id + }) + end, languages[i].id == lang, true, nil, { + desc_text = Engine.Localize("LOCALE_" .. (languages[i].id)) + }) - LUI.MenuGenericButtons.ButtonLabelFont.Font = originalfont + local label = button:getFirstDescendentById("text_label") + label:setText(Engine.ToUpperCase(languages[i].name)) + end - LUI.Options.InitScrollingList(menu.list, nil, { - rows = 10 - }) + LUI.MenuGenericButtons.ButtonLabelFont.Font = originalfont - LUI.Options.AddOptionTextInfo(menu) - menu:AddBackButton() + LUI.Options.InitScrollingList(menu.list, nil, { + rows = 10 + }) - return menu + LUI.Options.AddOptionTextInfo(menu) + + if language.isnonlatin() and config.get("language") ~= "czech" then + if (config.get("disable_custom_fonts")) then + menu:AddHelp({ + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize("@LUA_MENU_FALLBACK_ENABLE"), + side = "right", + clickable = true + }, togglecustomfonts) + else + menu:AddHelp({ + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize("@LUA_MENU_FALLBACK_DISABLE"), + side = "right", + clickable = true + }, togglecustomfonts) + end + end + + menu:AddBackButton() + + return menu end) --- global patch -LUI.UIButtonText.IsOffsetedLanguage = function() - return false +-- rup patch +if config.get("language") == "russian_partial" and config.get("disable_custom_fonts") then + LUI.UIButtonText.IsOffsetedLanguage = function() + return true + end end --- pol/rus patch +if not (config.get("disable_custom_fonts")) then + -- global patch + LUI.UIButtonText.IsOffsetedLanguage = function() + return false + end -if (not Engine.InFrontend()) then - local weaponinfodef = LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"] - LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"] = function(...) - local rus = CoD.Language.Russian - CoD.Language.Russian = 1337 - local pol = CoD.Language.Polish - CoD.Language.Polish = 1338 - local res = weaponinfodef(...) - CoD.Language.Russian = rus - CoD.Language.Polish = pol - return res - end -else - local levelselectmenu = LUI.sp_menus.LevelSelectMenu - local setupinfobox = levelselectmenu.SetupInfoBoxLeftForArcadeMode - levelselectmenu.SetupInfoBoxLeftForArcadeMode = function(...) - local rus = CoD.Language.Russian - CoD.Language.Russian = 1337 - local pol = CoD.Language.Polish - CoD.Language.Polish = 1338 - local res = setupinfobox(...) - CoD.Language.Russian = rus - CoD.Language.Polish = pol - return res - end -end - --- ara/ces/pol/rus patch - -local lang = Engine.GetCurrentLanguage() -if (lang == 5 or lang == 6 or lang == 12 or lang == 13 or lang == 17) then - local scale = function (size) - return size * 720 / 1080 - end - - CoD.TextSettings.SP_HudAmmoStatusText = { - Font = RegisterFont("fonts/bank.ttf", 16), - Height = 16 - } - - CoD.TextSettings.SP_HudAmmoCounterFont = { - Font = RegisterFont("fonts/bank.ttf", 34), - Height = 34 - } - - CoD.TextSettings.HudAmmoCounterFont = { - Font = RegisterFont("fonts/bank.ttf", 105), - Height = 64 - } - - CoD.TextSettings.H2TitleFont = { - Font = RegisterFont("fonts/bank.ttf", 56), - Height = scale(56) - } + -- pol/rus patch + if not Engine.InFrontend() then + local weaponinfodef = LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"] + LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"] = function(...) + local rus = CoD.Language.Russian + CoD.Language.Russian = 1337 + local pol = CoD.Language.Polish + CoD.Language.Polish = 1338 + local res = weaponinfodef(...) + CoD.Language.Russian = rus + CoD.Language.Polish = pol + return res + end + else + local levelselectmenu = LUI.sp_menus.LevelSelectMenu + local setupinfobox = levelselectmenu.SetupInfoBoxLeftForArcadeMode + levelselectmenu.SetupInfoBoxLeftForArcadeMode = function(...) + local rus = CoD.Language.Russian + CoD.Language.Russian = 1337 + local pol = CoD.Language.Polish + CoD.Language.Polish = 1338 + local res = setupinfobox(...) + CoD.Language.Russian = rus + CoD.Language.Polish = pol + return res + end + end + + -- ara/pol/rus patch + if language.ispolrus() or language.isarabic() then + local scale = function(size) + return size * 720 / 1080 + end + + CoD.TextSettings.SP_HudAmmoStatusText = { + Font = RegisterFont("fonts/mix_gothic.ttf", 16), + Height = 16 + } + + CoD.TextSettings.SP_HudAmmoCounterFont = { + Font = RegisterFont("fonts/mix_gothic.ttf", 34), + Height = 34 + } + + CoD.TextSettings.HudAmmoCounterFont = { + Font = RegisterFont("fonts/mix_gothic.ttf", 105), + Height = 64 + } + + CoD.TextSettings.H2TitleFont = { + Font = RegisterFont("fonts/mix_gothic.ttf", 56), + Height = scale(56) + } + end end diff --git a/data/zone_source/h2_mod_pre_gfx.csv b/data/zone_source/h2_mod_pre_gfx.csv new file mode 100644 index 00000000..d460b0f6 --- /dev/null +++ b/data/zone_source/h2_mod_pre_gfx.csv @@ -0,0 +1,5 @@ +stringtable,font_replacements.csv +ttf,fonts/ibmplexsansarabic-semibold_custom.ttf +ttf,fonts/mix.ttf +ttf,fonts/mix_gothic.ttf +ttf,fonts/mix_open.ttf \ No newline at end of file diff --git a/data/zonetool/h2_mod_pre_gfx/font_replacements.csv b/data/zonetool/h2_mod_pre_gfx/font_replacements.csv new file mode 100644 index 00000000..74fe68d4 --- /dev/null +++ b/data/zonetool/h2_mod_pre_gfx/font_replacements.csv @@ -0,0 +1,23 @@ +arabic,fonts/bank.ttf,fonts/mix_gothic.ttf, +arabic,fonts/default.otf,fonts/mix.ttf, +arabic,fonts/defaultBold.otf,fonts/ibmplexsansarabic-semibold_custom.ttf, +czech,fonts/bank.ttf,fonts/mix_gothic.ttf, +czech,fonts/default.otf,fonts/mix.ttf, +czech,fonts/defaultBold.otf,fonts/mix_open.ttf, +japanese_full,fonts/default.otf,fonts/mix.ttf, +japanese_full,fonts/defaultBold.otf,fonts/mix_open.ttf, +japanese_partial,fonts/default.otf,fonts/mix.ttf, +japanese_partial,fonts/defaultBold.otf,fonts/mix_open.ttf, +polish,fonts/bank.ttf,fonts/mix_gothic.ttf, +polish,fonts/default.otf,fonts/mix.ttf, +polish,fonts/defaultBold.otf,fonts/mix_open.ttf, +russian,fonts/bank.ttf,fonts/mix_gothic.ttf, +russian,fonts/default.otf,fonts/mix.ttf, +russian,fonts/defaultBold.otf,fonts/mix_open.ttf, +russian_partial,fonts/bank.ttf,fonts/mix_gothic.ttf, +russian_partial,fonts/default.otf,fonts/mix.ttf, +russian_partial,fonts/defaultBold.otf,fonts/mix_open.ttf, +simplified_chinese,fonts/default.otf,fonts/mix.ttf, +simplified_chinese,fonts/defaultBold.otf,fonts/mix_open.ttf, +traditional_chinese,fonts/default.otf,fonts/mix.ttf, +traditional_chinese,fonts/defaultBold.otf,fonts/mix_open.ttf, \ No newline at end of file diff --git a/data/cdata/arabic/fonts/defaultBold.otf b/data/zonetool/h2_mod_pre_gfx/fonts/ibmplexsansarabic-semibold_custom.ttf similarity index 100% rename from data/cdata/arabic/fonts/defaultBold.otf rename to data/zonetool/h2_mod_pre_gfx/fonts/ibmplexsansarabic-semibold_custom.ttf diff --git a/data/cdata/fallback/fonts/default.otf b/data/zonetool/h2_mod_pre_gfx/fonts/mix.ttf similarity index 100% rename from data/cdata/fallback/fonts/default.otf rename to data/zonetool/h2_mod_pre_gfx/fonts/mix.ttf diff --git a/data/cdata/polrus/fonts/bank.ttf b/data/zonetool/h2_mod_pre_gfx/fonts/mix_gothic.ttf similarity index 100% rename from data/cdata/polrus/fonts/bank.ttf rename to data/zonetool/h2_mod_pre_gfx/fonts/mix_gothic.ttf diff --git a/data/cdata/fallback/fonts/defaultBold.otf b/data/zonetool/h2_mod_pre_gfx/fonts/mix_open.ttf similarity index 100% rename from data/cdata/fallback/fonts/defaultBold.otf rename to data/zonetool/h2_mod_pre_gfx/fonts/mix_open.ttf diff --git a/data/zonetool/localizedstrings/arabic.json b/data/zonetool/localizedstrings/arabic.json index bee5affd..0c838621 100644 --- a/data/zonetool/localizedstrings/arabic.json +++ b/data/zonetool/localizedstrings/arabic.json @@ -1,23 +1,25 @@ { - "LOCALE_0": "إنجليزي", - "LOCALE_1": "فرنسي", - "LOCALE_2": "ألمانية", - "LOCALE_3": "إيطالي", - "LOCALE_4": "الأسبانية", - "LOCALE_5": "الروسية", - "LOCALE_6": "تلميع", - "LOCALE_7": "البرتغالية", - "LOCALE_8": "اليابانية", - "LOCALE_9": "الياباني (جزئي)", - "LOCALE_10": "الصينية التقليدية", - "LOCALE_11": "الصينية المبسطة", - "LOCALE_12": "عربي", - "LOCALE_13": "التشيكية", - "LOCALE_14": "الإسبانية (أمريكا اللاتينية)", - "LOCALE_15": "الكورية", - "LOCALE_16": "اللغة الإنجليزية (آمنة)", - "LOCALE_17": "(جزئي) الروسية", + "LOCALE_0": "يزيلجنإ", + "LOCALE_1": "يسنرف", + "LOCALE_2": "ةيناملأ", + "LOCALE_3": "يلاطيإ", + "LOCALE_4": "ةينابسألا", + "LOCALE_5": "ةيسورلا", + "LOCALE_6": "عيملت", + "LOCALE_7": "ةيلاغتربلا", + "LOCALE_8": "ةينابايلا", + "LOCALE_9": ")يئزج( ينابايلا", + "LOCALE_10": "ةيديلقتلا ةينيصلا", + "LOCALE_11": "ةطسبملا ةينيصلا", + "LOCALE_12": "يبرع", + "LOCALE_13": "ةيكيشتلا", + "LOCALE_14": ")ةينيتاللا اكيرمأ( ةينابسإلا", + "LOCALE_15": "ةيروكلا", + "LOCALE_16": ")ةنمآ( ةيزيلجنإلا ةغللا", + "LOCALE_17": "ةيسورلا )يئزج(", + "LUA_MENU_FALLBACK_DISABLE": "ةيئدبملا طوطخلا عجرتسا", + "LUA_MENU_FALLBACK_ENABLE": "ةصّصخم طوطخ مدختسا", - "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": ".ﻡﺎﻬﻤﻟﺍ ﻊﻴﻤﺟ ﺢﺘﻓ", - "LUA_MENU_CANCEL_UNLOCK_CAPS": "ﺢﺘﻔﻟﺍ ءﺎﻐﻟﺇ" + "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "ﻓﺘﺢ ﺟﻤﻴﻊ ﺍﻟﻤﻬﺎﻡ.", + "LUA_MENU_CANCEL_UNLOCK_CAPS": "ﺇﻟﻐﺎء ﺍﻟﻔﺘﺢ" } \ No newline at end of file diff --git a/data/zonetool/localizedstrings/czech.json b/data/zonetool/localizedstrings/czech.json index 18d89cfa..12329821 100644 --- a/data/zonetool/localizedstrings/czech.json +++ b/data/zonetool/localizedstrings/czech.json @@ -17,6 +17,8 @@ "LOCALE_15": "Korejština", "LOCALE_16": "Angličtina (bezrizikový)", "LOCALE_17": "Ruština (částečně)", + "LUA_MENU_FALLBACK_DISABLE": "Používat výchozí písma", + "LUA_MENU_FALLBACK_ENABLE": "Používat písma h2-mod", "PRESENCE_SP_AF_CAVES": "Jako za starých časů", "PRESENCE_SP_AF_CAVES_SYSTEM_DIALOG": "Jako za starých časů", "MENU_SP_AF_CAVES": "Jako za starých časů", @@ -210,7 +212,6 @@ "CONTINGENCY_LINE3": "Sgt. Gary 'Roach' Sanderson", "CONTINGENCY_LINE4": "Task Force 141", "CONTINGENCY_LINE5": "14 mil SV od Petropavlovska, Rusko", - "CONTINGENCY_TIME_TO_ENTER_SUB": "CONTINGENCY_TIME_TO_ENTER_SUB", "CONTINGENCY_OBJ_DEFEND_SUB": "Drž nepřátele od ponorky.", "CONTINGENCY_OBJ_ENTER_SUB": "Dostaň se k ponorce dříve než odpluje.", "CONTINGENCY_OBJ_CONTROL_SUB": "Zmocni se ponorky.", @@ -569,7 +570,7 @@ "LUA_MENU_DEATHS_CAPS": "ÚMRTÍ", "LUA_MENU_DEFAULT": "Základní", "LUA_MENU_DEFENDS": "Obrana", - "LUA_MENU_DEFENDS_CAPS": "OBRANA", + "LUA_MENU_DEFENDS_CAPS": "OBRANA", "LUA_MENU_DIFFICULTY": "Obtížnost", "LUA_MENU_DIFFICULTYCOMPLETED": "Dokončeno na", "LUA_MENU_DISABLED": "Vypnuto", @@ -4061,6 +4062,7 @@ "ELEVATOR_USE_HINT": "Stiskni a podrž &&1 pro použití výtahu.", "ELEVATOR_FLOOR_SELECT_HINT": "Stiskni a podrž &&1 pro výběr podlaží.", "MENU_PASSWORD2": "Heslo:", + "PLATFORM_SAVE_AND_QUIT": "ULOŽIT A UKONČIT", "PLATFORM_QUIT": "Ukončit", "PLATFORM_BACK": "Zpět", "PLATFORM_YES": "Ano", @@ -4574,9 +4576,7 @@ "MENU_WARNING": "VAROVÁNÍ", "MENU_CAPTURE_LIMIT": "Limit ukořistění: ", "MENU_CONTINUE_RESTART": "Pokračovat v restartu?", - "MENU_RESTART_TEXT_1": "Pokud nyní restartuješ, ztratíš ", - "MENU_RESTART_TEXT_2": "veškerý postup získaný ", - "MENU_RESTART_TEXT_3": "v této misi.", + "MENU_RESTART_TEXT_1": "Pokud nyní restartuješ, ztratíš veškerý postup získaný v této misi.", "MENU_CONTINUE_SAVING": "Pokračovat v uložení?", "MENU_SAVEQUIT_TEXT_1": "Pokud nyní uložíš hru, ", "MENU_SAVEQUIT_TEXT_2": "ztratíš veškerý postup ", diff --git a/data/zonetool/localizedstrings/english.json b/data/zonetool/localizedstrings/english.json index 3218b263..1a6d715a 100644 --- a/data/zonetool/localizedstrings/english.json +++ b/data/zonetool/localizedstrings/english.json @@ -12,11 +12,13 @@ "LOCALE_10": "Traditional Chinese", "LOCALE_11": "Simplified Chinese", "LOCALE_12": "Arabic", - "LOCALE_13": "Czech", + "LOCALE_13": "Czech\nOriginally translated by Ctihy\nPorted and corrected by VladWinner", "LOCALE_14": "Spanish (Latin America)", "LOCALE_15": "Korean", "LOCALE_16": "English (Safe)", "LOCALE_17": "Russian (Partial)", + "LUA_MENU_FALLBACK_DISABLE": "Apply built-in fonts", + "LUA_MENU_FALLBACK_ENABLE": "Apply h2-mod fonts", "UPDATER_POPUP_NO_UPDATES_AVAILABLE": "No updates available", "MENU_CCS_NEW_PATCH_NOTICE": "An update is available, proceed with installation?", diff --git a/data/zonetool/localizedstrings/french.json b/data/zonetool/localizedstrings/french.json index c7237a45..b09e97f9 100644 --- a/data/zonetool/localizedstrings/french.json +++ b/data/zonetool/localizedstrings/french.json @@ -17,6 +17,8 @@ "LOCALE_15": "Coréen", "LOCALE_16": "Anglais (sécuritaire)", "LOCALE_17": "Russe (partiel)", + "LUA_MENU_FALLBACK_DISABLE": "Restaurer les polices par défaut", + "LUA_MENU_FALLBACK_ENABLE": "Utiliser les polices de h2-mod", "UPDATER_POPUP_NO_UPDATES_AVAILABLE": "Aucune mise à jour disponible", "MENU_CCS_NEW_PATCH_NOTICE": "Une mise à jour est disponible,\npoursuivre l'installation ?", diff --git a/data/zonetool/localizedstrings/german.json b/data/zonetool/localizedstrings/german.json index c0235f4a..fe5bbb69 100644 --- a/data/zonetool/localizedstrings/german.json +++ b/data/zonetool/localizedstrings/german.json @@ -17,6 +17,8 @@ "LOCALE_15": "Koreanisch", "LOCALE_16": "Englisch (Sicher)", "LOCALE_17": "Russisch (Untertitelt)", + "LUA_MENU_FALLBACK_DISABLE": "Auf Vorgabeschriften zurücksetzen", + "LUA_MENU_FALLBACK_ENABLE": "h2-mod Schriften verwenden", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Alle Missionen freischalten", "LUA_MENU_CANCEL_UNLOCK_CAPS": "Freischalten abbrechen" diff --git a/data/zonetool/localizedstrings/italian.json b/data/zonetool/localizedstrings/italian.json index 13524d5f..9a7f3d05 100644 --- a/data/zonetool/localizedstrings/italian.json +++ b/data/zonetool/localizedstrings/italian.json @@ -17,6 +17,8 @@ "LOCALE_15": "Coreano", "LOCALE_16": "Inglese (sicuro)", "LOCALE_17": "Russo (parziale)", + "LUA_MENU_FALLBACK_DISABLE": "Ripristina caratteri predefiniti", + "LUA_MENU_FALLBACK_ENABLE": "Usare caratteri di h2-mod", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Sblocca tutte le missioni", "LUA_MENU_CANCEL_UNLOCK_CAPS": "Annulla sblocco", diff --git a/data/zonetool/localizedstrings/japanese_full.json b/data/zonetool/localizedstrings/japanese_full.json index 6ffa51e4..b4b9f1fd 100644 --- a/data/zonetool/localizedstrings/japanese_full.json +++ b/data/zonetool/localizedstrings/japanese_full.json @@ -17,6 +17,8 @@ "LOCALE_15": "韓国語", "LOCALE_16": "英語(検閲)", "LOCALE_17": "ロシア語(一部)", + "LUA_MENU_FALLBACK_DISABLE": "デフォルトに戻す", + "LUA_MENU_FALLBACK_ENABLE": "h2-mod フォントを使用します", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "全ミッションをアンロック", "LUA_MENU_CANCEL_UNLOCK_CAPS": "アンロックをキャンセル" diff --git a/data/zonetool/localizedstrings/japenese_partial.json b/data/zonetool/localizedstrings/japenese_partial.json index 6ffa51e4..b4b9f1fd 100644 --- a/data/zonetool/localizedstrings/japenese_partial.json +++ b/data/zonetool/localizedstrings/japenese_partial.json @@ -17,6 +17,8 @@ "LOCALE_15": "韓国語", "LOCALE_16": "英語(検閲)", "LOCALE_17": "ロシア語(一部)", + "LUA_MENU_FALLBACK_DISABLE": "デフォルトに戻す", + "LUA_MENU_FALLBACK_ENABLE": "h2-mod フォントを使用します", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "全ミッションをアンロック", "LUA_MENU_CANCEL_UNLOCK_CAPS": "アンロックをキャンセル" diff --git a/data/zonetool/localizedstrings/korean.json b/data/zonetool/localizedstrings/korean.json index 9b7fd9d2..c185a24e 100644 --- a/data/zonetool/localizedstrings/korean.json +++ b/data/zonetool/localizedstrings/korean.json @@ -17,6 +17,8 @@ "LOCALE_15": "한국어", "LOCALE_16": "영어(검열)", "LOCALE_17": "러시아어(일부)", + "LUA_MENU_FALLBACK_DISABLE": "기본 글꼴로 되돌리기", + "LUA_MENU_FALLBACK_ENABLE": "h2-mod 글꼴 사용", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "모든 임무 잠금 해제", "LUA_MENU_CANCEL_UNLOCK_CAPS": "잠금 해제 취소" diff --git a/data/zonetool/localizedstrings/polish.json b/data/zonetool/localizedstrings/polish.json index abf226f7..6494f440 100644 --- a/data/zonetool/localizedstrings/polish.json +++ b/data/zonetool/localizedstrings/polish.json @@ -17,6 +17,8 @@ "LOCALE_15": "Koreański", "LOCALE_16": "Angielski (cenzuralny)", "LOCALE_17": "Rosyjski (częściowy)", + "LUA_MENU_FALLBACK_DISABLE": "Przywróć wbudowane czcionki", + "LUA_MENU_FALLBACK_ENABLE": "Aplikuj h2-mod czcionki", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Odblokuj wszystkie misje", "LUA_MENU_CANCEL_UNLOCK_CAPS": "Anuluj odblokowanie" diff --git a/data/zonetool/localizedstrings/portuguese.json b/data/zonetool/localizedstrings/portuguese.json index 408bd359..295e150e 100644 --- a/data/zonetool/localizedstrings/portuguese.json +++ b/data/zonetool/localizedstrings/portuguese.json @@ -17,6 +17,8 @@ "LOCALE_15": "Coreano", "LOCALE_16": "Inglês (Censurado)", "LOCALE_17": "Russo (Parcial)", + "LUA_MENU_FALLBACK_DISABLE": "Repor fontes predefinidas", + "LUA_MENU_FALLBACK_ENABLE": "Usar fontes do h2-mod", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Desbloquear todas as missões", "LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancelar desbloqueio" diff --git a/data/zonetool/localizedstrings/russian.json b/data/zonetool/localizedstrings/russian.json index 5646a4f5..8107342e 100644 --- a/data/zonetool/localizedstrings/russian.json +++ b/data/zonetool/localizedstrings/russian.json @@ -17,6 +17,8 @@ "LOCALE_15": "Корейский", "LOCALE_16": "Английский цензурный", "LOCALE_17": "Русский (английская озвучка)", + "LUA_MENU_FALLBACK_DISABLE": "Вернуться к встроенным шрифтам", + "LUA_MENU_FALLBACK_ENABLE": "Применить шрифты от h2-mod", "UPDATER_POPUP_NO_UPDATES_AVAILABLE": "У вас установлены все последние обновления", "MENU_CCS_NEW_PATCH_NOTICE": "Доступно обновление клиента игры,\nначать установку сейчас?", diff --git a/data/zonetool/localizedstrings/russian_partial.json b/data/zonetool/localizedstrings/russian_partial.json index 32854be9..4959cfc2 100644 --- a/data/zonetool/localizedstrings/russian_partial.json +++ b/data/zonetool/localizedstrings/russian_partial.json @@ -17,6 +17,8 @@ "LOCALE_15": "Корейский", "LOCALE_16": "Английский цензурный", "LOCALE_17": "Русский (английская озвучка)", + "LUA_MENU_FALLBACK_DISABLE": "Вернуться к встроенным шрифтам", + "LUA_MENU_FALLBACK_ENABLE": "Применить шрифты от h2-mod", "UPDATER_POPUP_NO_UPDATES_AVAILABLE": "У вас установлены все последние обновления", "MENU_CCS_NEW_PATCH_NOTICE": "Доступно обновление клиента игры,\nначать установку сейчас?", diff --git a/data/zonetool/localizedstrings/simplified_chinese.json b/data/zonetool/localizedstrings/simplified_chinese.json index be1c7430..da99654f 100644 --- a/data/zonetool/localizedstrings/simplified_chinese.json +++ b/data/zonetool/localizedstrings/simplified_chinese.json @@ -17,6 +17,8 @@ "LOCALE_15": "韩语", "LOCALE_16": "英语 (审查制度)", "LOCALE_17": "俄语(拉丁美洲)", + "LUA_MENU_FALLBACK_DISABLE": "恢复为默认字体", + "LUA_MENU_FALLBACK_ENABLE": "使用 h2-mod 字体", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "解锁全部任务", "LUA_MENU_CANCEL_UNLOCK_CAPS": "取消解锁" diff --git a/data/zonetool/localizedstrings/spanish.json b/data/zonetool/localizedstrings/spanish.json index 033d1070..abc9ecf8 100644 --- a/data/zonetool/localizedstrings/spanish.json +++ b/data/zonetool/localizedstrings/spanish.json @@ -17,6 +17,8 @@ "LOCALE_15": "Coreano", "LOCALE_16": "Inglés (censura)", "LOCALE_17": "Ruso (parcial)", + "LUA_MENU_FALLBACK_DISABLE": "Restaurar tipografías predeterminadas", + "LUA_MENU_FALLBACK_ENABLE": "Usar tipografías de h2-mod", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Desbloquear todas las misiones", "LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancelar desbloqueo" diff --git a/data/zonetool/localizedstrings/spanishna.json b/data/zonetool/localizedstrings/spanishna.json index 033d1070..abc9ecf8 100644 --- a/data/zonetool/localizedstrings/spanishna.json +++ b/data/zonetool/localizedstrings/spanishna.json @@ -17,6 +17,8 @@ "LOCALE_15": "Coreano", "LOCALE_16": "Inglés (censura)", "LOCALE_17": "Ruso (parcial)", + "LUA_MENU_FALLBACK_DISABLE": "Restaurar tipografías predeterminadas", + "LUA_MENU_FALLBACK_ENABLE": "Usar tipografías de h2-mod", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "Desbloquear todas las misiones", "LUA_MENU_CANCEL_UNLOCK_CAPS": "Cancelar desbloqueo" diff --git a/data/zonetool/localizedstrings/traditional_chinese.json b/data/zonetool/localizedstrings/traditional_chinese.json index b6406dd5..abad4b8c 100644 --- a/data/zonetool/localizedstrings/traditional_chinese.json +++ b/data/zonetool/localizedstrings/traditional_chinese.json @@ -17,6 +17,8 @@ "LOCALE_15": "韓文", "LOCALE_16": "英文 (審查制度)", "LOCALE_17": "俄文(部份)", + "LUA_MENU_FALLBACK_DISABLE": "還原為預設字型", + "LUA_MENU_FALLBACK_ENABLE": "使用 h2-mod 字型", "LUA_MENU_CAMPAIGN_UNLOCKED_ALL_TITLE": "解鎖所有任務", "LUA_MENU_CANCEL_UNLOCK_CAPS": "取消解鎖" diff --git a/src/client/component/config.cpp b/src/client/component/config.cpp index 5927454a..c889616d 100644 --- a/src/client/component/config.cpp +++ b/src/client/component/config.cpp @@ -32,6 +32,7 @@ namespace config std::unordered_map field_definitions = { + {define_field("disable_custom_fonts", field_type::boolean, false)}, {define_field("language", field_type::string, language::get_default_language(), language::is_valid_language)}, }; } diff --git a/src/client/component/fonts.cpp b/src/client/component/fonts.cpp index 26510fd9..097241e8 100644 --- a/src/client/component/fonts.cpp +++ b/src/client/component/fonts.cpp @@ -82,6 +82,12 @@ namespace fonts loaded = true; auto& replacements = get_font_replacements(); + const auto disabled = config::get("disable_custom_fonts"); + if (disabled.has_value() && disabled.value() && language::current() != game::LANGUAGE_CZECH) + { + return; + } + const auto table = get_font_replacements_table(); if (table == nullptr) { diff --git a/src/client/component/ui_scripting.cpp b/src/client/component/ui_scripting.cpp index 4246d7d0..0d61b1c9 100644 --- a/src/client/component/ui_scripting.cpp +++ b/src/client/component/ui_scripting.cpp @@ -234,6 +234,14 @@ namespace ui_scripting lua["io"]["readfile"] = filesystem::safe_io_func( static_cast(utils::io::read_file)); + auto language_table = table(); + language_table["isnonlatin"] = language::is_non_latin; + language_table["ispolrus"] = language::is_polrus; + language_table["isarabic"] = language::is_arabic; + language_table["isasian"] = language::is_asian; + + lua["language"] = language_table; + using game = table; auto game_type = game(); lua["game"] = game_type; From 5c622d993a9e51af94c1164fc7adc3b2a565f7a1 Mon Sep 17 00:00:00 2001 From: Vlad Loktionov Date: Fri, 24 Feb 2023 15:14:22 +0300 Subject: [PATCH 2/2] Fixes for CJK * Fix ammo counter for CJK * Add Korean to CJK list * Minor additions for Czech --- data/cdata/ui_scripts/settings/language.lua | 24 ++++++++++--------- .../h2_mod_pre_gfx/font_replacements.csv | 2 ++ data/zonetool/localizedstrings/czech.json | 7 +++--- src/client/component/filesystem.cpp | 4 ++-- src/client/component/language.cpp | 7 +++--- src/client/component/language.hpp | 2 +- src/client/component/ui_scripting.cpp | 2 +- 7 files changed, 27 insertions(+), 21 deletions(-) diff --git a/data/cdata/ui_scripts/settings/language.lua b/data/cdata/ui_scripts/settings/language.lua index b5af4f43..732eaff8 100644 --- a/data/cdata/ui_scripts/settings/language.lua +++ b/data/cdata/ui_scripts/settings/language.lua @@ -59,7 +59,7 @@ LUI.MenuBuilder.registerType("choose_language_menu", function(a1) local lang = Engine.GetCurrentLanguage() - if language.isasian or not language.isnonlatin() or not config.get("disable_custom_fonts") then + if language.isasian() or not language.isnonlatin() or not config.get("disable_custom_fonts") then setuniversalfont(id) end @@ -108,7 +108,7 @@ LUI.MenuBuilder.registerType("choose_language_menu", function(a1) return menu end) --- rup patch +-- fix for Y-offset in button text (russian_partial, default font) if config.get("language") == "russian_partial" and config.get("disable_custom_fonts") then LUI.UIButtonText.IsOffsetedLanguage = function() return true @@ -116,12 +116,12 @@ if config.get("language") == "russian_partial" and config.get("disable_custom_fo end if not (config.get("disable_custom_fonts")) then - -- global patch + -- fix for Y-offset in button text (global patch, custom font) LUI.UIButtonText.IsOffsetedLanguage = function() return false end - -- pol/rus patch + -- fix for ammo counter (polish/russian) if not Engine.InFrontend() then local weaponinfodef = LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"] LUI.MenuBuilder.m_definitions["WeaponInfoHudDef"] = function(...) @@ -149,8 +149,8 @@ if not (config.get("disable_custom_fonts")) then end end - -- ara/pol/rus patch - if language.ispolrus() or language.isarabic() then + -- fix for ammo counter (global patch) + if language.isnonlatin() then local scale = function(size) return size * 720 / 1080 end @@ -169,10 +169,12 @@ if not (config.get("disable_custom_fonts")) then Font = RegisterFont("fonts/mix_gothic.ttf", 105), Height = 64 } - - CoD.TextSettings.H2TitleFont = { - Font = RegisterFont("fonts/mix_gothic.ttf", 56), - Height = scale(56) - } + -- forced gothic font for headers (arabic/slavic) + if language.isslavic() or language.isarabic() then + CoD.TextSettings.H2TitleFont = { + Font = RegisterFont("fonts/mix_gothic.ttf", 56), + Height = scale(56) + } + end end end diff --git a/data/zonetool/h2_mod_pre_gfx/font_replacements.csv b/data/zonetool/h2_mod_pre_gfx/font_replacements.csv index 74fe68d4..518f3e67 100644 --- a/data/zonetool/h2_mod_pre_gfx/font_replacements.csv +++ b/data/zonetool/h2_mod_pre_gfx/font_replacements.csv @@ -8,6 +8,8 @@ japanese_full,fonts/default.otf,fonts/mix.ttf, japanese_full,fonts/defaultBold.otf,fonts/mix_open.ttf, japanese_partial,fonts/default.otf,fonts/mix.ttf, japanese_partial,fonts/defaultBold.otf,fonts/mix_open.ttf, +korean,fonts/default.otf,fonts/mix.ttf, +korean,fonts/defaultBold.otf,fonts/mix_open.ttf, polish,fonts/bank.ttf,fonts/mix_gothic.ttf, polish,fonts/default.otf,fonts/mix.ttf, polish,fonts/defaultBold.otf,fonts/mix_open.ttf, diff --git a/data/zonetool/localizedstrings/czech.json b/data/zonetool/localizedstrings/czech.json index 12329821..df42afaf 100644 --- a/data/zonetool/localizedstrings/czech.json +++ b/data/zonetool/localizedstrings/czech.json @@ -7,8 +7,8 @@ "LOCALE_5": "Ruština", "LOCALE_6": "Polština", "LOCALE_7": "Portugalština", - "LOCALE_8": "Japonština (částečně)", - "LOCALE_9": "Japonština", + "LOCALE_8": "Japonština", + "LOCALE_9": "Japonština (částečně)", "LOCALE_10": "Čínština (složité)", "LOCALE_11": "Čínština (zjednodušené)", "LOCALE_12": "Arabština", @@ -4103,6 +4103,7 @@ "MENU_YOU_MUST_SPECIFY_A_FILENAME": "Musíš zadat název souboru!", "MENU_ARE_YOU_SURE_QUIT": "Opravdu chceš odejít?", "MENU_QUIT_WARNING": "Opravdu chceš odejít?", + "MENU_SAVEQUIT_TEXT": "Opravdu chceš odejít? Ztratíš veškerý postup dosažený od posledního checkpointu.", "MENU_CONTROLS": "Ovladání", "MENU_CONTROLS_CAPS": "KLÁVESY", "MENU_LOOK": "Pohled", @@ -5304,7 +5305,7 @@ "MENU_SP_CONTINUE_TO_SPECIAL_OPS": "Pokračovat do zvláštních operací", "MENU_SP_CONTINUE_TO_SPECIAL_OPS_CAPS": "POKRAČOVAT DO ZVLÁŠTNÍCH OPERACÍ", "MENU_SP_CONTINUE_TO_MULTIPLAYER": "Pokračovat do Multiplayeru", - "MENU_SP_FOR_THE_RECORD": "„Udělej v tom pořádek“", + "MENU_SP_FOR_THE_RECORD": "„Tohle jen pro pořádek“", "MENU_SP_CHOOSE_A_DIFFERENT_OP": "Vybrat jinou operaci", "MENU_SP_NO_STARS_FOR_LOCKED_OP": "Nezískáš žádné hvězdy dokud si neodemkneš tuto operaci.", "MENU_SP_NOT_SIGNED_IN": "Nejsi přihlášen", diff --git a/src/client/component/filesystem.cpp b/src/client/component/filesystem.cpp index b911dcb8..d736ba59 100644 --- a/src/client/component/filesystem.cpp +++ b/src/client/component/filesystem.cpp @@ -60,9 +60,9 @@ namespace filesystem paths.push_back(path / "fallback"); } - if (language::is_polrus() || language::is_arabic()) + if (language::is_slavic() || language::is_arabic()) { - paths.push_back(path / "polrus"); + paths.push_back(path / "slavic"); } paths.push_back(path / code); diff --git a/src/client/component/language.cpp b/src/client/component/language.cpp index 72760ba7..1ddeb05c 100644 --- a/src/client/component/language.cpp +++ b/src/client/component/language.cpp @@ -30,7 +30,7 @@ namespace language {game::LANGUAGE_RUSSIAN_PARTIAL}, }; - std::unordered_set polish_russian_languages = + std::unordered_set slavic_languages = { {game::LANGUAGE_RUSSIAN}, {game::LANGUAGE_POLISH}, @@ -44,6 +44,7 @@ namespace language {game::LANGUAGE_JAPANESE_PARTIAL}, {game::LANGUAGE_TRADITIONAL_CHINESE}, {game::LANGUAGE_SIMPLIFIED_CHINESE}, + {game::LANGUAGE_KOREAN}, }; std::unordered_set custom_languages = @@ -109,9 +110,9 @@ namespace language return non_latin_languages.contains(current()); } - bool is_polrus() + bool is_slavic() { - return polish_russian_languages.contains(current()); + return slavic_languages.contains(current()); } bool is_arabic() diff --git a/src/client/component/language.hpp b/src/client/component/language.hpp index a549951a..0a2f21c0 100644 --- a/src/client/component/language.hpp +++ b/src/client/component/language.hpp @@ -13,7 +13,7 @@ namespace language game::language_t current(); bool is_non_latin(); - bool is_polrus(); + bool is_slavic(); bool is_arabic(); bool is_asian(); } diff --git a/src/client/component/ui_scripting.cpp b/src/client/component/ui_scripting.cpp index 0d61b1c9..052f3689 100644 --- a/src/client/component/ui_scripting.cpp +++ b/src/client/component/ui_scripting.cpp @@ -236,7 +236,7 @@ namespace ui_scripting auto language_table = table(); language_table["isnonlatin"] = language::is_non_latin; - language_table["ispolrus"] = language::is_polrus; + language_table["isslavic"] = language::is_slavic; language_table["isarabic"] = language::is_arabic; language_table["isasian"] = language::is_asian;