Allowed for overrides of toolbar items, so plugins can add things if they want to with different fonts. (#1157)

This commit is contained in:
Adam 2023-05-06 21:36:30 -04:00 committed by George Sokianos
parent e7168a1e00
commit 21db8313c1
1 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ end
function ToolbarView:get_icon_width()
local max_width = 0
for i,v in ipairs(self.toolbar_commands) do max_width = math.max(max_width, self.toolbar_font:get_width(v.symbol)) end
for i,v in ipairs(self.toolbar_commands) do max_width = math.max(max_width, (v.font or self.toolbar_font):get_width(v.symbol)) end
return max_width
end
@ -83,7 +83,7 @@ function ToolbarView:draw()
for item, x, y, w, h in self:each_item() do
local color = item == self.hovered_item and command.is_valid(item.command) and style.text or style.dim
common.draw_text(self.toolbar_font, color, item.symbol, nil, x, y, 0, h)
common.draw_text(item.font or self.toolbar_font, color, item.symbol, nil, x, y, 0, h)
end
end