bugGNU Octave - Bugs: bug #38265, OpenGL: changing legend fontsize...

 
 

bug #38265: OpenGL: changing legend fontsize has no effect

Submitter:  Ben Abbott <bpabbott>
Submitted:  Tue 05 Feb 2013 02:13:26 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  bpabbott
Originator Name:  Ben Abbott Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 06 Jun 2013 04:19:12 PM UTC, comment #10: 

Works for me now.  Thanks Ben.  Closing report.

Rik <rik5>
Group administrator
Thu 06 Jun 2013 05:16:59 AM UTC, comment #9: 

I've pushed a changeset that works for me.

http://hg.savannah.gnu.org/hgweb/octave/rev/5cf7369a74cb

To test, run the first demo.


demo legend 1


Ben Abbott <bpabbott>
Group Member
Fri 17 May 2013 12:20:09 AM UTC, comment #8: 

I'm leaving this assigned to me, but only to make it difficult for me for forget about it.  If someone else is inclined to work on this, please go ahead.

Ben Abbott <bpabbott>
Group Member
Wed 06 Feb 2013 05:26:09 PM UTC, comment #7: 

I think I'm wrong in my comment below.  The legend's box size is determined by the text objects extents in legend.m


Ben Abbott <bpabbott>
Group Member
Wed 06 Feb 2013 05:12:14 PM UTC, comment #6: 

I don't know where, but the updating the of axes box is done on the c++ side.  Meanwhile there are no listeners on the c++ side.

Either the updater for the axes box needs to be changed to accommodate a change in fontsize, or we might try something kludgy (add a listener) in legend.m with a listener that triggers the updater on the c++ side to act.

Ben Abbott <bpabbott>
Group Member
Wed 06 Feb 2013 04:39:29 PM UTC, comment #5: 

Do we also need a listener that updates the box size when the fontsize changes?  Using the first demonstration code the font size is correctly updated, but it now extends beyond the legend box.  See the attached jpeg.


Rik <rik5>
Group administrator
Wed 06 Feb 2013 03:08:00 PM UTC, comment #4: 
Ben Abbott <bpabbott>
Group Member
Tue 05 Feb 2013 04:08:30 PM UTC, comment #3: 

I've attached a changeset which addresses this bug and 38263

(file #27394)

Ben Abbott <bpabbott>
Group Member
Tue 05 Feb 2013 03:29:37 PM UTC, comment #2: 

I took a quick look at legend.m and found that the fix is easy.  We had neglected to add a listener for the legend's fontsize property.


$ hg diff
diff --git a/scripts/plot/legend.m b/scripts/plot/legend.m
--- a/scripts/plot/legend.m
+++ b/scripts/plot/legend.m
@@ -874,6 +874,7 @@
         if (addprops)
           addlistener (hlegend, "edgecolor", @updatelegendtext);
           addlistener (hlegend, "textcolor", @updatelegendtext);
+          addlistener (hlegend, "fontsize", @updatelegendtext);
           addlistener (hlegend, "interpreter", @updatelegendtext);
           addlistener (hlegend, "location", @updatelegend);
           addlistener (hlegend, "orientation", @updatelegend);
@@ -915,7 +916,10 @@
   text_kids = findobj (kids, "-property", "interpreter", "type", "text");
   interpreter = get (h, "interpreter");
   textcolor = get (h, "textcolor");
-  set (text_kids, "interpreter", interpreter, "color", textcolor);
+  fontsize = get (h, "fontsize");
+  set (text_kids, "interpreter", interpreter,
+                  "fontsize", fontsize,
+                  "color", textcolor);
 endfunction

 function hideshowlegend (h, d, ca, pos1, pos2)


Ben Abbott <bpabbott>
Group Member
Tue 05 Feb 2013 02:46:34 PM UTC, comment #1: 

Changing the fontsize property on individual text objects works:


close all
graphics_toolkit fltk
plot (rand (3))
h = legend ({"first", "second", "third"})
hh = findobj(h, "type", "text")
for i = 1:length(hh), set(hh(i), "Fontsize", 5 + 5*i); end


The opposite behaviour occurs with GNUPLOT (changing fontsize works on the legend object, but not on its text children).

Julien Bect <jbect>
Tue 05 Feb 2013 02:13:26 PM UTC, original submission:  


plot (rand (3))
[hl, hc] = legend ({"first", "second", "third"});
set (hl, "fontsize", 20)


Ben Abbott <bpabbott>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #27404:  fontsize_tst.jpg added by rik5 (26KiB - image/jpeg)
file #27394:  changeset.patch added by bpabbott (2KiB - 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 rik5 (Updated the item)
  • -email is unavailable- added by jbect (Posted a comment)
  • -email is unavailable- added by bpabbott (Submitted the item)
  •  

    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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-06 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2013-06-06 bpabbott StatusNone Ready For Test
    2013-05-17 bpabbott StatusReady For Test None
    2013-02-06 rik5 Attached File- Added fontsize_tst.jpg, #27404
    2013-02-06 bpabbott StatusPatch Submitted Ready For Test
    2013-02-05 bpabbott StatusNone Patch Submitted
        Assigned toNone bpabbott
    2013-02-05 bpabbott Attached File- Added changeset.patch, #27394

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code