add font for track name display

This commit is contained in:
Franzi 2023-12-26 13:01:38 +01:00
parent 3b845964e7
commit 03a337c352
3 changed files with 14 additions and 6 deletions

View file

@ -7,13 +7,13 @@
"title": "Fonts",
"type": "section"
}, {
"title": "Room name",
"title": "Room Name",
"ui_width": 6,
"name": "font_room",
"type": "font",
"default": "silkscreen.ttf"
}, {
"title": "Talk title",
"title": "Talk Title",
"ui_width": 6,
"name": "font_talk",
"type": "font",
@ -30,6 +30,12 @@
"name": "font_clock",
"type": "font",
"default": "silkscreen.ttf"
}, {
"title": "Track Name",
"ui_width": 6,
"name": "font_track",
"type": "font",
"default": "silkscreen.ttf"
}, {
"title": "all other text",
"ui_width": 6,

View file

@ -43,6 +43,7 @@ util.file_watch("config.json", function(content)
font_room = resource.load_font(config.font_room.asset_name)
font_talk = resource.load_font(config.font_talk.asset_name)
font_text = resource.load_font(config.font_text.asset_name)
font_track = resource.load_font(config.font_track.asset_name)
end)
util.data_mapper{
@ -138,7 +139,7 @@ function node.render()
track = tracks[idx]
if track.color ~= json.null then
r,g,b = parse_rgb(track.color)
local track_width = font_talk:width(track.name, info_size)
local track_width = font_track:width(track.name, info_size)
local brightness = math.max(r, g, b)
if track_x - track_width < PADDING then
track_x = NATIVE_WIDTH - PADDING
@ -152,7 +153,7 @@ function node.render()
track_y + info_size + PADDING*0.3
)
if brightness > 0.6 then
font_talk:write(
font_track:write(
track_x - track_width,
track_y,
track.name,
@ -160,7 +161,7 @@ function node.render()
0, 0, 0, 1
)
else
font_talk:write(
font_track:write(
track_x - track_width,
track_y,
track.name,

View file

@ -56,6 +56,7 @@ function M.updated_config_json(config)
font_room = resource.load_font(api.localized(config.font_room.asset_name))
font_talk = resource.load_font(api.localized(config.font_talk.asset_name))
font_text = resource.load_font(api.localized(config.font_text.asset_name))
font_track = resource.load_font(api.localized(config.font_track.asset_name))
current_room = nil
for idx, room in ipairs(config.rooms) do
@ -228,7 +229,7 @@ local function view_next_talk(starts, ends, config, x1, y1, x2, y2)
end
if track_text then
if a.height > y + 20 + track_size then
text(font_text, col2, y+20, current_talk.track.name, track_size, r,g,b,1)
text(font_track, col2, y+20, current_talk.track.name, track_size, r,g,b,1)
end
elseif current_talk.track.color ~= json.null then
a.add(anims.moving_image_raw(