bugGNU Octave - Bugs: bug #40158, FontUnits property only works for...

 
 

bug #40158: FontUnits property only works for "points"

Submitter:  Rik <rik5>
Submitted:  Wed 02 Oct 2013 04:45:20 AM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 26 Aug 2014 05:09:25 AM UTC, comment #7: 

I agree, your patch seems to be working correctly.  I used


ht = text (0.5, 0.5, 'M');
set (ht, 'fontunits', 'points', 'fontsize', 72)


Which I would think would produce a figure that is ~1 inch since a point is 1/72 of an inch, but of course this comes out as 1/2 inch.

Other renderers also seem to have some mysterious factor.  I used KDE's font previewer and at 72 point an 'M' is still not an inch.

I guess I'm willing to say that the Octave part of this bug is fixed, and I don't know about fixing the rest.

Rik <rik5>
Group administrator
Mon 25 Aug 2014 09:01:34 PM UTC, comment #6: 

In your example script, if I retrieve the hidden property "fontsize_points", I obtain 72 which is the expected result. This property is now used both by the on-screen renderer and gl2ps.

In the patch I have assumed that txt-renderer expected the font size to be in points units (the only way it used to work), but it maybe in pixels or something ... anyways it's not obvious.

The following script


ht = text (0.5, 0.5, 'M');
set (ht, 'fontunits', 'inches', 'fontsize', 1.0);
set (ht, 'fontunits', 'pixels');
get (ht', 'fontsize')


returns 100.9 pixels/inch on my computer which is not enough to explain the factor of 2 we observe.


Pantxo Diribarne <pantxo>
Group Member
Sun 24 Aug 2014 10:48:47 PM UTC, comment #5: 

I wonder if there isn't a problem with the conversion routine (not your code).  If I execute the following code, I expect to see an 'M' figure which is nearly 1" large.  Instead, it is almost exactly 0.5" large.  Printing, however, works alright.


ht = text (0.5, 0.5, 'Mello');
set (ht, 'fontunits', 'inches', 'fontsize', 1.0);
print M.png



Rik <rik5>
Group administrator
Sun 24 Aug 2014 08:25:29 PM UTC, comment #4: 

Hi,

I have pushed the patch at http://hg.savannah.gnu.org/hgweb/octave/rev/1288a2f27769

If there is no objection I'll close this bug report in the next coming days.

Pantxo Diribarne <pantxo>
Group Member
Sun 03 Aug 2014 08:14:58 AM UTC, comment #3: 

@Rik: I had the intension to check it again and push it when I am back from vacations (2 weeks ago). If you have time to check it then it's even better.

Pantxo Diribarne <pantxo>
Group Member
Sun 03 Aug 2014 06:45:32 AM UTC, comment #2: 

@Panxto: Should your patch be applied?

Rik <rik5>
Group administrator
Sun 11 May 2014 09:01:41 PM UTC, comment #1: 

Hi,

I attached a patch:

  • it introduces a new hidden property "fontsize_points" (for axes and text) for which a custom get_fontsize_points method was already in place (but unused).
  • most part of the conversion/update work was already in place for axes so I borrowed code from there for text objects.


(file #31361)

Pantxo Diribarne <pantxo>
Group Member
Wed 02 Oct 2013 04:45:20 AM UTC, original submission:  

The following code should use inches for the fontunits which should create something very large.  Instead, the "FontSize" property is always interpreted in points.


ht = text (0.5, 0.5, 'Hello');
set (ht, 'fontunits', 'inches', 'fontsize', 0.5);



Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #31954:  M.png added by rik5 (17KiB - image/png)
file #31361:  update_fontunits.patch added by pantxo (6KiB - application/x-download)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by rik5 (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-08-26 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2014-08-24 rik5 Attached File- Added M.png, #31954
    2014-08-24 pantxo StatusNone Ready For Test
    2014-05-11 pantxo Attached File- Added update_fontunits.patch, #31361

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code