GNOME Bugzilla – Bug 506737
gimp-text-get-extents-fontname returns wrong size
Last modified: 2008-10-30 20:07:17 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.
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 ***
Please notify me when the fix to the duplicate bug is implemented. Then I can verify this is fixed. Thanks. :)