From 3627bc01cfc1d90b416659dfa06d77a7da80bf5d Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 6 May 2023 21:36:30 -0400 Subject: [PATCH] Allowed for overrides of toolbar items, so plugins can add things if they want to with different fonts. (#1157) --- data/plugins/toolbarview.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/plugins/toolbarview.lua b/data/plugins/toolbarview.lua index 9cfa15e8..caf86d71 100644 --- a/data/plugins/toolbarview.lua +++ b/data/plugins/toolbarview.lua @@ -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