diff --git a/descriptions/ab+/en_us.lua b/descriptions/ab+/en_us.lua index bcb7ec98..7746b154 100644 --- a/descriptions/ab+/en_us.lua +++ b/descriptions/ab+/en_us.lua @@ -14,7 +14,7 @@ EID.descriptions[languageCode] = {} EID.descriptions[languageCode].custom = {} -- table for custom entity descriptions EID.descriptions[languageCode].languageName = "English" -EID.descriptions[languageCode].fonts = {"default", "inverted", "borderless"} -- Fonts to be used with this languagepack +EID.descriptions[languageCode].fonts = {{name="default", lineHeight=11}, {name="inverted", lineHeight=11}, {name="borderless", lineHeight=11}} -- Fonts to be used with this languagepack EID.descriptions[languageCode].collectibles={ {"1", "The Sad Onion", "↑ +0.7 Tears up"}, diff --git a/descriptions/ab+/ko_kr.lua b/descriptions/ab+/ko_kr.lua index d521adb1..65a1bb1a 100644 --- a/descriptions/ab+/ko_kr.lua +++ b/descriptions/ab+/ko_kr.lua @@ -16,7 +16,7 @@ EID.descriptions[languageCode].languageName = "Korean" korean_galmoori9, korean_galmoori11 is added for community request. ]] -EID.descriptions[languageCode].fonts = {"korean_hcrdotum", "korean_lanapixel", "korean_soyakkoma", "korean_soyakkoma_borderless", "korean_soyakkoma_inverted", "korean_soyanon", "korean_galmoori9", "korean_galmoori11"} -- Fonts to be used with this languagepack +EID.descriptions[languageCode].fonts = {{name="korean_hcrdotum", lineHeight=14}, {name="korean_lanapixel", lineHeight=14}, {name="korean_soyakkoma", lineHeight=14}, {name="korean_soyakkoma_borderless", lineHeight=14}, {name="korean_soyakkoma_inverted", lineHeight=14}, {name="korean_soyanon", lineHeight=14}, {name="korean_galmoori9", lineHeight=14}, {name="korean_galmoori11", lineHeight=14}} -- Fonts to be used with this languagepack diff --git a/descriptions/ab+/zh_cn.lua b/descriptions/ab+/zh_cn.lua index fa2f7519..778ef20b 100644 --- a/descriptions/ab+/zh_cn.lua +++ b/descriptions/ab+/zh_cn.lua @@ -16,7 +16,7 @@ EID.descriptions[languageCode].custom = {} -- table for custom entity descriptio EID.descriptions[languageCode].languageName = "Chinese" -- Fonts to be used with this languagepack -EID.descriptions[languageCode].fonts = {"default_cn"} +EID.descriptions[languageCode].fonts = {{name = "default_cn", lineHeight = 14}} ---------- Collectibles ---------- EID.descriptions[languageCode].collectibles={ diff --git a/eid_api.lua b/eid_api.lua index 7f1145bd..74fa2373 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -1012,11 +1012,12 @@ function EID:fixDefinedFont() local curLang = EID.Config["Language"] local curFont = EID.Config["FontType"] for _, v in ipairs(EID.descriptions[curLang].fonts) do - if curFont == v then + if curFont == v.name then return false end end - EID.Config["FontType"] = EID.descriptions[curLang].fonts[1] + EID.Config["FontType"] = EID.descriptions[curLang].fonts[1].name + EID.lineHeight = EID.descriptions[curLang].fonts[1].lineHeight return true end diff --git a/eid_config.lua b/eid_config.lua index b896e56c..a6e658c2 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -44,6 +44,9 @@ EID.UserConfig = { -- Set the Y Position (height) of the description texts -- Default = 45 ["YPosition"] = 45, + -- Set the height of a line, effectivly changing the distance between two lines of text + -- Default = 11 (11 for English, 14 for Korean / Chinese) + ["LineHeight"] = 11, -- Set the distance between an item and its information display (in tiles) -- Default = 5 ["MaxDistance"] = 5, @@ -344,6 +347,7 @@ EID.DefaultConfig = { ["HUDOffset"] = 10, ["XPosition"] = 60, ["YPosition"] = 45, + ["LineHeight"] = 11, ["DisplayMode"] = "default", ["LocalScale"] = 0.5, ["LocalModeCentered"] = true, diff --git a/main.lua b/main.lua index f5555013..3168a9e3 100644 --- a/main.lua +++ b/main.lua @@ -1081,6 +1081,8 @@ if EID.MCMLoaded or REPENTANCE then EID.isHidden = EID.Config["InitiallyHidden"] EID.UsedPosition = Vector(EID.Config["XPosition"], EID.Config["YPosition"]) EID.Scale = EID.Config["Scale"] + EID.lineHeight = EID.Config["LineHeight"] + EID:fixDefinedFont() EID:loadFont(EID.modPath .. "resources/font/eid_"..EID.Config["FontType"]..".fnt") if REPENTANCE then @@ -1112,6 +1114,7 @@ if EID.MCMLoaded or REPENTANCE then end EID.Config["FlipItemPositions"] = flipItemTable or {} end + EID.Config["LineHeight"] = EID.lineHeight EID.SaveData(EID, json.encode(EID.Config)) EID:hidePermanentText() EID.itemUnlockStates[CollectibleType.COLLECTIBLE_CUBE_OF_MEAT] = nil diff --git a/mod_config_menu.lua b/mod_config_menu.lua index 7d2b7641..9180c72f 100644 --- a/mod_config_menu.lua +++ b/mod_config_menu.lua @@ -27,26 +27,28 @@ local colorNameArray = {} local function renderDummyDesc() MCMCompat_oldPermanentObj = EID.permanentDisplayTextObj local demoDescObj = EID:getDescriptionObj(5, 100, 33) - demoDescObj.Name = "Demo Object Name" - demoDescObj.Transformation = "Demo Transformation" - demoDescObj.Description = "A very cool description as a demonstration of the power of EID!#\1 This is also a cool line#This line loves you {{Heart}}" + demoDescObj.Name = EID:getDescriptionEntry("MCM","demoObjectName") + demoDescObj.Transformation = EID:getDescriptionEntry("MCM","demoObjectTransformation") + demoDescObj.Description = EID:getDescriptionEntry("MCM","demoObjectText") EID:displayPermanentText(demoDescObj) end -- get list of all defined fonts per language file local fonts = {} +local fontNames = {} for k, pack in pairs(EID.descriptions) do if pack.fonts then for _,fontToAdd in ipairs(pack.fonts) do local exists = false - for _,font in ipairs(fonts) do - if font == fontToAdd then + for _,font in ipairs(fontNames) do + if font == fontToAdd.name then exists = true break end end if not exists then table.insert(fonts, fontToAdd) + table.insert(fontNames, fontToAdd.name) end end end @@ -306,6 +308,48 @@ if MCMLoaded then Info = {"Default = 45"} } ) + -- Line Height + MCM.AddSetting( + "EID", + "General", + { + Type = ModConfigMenu.OptionType.NUMBER, + CurrentSetting = function() + return EID.lineHeight + end, + Minimum = 1, + Maximum = 100, + Display = function() + return "Line Height: " .. EID.lineHeight + end, + OnChange = function(currentNum) + EID.lineHeight = currentNum + end, + Info = {"Default = 11","Lineheight will automatically change when changing a font/language"} + } + ) + -- Textbox Width + MCM.AddSetting( + "EID", + "General", + { + Type = ModConfigMenu.OptionType.NUMBER, + CurrentSetting = function() + return EID.Config["TextboxWidth"] + end, + Minimum = 1, + Maximum = 500, + ModifyBy = 5, + Display = function() + return "Textbox Width: " .. EID.Config["TextboxWidth"] + end, + OnChange = function(currentNum) + EID.Config["TextboxWidth"] = currentNum + end, + Info = {"Default = 100","Width of the EID textbox, in pixels"} + } + ) + MCM.AddSpace("EID", "General") @@ -957,16 +1001,17 @@ if MCMLoaded then { Type = ModConfigMenu.OptionType.NUMBER, CurrentSetting = function() - return AnIndexOf(fonts, EID.Config["FontType"]) + return AnIndexOf(fontNames, EID.Config["FontType"]) end, Minimum = 1, - Maximum = #fonts, + Maximum = #fontNames, Display = function() EID.MCMCompat_isDisplayingEIDTab = "Visuals"; return "Font Type: " .. EID.Config["FontType"] end, OnChange = function(currentNum) - EID.Config["FontType"] = fonts[currentNum] + EID.Config["FontType"] = fontNames[currentNum] + EID.lineHeight = fonts[currentNum].lineHeight EID:fixDefinedFont() local fontFile = EID.Config["FontType"] or "default" EID:loadFont(EID.modPath .. "resources/font/eid_"..fontFile..".fnt") @@ -1598,7 +1643,6 @@ if MCMLoaded then Maximum = 1000, Display = function() if EID.Config["ModIndicatorTextColor"] == nil then EID.Config["TextColor"] = EID.DefaultConfig["ModIndicatorTextColor"] end - EID.MCMCompat_isDisplayingEIDTab = "Visuals"; return "Mod Indicator: " .. string.gsub(EID.Config["ModIndicatorTextColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ModIndicatorTextColor"]).."/"..#colorNameArray..")" end, OnChange = function(currentNum)