octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #34720] print() for FLTK produces wrong size a


From: Ben Abbott
Subject: [Octave-bug-tracker] [bug #34720] print() for FLTK produces wrong size and scale
Date: Sun, 13 Nov 2011 19:03:12 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2

Update of bug #34720 (project octave):

                 Summary: plot box shifts when printing with FLTK => print()
for FLTK produces wrong size and scale

    _______________________________________________________

Follow-up Comment #16:

After looking at this more closely, I think the original problem has been
resolved, but there remain two problems with the FLTK backend. I've changed
the "Summary" to give a better description.

My display has a screen resolution (screeenpixelsperinch) of 99.898. For my
comments below, it is sufficient to treat my screen's resolution as 100 dpi.

First, the height of the graphic output produced using print() is shorter than
it should be. For my case the bottom of the image appears to be off by the
height of the status bar. If I understand the code correctly, the height of
the status bar is set in __init_fltk__.cc to be 20 points. For my resolution
this translates to 28 pixels. When I produce output with "-r100" I expect an
image size of 800x600, but am getting 800x572.

This I am able to correct by the change below (however, I'm not confident this
is the proper fix).


$ diff --git a/src/DLD-FUNCTIONS/__init_fltk__.cc
b/src/DLD-FUNCTIONS/__init_fltk__.cc
--- a/src/DLD-FUNCTIONS/__init_fltk__.cc
+++ b/src/DLD-FUNCTIONS/__init_fltk__.cc
@@ -667,7 +667,8 @@
    begin ();
     {
 
-      canvas = new OpenGL_fltk (0, 0, ww, hh - status_h, number ());
+      // canvas = new OpenGL_fltk (0, 0, ww, hh - status_h, number ());
+      canvas = new OpenGL_fltk (0, 0, ww, hh, number ());
 
       uimenu = new fltk_uimenu (0, 0, ww, menu_h);
       uimenu->hide ();


Second, the scale of the figure's graphics objects is off by
screenpixelsperinch / 72 (with the UL corner being the origin). The result is
that the output appears cropped. This effect appears to have been introduced
in the changeset below. 

http://hg.savannah.gnu.org/hgweb/octave/rev/4f112bebd474

I don't see how to fix this in a proper way, but if I force Octave to use 72
dpi for the display, then the output produced is consistent with a display of
72 dpi. The diff for that is below. With this change, the status bar is not
present in the displayed window (the area is gray and empty).


--- a/src/graphics.cc
+++ b/src/graphics.cc
@@ -189,7 +189,7 @@
 static double
 default_screenpixelsperinch (void)
 {
-  return (display_info::x_dpi () + display_info::y_dpi ()) / 2;
+  return 72.0;
 }


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34720>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]