Song select: smaller board titles outside English #75
No files matched your search
@@ -54,6 +54,14 @@ local function draw_title(text, bx, cy, fade, max_w, min_scale)
|
||||
text:draw({ x = math.floor(bx - w / 2 + 0.5), y = math.floor(cy - text.height / 2 + 0.5),
|
||||
x2 = w - text.width, fade = fade })
|
||||
end
|
||||
-- Size factor for board / header titles. Only English gets the condensed font_en; every other
|
||||
-- language's font (font.ttf, font_cn, font_tw, font_kr) is a full-width design whose titles read
|
||||
-- much larger at the same point size, so they are drawn smaller.
|
||||
local function title_scale()
|
||||
local lang = tex.language and tex.language() or ""
|
||||
if lang == "" or lang:sub(1, 2) == "en" then return 1.0 end
|
||||
return 0.8
|
||||
end
|
||||
-- control-guide pill labels
|
||||
local function draw_guide_label(t, cx, cy, fade)
|
||||
if not t then return end
|
||||
@@ -559,7 +567,7 @@ return {
|
||||
DS_MARK_DECIDE_MS = DS_MARK_DECIDE_MS,
|
||||
|
||||
get_any = get_any, draw_centered = draw_centered, draw_centered_b = draw_centered_b,
|
||||
draw_title = draw_title, draw_guide_label = draw_guide_label,
|
||||
draw_title = draw_title, draw_guide_label = draw_guide_label, title_scale = title_scale,
|
||||
outline = outline, board_outline = board_outline, clamp01 = clamp01,
|
||||
draw_board = draw_board, draw_glow = draw_glow, glow_pulse = glow_pulse,
|
||||
|
||||
|
||||
@@ -54,10 +54,11 @@ function SongSelect:folder_title(box)
|
||||
local key = box.text_name
|
||||
if not key or key == "" then return box:name() end
|
||||
local ff = folder_frame(box)
|
||||
key = ff .. "\0" .. key
|
||||
local scale = base.title_scale()
|
||||
key = ff .. "\0" .. scale .. "\0" .. key
|
||||
local t = self._folder_titles[key]
|
||||
if t == nil then
|
||||
t = text.create_raw_text(box.text_name, FOLDER_TITLE_SIZE, { 255, 255, 255, 255 },
|
||||
t = text.create_raw_text(box.text_name, math.floor(FOLDER_TITLE_SIZE * scale + 0.5), { 255, 255, 255, 255 },
|
||||
board_outline(ff), false, outline(7.5), 2.0)
|
||||
self._folder_titles[key] = t or false
|
||||
end
|
||||
|
||||
@@ -404,7 +404,8 @@ function SongSelect:song_title(box)
|
||||
local name = box.text_name
|
||||
if not name or name == "" then return box:name() end
|
||||
local gf = self._inside_frame or box:genre_frame()
|
||||
local key = gf .. "\0" .. name -- the outline follows the genre, so it keys the cache
|
||||
local scale = base.title_scale()
|
||||
local key = gf .. "\0" .. scale .. "\0" .. name -- the outline follows the genre, so it keys the cache
|
||||
local t = self._song_titles[key]
|
||||
if t == nil then
|
||||
if SONG_TITLE_SIZE == nil then
|
||||
@@ -415,7 +416,7 @@ function SongSelect:song_title(box)
|
||||
self._song_titles = {}
|
||||
self._song_titles_n = 0
|
||||
end
|
||||
t = text.create_raw_text(name, SONG_TITLE_SIZE, { 255, 255, 255, 255 }, board_outline(gf),
|
||||
t = text.create_raw_text(name, math.floor(SONG_TITLE_SIZE * scale + 0.5), { 255, 255, 255, 255 }, board_outline(gf),
|
||||
false, outline(SONG_TITLE_OUTLINE), 2.0)
|
||||
self._song_titles[key] = t or false
|
||||
self._song_titles_n = self._song_titles_n + 1
|
||||
@@ -425,9 +426,11 @@ end
|
||||
|
||||
function SongSelect:header_title(box)
|
||||
local name = box.text_name or ""
|
||||
if self._header_title_key ~= name then
|
||||
local scale = base.title_scale()
|
||||
if self._header_title_key ~= name or self._header_title_scale ~= scale then
|
||||
self._header_title_key = name
|
||||
self._header_title = text.create_raw_text(name, 48, { 255, 255, 255, 255 }, { 0, 0, 0, 255 }, false, outline(7.0), 2.0)
|
||||
self._header_title_scale = scale
|
||||
self._header_title = text.create_raw_text(name, math.floor(48 * scale + 0.5), { 255, 255, 255, 255 }, { 0, 0, 0, 255 }, false, outline(7.0), 2.0)
|
||||
end
|
||||
return self._header_title
|
||||
end
|
||||
@@ -436,9 +439,11 @@ function SongSelect:header_subtitle(box)
|
||||
local sub = box.text_subtitle
|
||||
if sub == nil then return box:subtitle_large() end -- engine without the binding
|
||||
if sub == "" then return nil end
|
||||
if self._header_sub_key ~= sub then
|
||||
local scale = base.title_scale()
|
||||
if self._header_sub_key ~= sub or self._header_sub_scale ~= scale then
|
||||
self._header_sub_key = sub
|
||||
self._header_sub = text.create_raw_text(sub, 30, { 255, 255, 255, 255 }, { 0, 0, 0, 255 }, false, outline(4.0), 2.0)
|
||||
self._header_sub_scale = scale
|
||||
self._header_sub = text.create_raw_text(sub, math.floor(30 * scale + 0.5), { 255, 255, 255, 255 }, { 0, 0, 0, 255 }, false, outline(4.0), 2.0)
|
||||
end
|
||||
return self._header_sub
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user