<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hello,<br><br>You may already know that with Gtk 3, it is possible to take vector screenshots<br>from a GUI. The utility created by Joachim Breitner (nomeata) takes care of the<br>job:<br><a href="https://github.com/nomeata/gtk-vector-screenshot">https://github.com/nomeata/gtk-vector-screenshot</a><br><br>But, this does not work out of the box. I have tried to take vector screenshots<br>from LibreOffice gtk3 gui, and it led to an immediate crash. I have debugged the<br>soffice binary, and I came across several assertions that are checked and some<br>aborts in case of specific threading situations. I have temporarily disabled<br>these assertions and aborts, and by further disabling the autosave, everything<br>was fine, and I could take vector screenshots. The tiny patch is attached.<br><br>I have created a proof of concept document from "LibreOffice Writer Guide",<br>section titled “20. Customizing Writer”, and created vector screenshots in SVG<br>format for almost all of the previously raster screenshots. The quality of the<br>PDF output is much better, the file is more visually attractive and it is better<br>for print and display.<br><br>Vector ODT:<br><a href="https://wiki.documentfoundation.org/images/7/79/WG7120-CustomizingWriter-vector.odt">https://wiki.documentfoundation.org/images/7/79/WG7120-CustomizingWriter-vector.odt</a><br><br>Vector PDF:<br><a href="https://wiki.documentfoundation.org/images/4/4b/WG7120-CustomizingWriter-vector.pdf">https://wiki.documentfoundation.org/images/4/4b/WG7120-CustomizingWriter-vector.pdf</a><br><br>There are few remaining things:<br><br>1. Vector screenshot does not add window decorations, so some workaround is<br>needed. For example, some toplevel Gtk widgets contain decorations in the<br>screenshots, so these can be used for containing the window contents.<br><br>2. Trying to take screenshots closes menus, etc, and this can be handled by<br>creating a delay in taking screenshots.<br><br>3. Not everything is vector. For example, document contents in LibreOffice and<br>also toolbar and status bar icons are not vectors. This is because of the way<br>text and images are rendered in LibreOffice. If you take screenshots from other<br>applications, the output is different. Try Glade and Gedit for the comparison.<br><br>On the development side, I doubt that having these aborts will be useful at<br>runtime. There are hundreds of aborts and thousands of asserts in the code in which I<br>think should be revised. Crashing the application in case of some problem is<br>usually a bad idea.<br><br>Assertions in C++, and Why Not to Use assert()<br><a href="https://web.archive.org/web/20191110223903/https://www.softwariness.com/articles/assertions-in-cpp/">https://web.archive.org/web/20191110223903/https://www.softwariness.com/articles/assertions-in-cpp/</a><br><br>Regards,<br>Hossein<br></div></div>