aboutsummaryrefslogtreecommitdiff
path: root/plugins/fontconfig.lua
diff options
context:
space:
mode:
authorStunxFS <56417208+StunxFS@users.noreply.github.com>2022-12-31 20:33:25 -0400
committerGitHub <noreply@github.com>2022-12-31 20:33:25 -0400
commit975243113fa52cc1f9549526f0a48d8b98179b37 (patch)
treee5ca4bcfa0e37bdb0838ffc1ee44c5c2d4e01c0c /plugins/fontconfig.lua
parentfadbb0aae2dcbc5a418647f7ba7397b6380854f3 (diff)
parentbf3a3b7b75efc54869df6f62363b5b94191a85cc (diff)
downloadlite-xl-plugins-975243113fa52cc1f9549526f0a48d8b98179b37.tar.gz
lite-xl-plugins-975243113fa52cc1f9549526f0a48d8b98179b37.zip
Merge branch 'lite-xl:master' into master
Diffstat (limited to 'plugins/fontconfig.lua')
-rw-r--r--plugins/fontconfig.lua26
1 files changed, 25 insertions, 1 deletions
diff --git a/plugins/fontconfig.lua b/plugins/fontconfig.lua
index 8b713b5..03a2f95 100644
--- a/plugins/fontconfig.lua
+++ b/plugins/fontconfig.lua
@@ -75,6 +75,24 @@ function M.load_blocking(font_name, font_size, font_opt)
return result
end
+function M.load_group_blocking(group, font_size, font_opt)
+ local fonts = {}
+ for i in ipairs(group) do
+ local co = coroutine.create(function()
+ return M.load(group[i], font_size, font_opt)
+ end)
+ local result
+ while coroutine.status(co) ~= "dead" do
+ local ok, err = coroutine.resume(co)
+ if not ok then error(err) end
+ result = err
+ end
+ table.insert(fonts, result)
+ end
+
+ return renderer.font.group(fonts)
+end
+
function M.use(spec)
core.add_thread(function()
for key, value in pairs(spec) do
@@ -87,7 +105,13 @@ end
-- I'll leave this here
function M.use_blocking(spec)
for key, value in pairs(spec) do
- style[key] = M.load_blocking(value.name, value.size, value)
+ local font
+ if value.group then
+ font = M.load_group_blocking(value.group, value.size, value)
+ else
+ font = M.load_blocking(value.name, value.size, value)
+ end
+ style[key] = font
end
end