Fix some script icons for non-square buttons

This commit is contained in:
Robin Gareus 2019-11-19 03:33:28 +01:00
parent 7aaf212a9b
commit cf8a808bd7
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
8 changed files with 14 additions and 10 deletions

View file

@ -13,12 +13,12 @@ end end
function icon (params) return function (ctx, width, height, fg)
ctx:set_source_rgba (ARDOUR.LuaAPI.color_to_rgba (fg))
local txt = Cairo.PangoLayout (ctx, "Sans ".. math.ceil(math.min (width, height) * .33) .. "px")
local txt = Cairo.PangoLayout (ctx, "Sans ".. math.ceil(height / 3) .. "px")
txt:set_alignment (Cairo.Alignment.Center);
txt:set_width (width);
txt:set_ellipsize (Cairo.EllipsizeMode.Middle);
txt:set_text ("plot\ngraph")
txt:set_text ("plot\ngrph")
local tw, th = txt:get_pixel_size ()
ctx:move_to (.5 * (width - tw), .5 * (height - th))
ctx:move_to (0, .5 * (height - th))
txt:show_in_cairo_context (ctx)
end end