bugGNU Octave - Bugs: bug #60120, Printed size of fonts inaccurately...

 
 

bug #60120: Printed size of fonts inaccurately altered by '-S' option

Submitter:  Gordon Chamberlain <inprosys>
Submitted:  Thu 25 Feb 2021 09:14:17 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Confirmed Assigned to:  None
Originator Name:  inprosys Open/Closed:  * Open
Release:  * 6.2.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 03 Mar 2021 01:08:15 AM UTC, comment #11: 

Interesting, the "LIBGL_ALWAYS_SOFTWARE=1" changes my runtime from 80 seconds to 0.3 seconds.  That's not at all what I expect since this setting causes OpenGl to prefer software rendering over hardware rendering.

I suppose something is wrong with the video card setup, but debugging that seems hard.

Rik <rik5>
Group administrator
Fri 26 Feb 2021 11:44:13 PM UTC, comment #10: 

On a laptop with intel graphics:


$ LIBGL_ALWAYS_SOFTWARE=1 octave -f -q
octave:1> tic; hgload ("Figure1_Octave_Native.ofig"); toc
Elapsed time is 0.32721 seconds.
octave:2> tic; print("t1.svg") ; toc
Elapsed time is 0.249313 seconds.
octave:3>
$ LIBGL_ALWAYS_SOFTWARE=0 octave -f -q
octave:1> tic; hgload ("Figure1_Octave_Native.ofig"); toc
Elapsed time is 0.325612 seconds.
octave:2> tic; print("t1.svg") ; toc
Elapsed time is 0.242793 seconds.
octave:3>


Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 26 Feb 2021 11:22:51 PM UTC, comment #9: 

This ofig file has uncovered another bug.  The file loads correctly with 6.2, but not with the development branch.  I filed a different bug report about that at bug #60130.

Rik <rik5>
Group administrator
Fri 26 Feb 2021 11:15:09 PM UTC, comment #8: 

Upgrading gl2ps didn't help.  It just seems to take a long time on my machine.  Possibly there is SW rendering rather than HW-accelerated OpenGL going on.

Rik <rik5>
Group administrator
Fri 26 Feb 2021 10:52:17 PM UTC, comment #7: 

Just tested again with a completely idle machine and it still took 76 seconds.  I will try upgrading gl2ps and see if that helps.

Rik <rik5>
Group administrator
Fri 26 Feb 2021 10:35:21 PM UTC, comment #6: 

Might be a difference in the gl2ps library.  I'm using 1.4.0 and I see you are using 1.4.2.

Rik <rik5>
Group administrator
Fri 26 Feb 2021 10:33:33 PM UTC, comment #5: 

Sorry -- I was running make -32 in the background. It is 0.15 sec on an (almost) idle computer.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 26 Feb 2021 10:25:56 PM UTC, comment #4: 

Rik, Something is wrong with your computer:



octave:6> hgload Figure1_Octave_Native.ofig
ans = 2
octave:7> tic; print ('tst.svg'); toc
Elapsed time is 0.209319 seconds.


I attached my svg file, just fyi.

Dmitri.
--


(file #50930)

Dmitri A. Sergatskov <dasergatskov>
Fri 26 Feb 2021 10:16:36 PM UTC, comment #3: 

As another intermediate solution, I had even better luck printing to SVG format, and then using an SVG editor such as Inkscape to make any touch-ups to the figure before exporting that modified plot as a PNG file.  Be warned, however, that it takes a very long time.


octave:1> hgload Figure1_Octave_Native.ofig
octave:2> tic; print ('tst.svg'); toc
Elapsed time is 80.3108 seconds.


The issue that I noticed was that the bounding box for the legend was slightly undersized.  In an SVG editor it was trivial to expand the rectangle behind the legend text.


Rik <rik5>
Group administrator
Thu 25 Feb 2021 11:50:16 PM UTC, comment #2: 

Thanks for the very quick response.  In my case, your simplified approach -- e.g., print(figHand1, fig1_File), without the "-S" option -- worked just great under 6.2.0.  That certainly was the quickest route to a solution.

Programming note: That direct, simplified solution does NOT work under 5.2.0!  So, there's that if you're trying to use common code and having to support different versions of Octave.

In any case, that took care of my immediate problem.

The "-S" option may not be a closed bug under 6.2.0, but I'm all squared away.

Thanks for the quick help,
Gordon

Gordon Chamberlain <inprosys>
Thu 25 Feb 2021 10:01:17 PM UTC, comment #1: 

The '-S' option is always tricky.  In order to get you to a solution in the fastest possible manner, I'd suggest abandoning that particular construct.

I was able to load your figure with


hgload Figure1_Octave_Native.ofig


If I look the "position" field with


get (gcf, "position")
ans =

   1296    453   1200    698


The size is 1200x698 with an aspect ratio of 1.719

If I just print this figure with


print plot.jpg


The result is a jpg that looks pretty good and is of size 1874x1090 or an aspect ratio of 1.719.

You could just take this resulting figure and shrink it in an image processing program to the right size.

Rik <rik5>
Group administrator
Thu 25 Feb 2021 09:14:17 PM UTC, original submission:  

When using the print function to output a figure, the xtick and xticklabel information are improperly displayed and overwriten on top of itself (bad scaling?).  See the attached code snippet file, correct Octave display of the figure, the incorrect printed output of the figure, and a copy of the figure saved in "ofig" format.

This works correctly on Octave 5.2.0 under both Windows 7 and Windows 10. It fails on Octave 6.2.0 under both levels of the Windows operating system.

There is a lot of code and external data involved in generating the figure.  I hope that you can recreate the problem from the code snippet as a guide. If not, I'm sure that you know how to ask for more information or request more testing from me.

Thanks

Gordon Chamberlain <inprosys>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #50930:  tst.svg added by dasergatskov (127KiB - image/svg+xml)
file #50922:  Figure1_Code.m added by inprosys (455B - text/plain)
file #50924:  Figure1_Octave_Display.pdf added by inprosys (209KiB - application/pdf)
file #50925:  Figure1_Octave_Native.ofig added by inprosys (130KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dasergatskov (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by inprosys (Submitted the item)
  • -email is unavailable- added by inprosys
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-26 rik5 Item GroupIncorrect Result Inaccurate Result
        StatusNone Confirmed
        Operating SystemMicrosoft Windows Any
        SummaryPrint of a figure has incorrect xtick/xtick label output (overlayed) Printed size of fonts inaccurately altered by '-S' option
    2021-02-26 dasergatskov Attached File- Added tst.svg, #50930
    2021-02-25 inprosys Attached File- Added Figure1_Code.m, #50922
        Attached File- Added Figure1_Octave_Print.jpg, #50923
        Attached File- Added Figure1_Octave_Display.pdf, #50924
        Attached File- Added Figure1_Octave_Native.ofig, #50925
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code