Spaces:
Sleeping
Sleeping
File size: 1,071 Bytes
402daee e378a99 402daee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
--[[
Fonts.lua - Font configuration and loader
]]--
Fonts = {
SIZE = 15,
ICON = {
pencil = 'a',
cog = 'b',
play = 'c',
stop = 'd',
},
LOCAL_FILE = nil,
}
function Fonts:load()
self.main = ImGui.CreateFont('sans-serif', self.SIZE)
ImGui.Attach(ctx, self.main)
if self.LOCAL_FILE then
self.icons = ImGui.CreateFont(self.LOCAL_FILE, self.SIZE)
ImGui.Attach(ctx, self.icons)
return
end
if not Script or not Script.host or Script.host == '' then
return
end
local protocol = Script.protocol or 'http:'
local icons_url = protocol .. '//' .. Script.host .. '/static/reascripts/ReaSpeech/icons.ttf'
local icons_file = Tempfile:name()
local curl = "curl"
if not reaper.GetOS():find("Win") then
curl = "/usr/bin/curl"
end
local command = (
curl
.. ' "' .. icons_url .. '"'
.. ' -o "' .. icons_file .. '"'
)
if reaper.ExecProcess(command, 5000) then
self.icons = ImGui.CreateFont(icons_file, self.SIZE)
ImGui.Attach(ctx, self.icons)
else
self.icons = self.main
end
end
|