Awesome: Since the new background shape implementation, the SVG no longer work

Created on 14 Mar 2019  路  2Comments  路  Source: awesomeWM/awesome

See https://awesomewm.org/apidoc/documentation/03-declarative-layout.md.html

vs.

https://awesomewm.org/doc/api/documentation/03-declarative-layout.md.html

Another problem I see is that the SVG are now full of base64 png images. As far as I recall, it was fully vector based until recently. This is a bit problematic for debugging since the old SVG + WebBrowser introspection mode was very useful to track the results.

Maybe we could revert these commit and think outside the box to solve the problem (ei, more fine grained APIs). The notification pull requests adds a commit to mitigate the border offset from the shape, just that is enough to make some instances of the problem go away (but it isn't enough, making the border mode user selectable will fix another class of issues).

Most helpful comment

diff --git a/lib/wibox/widget/init.lua b/lib/wibox/widget/init.lua
index 4793206f1..36f2c5e1f 100644
--- a/lib/wibox/widget/init.lua
+++ b/lib/wibox/widget/init.lua
@@ -52,6 +52,7 @@ end
 -- @tparam[opt={dpi=96}] table context The context information to give to the widget.
 function widget.draw_to_svg_file(wdg, path, width, height, context)
     local img = cairo.SvgSurface.create(path, width, height)
+    img:restrict_to_version(cairo.SvgVersion["1_2"])
     local cr = cairo.Context(img)
     widget.draw_to_cairo_context(wdg, cr, width, height, context)
     img:finish()

foo
Yay, the border works correctly again. -.-

Edit: I reported a bug to cairo: https://gitlab.freedesktop.org/cairo/cairo/issues/361

All 2 comments

Uhm. Seems to be a bug in cairo.

Reproducer in C: repro.c.txt

This does basically the same thing as the drawing code. Besides producing a SVG file, this also draws a PNG file. Theoretically, they should have the same content. Practically... (had to convert the SVG to PNG for GitHub and apparently Imagemagick picked a difference resolution for the image)

svg svg svg

diff --git a/lib/wibox/widget/init.lua b/lib/wibox/widget/init.lua
index 4793206f1..36f2c5e1f 100644
--- a/lib/wibox/widget/init.lua
+++ b/lib/wibox/widget/init.lua
@@ -52,6 +52,7 @@ end
 -- @tparam[opt={dpi=96}] table context The context information to give to the widget.
 function widget.draw_to_svg_file(wdg, path, width, height, context)
     local img = cairo.SvgSurface.create(path, width, height)
+    img:restrict_to_version(cairo.SvgVersion["1_2"])
     local cr = cairo.Context(img)
     widget.draw_to_cairo_context(wdg, cr, width, height, context)
     img:finish()

foo
Yay, the border works correctly again. -.-

Edit: I reported a bug to cairo: https://gitlab.freedesktop.org/cairo/cairo/issues/361

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xordspar0 picture xordspar0  路  5Comments

bew picture bew  路  5Comments

batmanm0b1E picture batmanm0b1E  路  6Comments

Fybe picture Fybe  路  5Comments

1096283585 picture 1096283585  路  3Comments