diff libinterp/corefcn/gl2ps-print.cc @ 24689:800876b7132c

Make some markers linejoin/linecap round for better looking printout (bug #53023) * gl2ps-print.cc (gl2ps_renderer::init_marker): reimplement method to change linecap and linejoin on a per marker basis.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Mon, 05 Feb 2018 16:29:49 +0100
parents 21e97b50989d
children af6c1ed60581
line wrap: on
line diff
--- a/libinterp/corefcn/gl2ps-print.cc	Mon Feb 05 22:14:34 2018 +0100
+++ b/libinterp/corefcn/gl2ps-print.cc	Mon Feb 05 16:29:49 2018 +0100
@@ -177,6 +177,25 @@
     void draw_pixels (int w, int h, const uint8_t *data);
     void draw_pixels (int w, int h, const uint16_t *data);
 
+    void init_marker (const std::string& m, double size, float width)
+    {
+      opengl_renderer::init_marker (m, size, width);
+
+      // FIXME: gl2ps can't handle closed contours and we set linecap/linejoin
+      //        round to obtain a better looking result for some markers.
+      if (m == "o" || m == "v" || m == "^" || m == ">" || m == "<" || m == "h"
+          || m == "hexagram" || m == "p" || m == "pentagram")
+        {
+          set_linejoin ("round");
+          set_linecap ("round");
+        }
+      else
+        {
+          set_linejoin ("miter");
+          set_linecap ("square");
+        }
+    }
+
     void set_linestyle (const std::string& s, bool use_stipple = false,
                         double linewidth = 0.5)
     {