After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 506737 - gimp-text-get-extents-fontname returns wrong size
gimp-text-get-extents-fontname returns wrong size
Status: RESOLVED DUPLICATE of bug 164539
Product: GIMP
Classification: Other
Component: Script-Fu
2.4.x
Other All
: Normal normal
: ---
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2008-01-01 20:22 UTC by Chad Jones
Modified: 2008-10-30 20:07 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Chad Jones 2008-01-01 20:22:34 UTC
Please describe the problem:
The size reported by gimp-text-get-extents-fontname assumes that the text being drawn will be anti-aliased.  If the text is not to be anti-aliased then the value returned from this routine may not match the actual extents of the text drawn.  An example of this is the text "Hello" drawn in "Arial" font size in pixels of 12.  If the text is to be drawn anti-aliased then the size is 29x14 which matches what gimp-text-get-extents-fontname returns.  However, if the text isn't going to be anti-aliased then the size is 30x14 which doesn't match the return value of gimp-text-get-extents-fontname.  This is just one example of a problem which is fairly extensive.

Steps to reproduce:
1. Call gimp-text-get-extents-fontname with text "Hello", font "Arial" and font size of 12.  
2. Create a test image
3. With the test image call gimp-text-fontname with the settings above as well as the setting anti-aliasing as FALSE
3. Get the size of the resulting layer created using gimp-text-fontname
4. The size of the layer doesn't match the extents returned in step 1. 


Actual results:
The size reported by gimp-text-get-extents-fontname doesn't actually match the size of the font actually drawn.  That is the size returned is wrong.

Expected results:
That it would give the correct size.  Obviously whether the text is to be anti-aliased or not needs to be an argument passed to the gimp-text-get-extents-fontname routine.

Does this happen every time?
Yes.

Other information:
I'd suggest that the extents routine would be modified to take into account the fact that text isn't always anti-aliased in determining the size.  Likely to take this into account a new argument may need to be passed to this routine or a separate routine created specifically for non anti-aliased text.
Comment 1 Sven Neumann 2008-01-01 22:43:49 UTC
This is covered in bug #164539. We can't fix gimp-text-get-extents-fontname without breaking backward compatibility. So the way to go here is to add a new PDB API for text.

*** This bug has been marked as a duplicate of 164539 ***
Comment 2 Chad Jones 2008-01-02 00:46:45 UTC
Please notify me when the fix to the duplicate bug is implemented.  Then I can verify this is fixed.  Thanks. :)