From 883e7369574b1909750c393721a095592b34388b Mon Sep 17 00:00:00 2001 From: Xruptor Date: Mon, 23 Jul 2018 18:02:28 -0400 Subject: [PATCH] Fix for the Russian character support issue. Apparently the font FRIZQT__.TTF has an issue displaying russian characters. So instead of forcing everyone to use ARIALN.TTF, I made it a boolean function to check for the russian locale and replace the font accordingly. I'm going to use this function to implement a font selection option in the BagSync config window. --- BagSync.lua | 14 ++++++++++++++ modules/blacklist.lua | 2 +- modules/currency.lua | 4 ++-- modules/professions.lua | 6 +++--- modules/profiles.lua | 2 +- modules/recipes.lua | 6 +++--- modules/search.lua | 4 ++-- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/BagSync.lua b/BagSync.lua index 8c28520..e5e287e 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -158,6 +158,20 @@ local function pairsByKeys (t, f) end ---------------------- +-- Utilities -- +---------------------- + +function BSYC:GetFontType() + --apparently the russian local has an issue with the font type. FRIZQT__.TTF is unable to show russian characters. + local gameLocale = GetLocale() + if gameLocale == "ruRU" then + return "Fonts\\ARIALN.TTF" + else + return "Fonts\\FRIZQT__.TTF" + end +end + +---------------------- -- DB Functions -- ---------------------- diff --git a/modules/blacklist.lua b/modules/blacklist.lua index a1aac2a..93f80f7 100644 --- a/modules/blacklist.lua +++ b/modules/blacklist.lua @@ -122,7 +122,7 @@ function Blacklist:AddEntry(entry) local label = AceGUI:Create("InteractiveLabel") label:SetText(entry) - label:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor( r, g, b) label:SetCallback( diff --git a/modules/currency.lua b/modules/currency.lua index 8c30b55..ff8deef 100644 --- a/modules/currency.lua +++ b/modules/currency.lua @@ -44,7 +44,7 @@ function Currency:AddEntry(entry, isHeader) if isHeader then label:SetText(entry.header) - label:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor(unpack(label.userdata.color)) label:ApplyJustifyH("CENTER") @@ -53,7 +53,7 @@ function Currency:AddEntry(entry, isHeader) label:ToggleHeaderHighlight(true) else label:SetText(entry.name) - label:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) label:SetFullWidth(true) label.userdata.color = {64/255, 224/255, 208/255} label:SetColor(unpack(label.userdata.color)) diff --git a/modules/professions.lua b/modules/professions.lua index 1aa7d63..bfb5a84 100644 --- a/modules/professions.lua +++ b/modules/professions.lua @@ -19,7 +19,7 @@ function Professions:OnEnable() local information = AceGUI:Create("Label") information:SetText(L.ProfessionInformation) - information:SetFont("Fonts\\FRIZQT__.TTF", 12, THICKOUTLINE) + information:SetFont(BSYC:GetFontType(), 12, THICKOUTLINE) information:SetColor(1, 165/255, 0) information:SetFullWidth(true) ProfessionsFrame:AddChild(information) @@ -50,7 +50,7 @@ function Professions:AddEntry(entry, isHeader) if isHeader then label:SetText(entry.player) - label:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor(unpack(label.userdata.color)) label:ApplyJustifyH("CENTER") @@ -60,7 +60,7 @@ function Professions:AddEntry(entry, isHeader) else local labelText = entry.name..format(" |cFFFFFFFF(%s)|r", entry.level) label:SetText(labelText) - label:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) label:SetFullWidth(true) if entry.recipes then label.userdata.color = {153/255,204/255,51/255} --primary profession color it green diff --git a/modules/profiles.lua b/modules/profiles.lua index 453cc3e..3c7d371 100644 --- a/modules/profiles.lua +++ b/modules/profiles.lua @@ -31,7 +31,7 @@ function Profiles:OnEnable() --I wish Ace3 had better methods for modifying the alignment of widgets on a container.... --list has to be in order for editing, warning, ddlist, deletebutton, confirmbutton, etc.. warning:SetText(L.DeleteWarning) - warning:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + warning:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) warning:ClearAllPoints() warning:SetPoint( "CENTER", ProfilesFrame.frame, "CENTER", 10, 55) diff --git a/modules/recipes.lua b/modules/recipes.lua index 99e1ca4..8379fd5 100644 --- a/modules/recipes.lua +++ b/modules/recipes.lua @@ -17,7 +17,7 @@ function Recipes:OnEnable() RecipesFrame:EnableResize(false) local information = AceGUI:Create("BagSyncInteractiveLabel") - information:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + information:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) information:SetColor(153/255,204/255,51/255) information:SetFullWidth(true) information:ApplyJustifyH("CENTER") @@ -26,7 +26,7 @@ function Recipes:OnEnable() Recipes.information = information local label = AceGUI:Create("BagSyncInteractiveLabel") - label:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) label:SetFullWidth(true) label:SetText(" ") --add an empty space just to show the label label:SetHeaderHighlight("Interface\\QuestFrame\\UI-QuestTitleHighlight") @@ -57,7 +57,7 @@ function Recipes:AddEntry(entry) local label = AceGUI:Create("InteractiveLabel") label:SetText(name) - label:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor(unpack(color)) label:SetImage(icon) diff --git a/modules/search.lua b/modules/search.lua index 66b134c..b6e33e1 100644 --- a/modules/search.lua +++ b/modules/search.lua @@ -60,7 +60,7 @@ function Search:OnEnable() local warninglabel = AceGUI:Create("Label") warninglabel:SetText(L.WarningItemSearch) - warninglabel:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + warninglabel:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) warninglabel:SetColor(1, 165/255, 0) --orange, red is just too much sometimes warninglabel:SetFullWidth(true) warningframe:AddChild(warninglabel) @@ -98,7 +98,7 @@ function Search:AddEntry(entry) local r, g, b, hex = GetItemQualityColor(rarity) label:SetText(name) - label:SetFont("Fonts\\FRIZQT__.TTF", 14, THICKOUTLINE) + label:SetFont(BSYC:GetFontType(), 14, THICKOUTLINE) label:SetFullWidth(true) label:SetColor( r, g, b) label:SetImage(texture) -- 1.7.9.5