aboutsummaryrefslogtreecommitdiff
path: root/plugins/scale.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2021-05-31 20:24:25 -0400
committerjgmdev <jgmdev@gmail.com>2021-05-31 20:24:25 -0400
commit2594d54ec414b55da3f5fa1950abb24c08db935a (patch)
tree1087af86b37a087d8323ce4ee84b4d98bb95c23b /plugins/scale.lua
parent31cca1ab3239b920c544cc80d9d702abf6920499 (diff)
downloadlite-xl-plugins-2594d54ec414b55da3f5fa1950abb24c08db935a.tar.gz
lite-xl-plugins-2594d54ec414b55da3f5fa1950abb24c08db935a.zip
Fix scale plugin to work with latest lite-xl font.
Diffstat (limited to 'plugins/scale.lua')
-rw-r--r--plugins/scale.lua19
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/scale.lua b/plugins/scale.lua
index b63611c..0d07286 100644
--- a/plugins/scale.lua
+++ b/plugins/scale.lua
@@ -15,11 +15,24 @@ local scale_level = 0
local scale_steps = 0.1
local font_cache = setmetatable({}, { __mode = "k" })
+-- default lite fonts
+local regular_font = "font.ttf"
+local monospace_font = "monospace.ttf"
+
+-- Set font names properly to work with latest lite-xl changes
+if io.open(DATADIR .. "/fonts/FiraSans-Regular.ttf", "r") then
+ regular_font = "FiraSans-Regular.ttf"
+end
+
+if io.open(DATADIR .. "/fonts/JetBrainsMono-Regular.ttf", "r") then
+ monospace_font = "JetBrainsMono-Regular.ttf"
+end
+
-- the following should be kept in sync with core.style's default font settings
-font_cache[style.font] = { DATADIR .. "/fonts/font.ttf", 14 * SCALE }
-font_cache[style.big_font] = { DATADIR .. "/fonts/font.ttf", 34 * SCALE }
+font_cache[style.font] = { DATADIR .. "/fonts/" .. regular_font, 14 * SCALE }
+font_cache[style.big_font] = { DATADIR .. "/fonts/" .. regular_font, 34 * SCALE }
font_cache[style.icon_font] = { DATADIR .. "/fonts/icons.ttf", 14 * SCALE }
-font_cache[style.code_font] = { DATADIR .. "/fonts/monospace.ttf", 13.5 * SCALE }
+font_cache[style.code_font] = { DATADIR .. "/fonts/" .. monospace_font, 13.5 * SCALE }
local load_font = renderer.font.load