Vector screenshots for the manuals: better quality and more visually attractive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

You may already know that with Gtk 3, it is possible to take vector screenshots
from a GUI. The utility created by Joachim Breitner (nomeata) takes care of the
job:
https://github.com/nomeata/gtk-vector-screenshot

But, this does not work out of the box. I have tried to take vector screenshots
from LibreOffice gtk3 gui, and it led to an immediate crash. I have debugged the
soffice binary, and I came across several assertions that are checked and some
aborts in case of specific threading situations. I have temporarily disabled
these assertions and aborts, and by further disabling the autosave, everything
was fine, and I could take vector screenshots. The tiny patch is attached.

I have created a proof of concept document from "LibreOffice Writer Guide",
section titled “20. Customizing Writer”, and created vector screenshots in SVG
format for almost all of the previously raster screenshots. The quality of the
PDF output is much better, the file is more visually attractive and it is better
for print and display.

Vector ODT:
https://wiki.documentfoundation.org/images/7/79/WG7120-CustomizingWriter-vector.odt

Vector PDF:
https://wiki.documentfoundation.org/images/4/4b/WG7120-CustomizingWriter-vector.pdf

There are few remaining things:

1. Vector screenshot does not add window decorations, so some workaround is
needed. For example, some toplevel Gtk widgets contain decorations in the
screenshots, so these can be used for containing the window contents.

2. Trying to take screenshots closes menus, etc, and this can be handled by
creating a delay in taking screenshots.

3. Not everything is vector. For example, document contents in LibreOffice and
also toolbar and status bar icons are not vectors. This is because of the way
text and images are rendered in LibreOffice. If you take screenshots from other
applications, the output is different. Try Glade and Gedit for the comparison.

On the development side, I doubt that having these aborts will be useful at
runtime. There are hundreds of aborts and thousands of asserts in the code in which I
think should be revised. Crashing the application in case of some problem is
usually a bad idea.

Assertions in C++, and Why Not to Use assert()
https://web.archive.org/web/20191110223903/https://www.softwariness.com/articles/assertions-in-cpp/

Regards,
Hossein
diff --git a/comphelper/source/misc/solarmutex.cxx b/comphelper/source/misc/solarmutex.cxx
index 5d1052327154..8a35daa5c4bf 100644
--- a/comphelper/source/misc/solarmutex.cxx
+++ b/comphelper/source/misc/solarmutex.cxx
@@ -60,10 +60,10 @@ void SolarMutex::doAcquire( const sal_uInt32 nLockCount )
 
 sal_uInt32 SolarMutex::doRelease( bool bUnlockAll )
 {
-    if ( !IsCurrentThread() )
-        std::abort();
-    if ( m_nCount == 0 )
-        std::abort();
+//    if ( !IsCurrentThread() )
+//        std::abort();
+//    if ( m_nCount == 0 )
+//        std::abort();
 
     const sal_uInt32 nCount = bUnlockAll ? m_nCount : 1;
     m_nCount -= nCount;
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index 495d22cee201..1ff139785808 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -1467,7 +1467,7 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams)
     }
     catch(const css::uno::RuntimeException&)
     {
-        throw;
+//        throw;
     }
     catch(const css::uno::Exception&)
     {
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index a60f33790505..6cb7f4abec62 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -342,8 +342,9 @@ void GtkYieldMutex::ThreadsEnter()
     if (!yieldCounts.empty()) {
         auto n = yieldCounts.top();
         yieldCounts.pop();
-        assert(n > 0);
-        n--;
+//        assert(n > 0);
+        if(n>0)
+            n--;
         if (n > 0)
             acquire(n);
     }
@@ -351,7 +352,7 @@ void GtkYieldMutex::ThreadsEnter()
 
 void GtkYieldMutex::ThreadsLeave()
 {
-    assert(m_nCount != 0);
+    //assert(m_nCount != 0);
     yieldCounts.push(m_nCount);
     release(true);
 }
_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux