bugGNU Octave - Bugs: bug #48446, uicontrols extent is incorrect

 
 

bug #48446: uicontrols extent is incorrect

Submitted by:  Andreas Weber <andy1978>
Submitted on:  Fri 08 Jul 2016 12:18:03 PM UTC  
 
Category: Plotting with OpenGLSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Wed 13 Jul 2016 09:09:47 AM UTC, comment #7:

I also noticed this issue with uicontrols' extent: would you be able to provide me with a way to test whether the suggestion of comment #5 solves all of the related issues I am observing?

Guillaume <gyom>
Sat 09 Jul 2016 02:24:28 PM UTC, comment #6:

@Andreas: I totally agree. This will leave us with the current inconsistency between string size in uixx and text objects, but at list the returned extent will be correct.

Pantxo Diribarne <pantxo>
Project Member
Sat 09 Jul 2016 01:01:47 PM UTC, comment #5:

@Pantxo: Okay, but then the extent property of a uicontrol should IMHO return the value calculated by the used graphics_toolkit, in case of Qt

And not create a text_renderer to calculate it as it's done in uicontrol::properties::update_text_extent or am I wrong?

Andreas Weber <andy1978>
Project Member
Fri 08 Jul 2016 03:38:35 PM UTC, comment #4:

It is a known issue that text objects have an underestimated size, see bug #45600.

To sum up: it is easy to have the right font size, simply feed "FT_Set_Char_Size" with the right screen resolution (not 0 which means 72 pixels/inch = point size) in ft_text_renderer::ft_font::get_face (). But this will lead to printing issues in the current state of the printing system.

Pantxo Diribarne <pantxo>
Project Member
Fri 08 Jul 2016 01:18:52 PM UTC, comment #3:

Okay, the problem is that "normal" text in a plot and text uicontrol have different sizes.

produces attached plot and returns [102 58] twice but the uicontrol text is larger.

(file #37768)

Andreas Weber <andy1978>
Project Member
Fri 08 Jul 2016 12:59:25 PM UTC, comment #2:

The bbox calculations in ft-text-renderer.cc seems fine (the advance is caluclated in http://hg.octave.org/octave/file/tip/libinterp/corefcn/ft-text-renderer.cc#l808)

The problem is that the extent property from uicontrol asks ft-text-renderer but the uicontrol is qt object which doesn't use this renderer to display text. I only can imagine that there is a fontsize or -name mismatch.

Andreas Weber <andy1978>
Project Member
Fri 08 Jul 2016 12:26:08 PM UTC, comment #1:

Hm sorry, looks related to #44473 but I don't see the factor 2 and think this is more detailed.

Andreas Weber <andy1978>
Project Member
Fri 08 Jul 2016 12:18:03 PM UTC, original submission:

Consider following code:

If I make a screenshot and measure the real width its approx 80 pixels.

As far as I can see the code in ft-text-renderer.cc ft_text_renderer::compute_bbox sums up the glyph width and not the "advance width" (https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html) so the space between the glyphs is missing from the sum.

Andreas Weber <andy1978>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #37768:  uicontrol_extent_1.png added by andy1978 (10KiB - image/png)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by gyom (Posted a comment)
  • -unavailable- added by pantxo (Posted a comment)
  • -unavailable- added by andy1978 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 08 Jul 2016 03:54:58 PM UTCmtmillerDependencies-=>bugs #44473 is dependent
    Fri 08 Jul 2016 01:18:52 PM UTCandy1978Attached File-=>Added uicontrol_extent_1.png, #37768
      Summaryuicontrol extent returns sum of glyph width instead sum of advance width=>uicontrols extent is incorrect

    Back to the top


    Powered by Savane 3.1-cleanup1