changeset 26188:6652de1fe896

Hack margin of text objects to be measured in points, not pixels. * gl-render.cc (draw_text_background): Multiply "Margin" property by 4/3 which translates points to pixels on most systems with 96PPI. This should eventually be replaced by a better calculation that is HiDPI aware.
author Rik <rik@octave.org>
date Sun, 09 Dec 2018 17:03:33 -0800
parents 8d4f23b7f4eb
children 05e8cc761c14
files libinterp/corefcn/gl-render.cc
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Fri Nov 23 11:18:53 2018 +0100
+++ b/libinterp/corefcn/gl-render.cc	Sun Dec 09 17:03:33 2018 -0800
@@ -3700,6 +3700,10 @@
       m_glfcns.glRotated (-rotation, 0.0, 0.0, 1.0);
 
     double m = props.get_margin ();
+    // FIXME: Margin property should be measured in points, not pixels.
+    //        On most screens the conversion factor is 4/3.
+    //        For HiDPI this will not work.
+    m *= 4.0/3.0;
     const Matrix bbox = props.get_extent_matrix ();
     double x0 = bbox (0) / m_devpixratio - m;
     double x1 = x0 + bbox(2) / m_devpixratio + 2 * m;