Bug 197747
Summary: | gdImageStringFT sets improper bounding box for rendered text | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Joel Uckelman <uckelman> | ||||||||
Component: | gd | Assignee: | Ivana Varekova <varekova> | ||||||||
Status: | CLOSED RAWHIDE | QA Contact: | |||||||||
Severity: | medium | Docs Contact: | |||||||||
Priority: | medium | ||||||||||
Version: | 5 | ||||||||||
Target Milestone: | --- | ||||||||||
Target Release: | --- | ||||||||||
Hardware: | All | ||||||||||
OS: | Linux | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||||||
Doc Text: | Story Points: | --- | |||||||||
Clone Of: | Environment: | ||||||||||
Last Closed: | 2006-11-21 09:14:03 UTC | Type: | --- | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Attachments: |
|
Description of problem: gdImageStringFT() sets the bounding box for text to be rendered. Unfortunately, the bounding box it calculates extends too far to the right (by an amount which seems to depend on the font size). This makes it difficult center text horizontally, since the text itself is not centered within the calculated bounding box. Version-Release number of selected component (if applicable): gd-2.0.33-6.2 How reproducible: Always Steps to Reproduce: 1. Call gdImageStringFT to get a bounding box for some text. 2. Find the center of the BB. 3. Call gdImageStringFT to paint the text, offset by half of the BB width. Actual results: Text is several pixels too far to the left. Expected results: Text should be centered horizontally. Additional info: I'm attaching a little example program and a png generated by it which exhibits the problem. At most sizes, the text is too far left by at least two pixels. Created attachment 131969 [details]
example of the problem
The bounding box extends 3 pixels too far to the right of the period. This is
not so problematic for lengthy text, but extremely annoying for short text and
a disaster for rotated text.
Can you please send me program, which generates pictures with rotated text and has the wrong bounding? Thank you. Created attachment 132819 [details]
program for generating pngs with rotated text
Usage: rotate fontsize angle text >foo.png
The problem is easy to see if you make the size 24 and the angle 60, with some
short bit of text that has descenders (e.g., "Test string"). It appears that
the text is being painted into the lower-left corner (relative to the text) of
the bounding box.
Ok, thank you for the test program. I wanted to make sure I know, what you your problem is. Fixed in gd-2.0.33-11.fc7. |
Created attachment 131967 [details] program for generating pngs