Title:
Bug 82890:(Watson Migration Closure)[ANeff] Bug for: imageDrawText() draws at wrong x-coordinate
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/
Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)
Created: 05/15/2010
Components: CFIMAGE
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Minor / Unknown
Locale/System: English / Win All
Vote Count: 0
Problem:
[ANeff] Bug for: imageDrawText() draws at wrong x-coordinate.1) If 1st character of text string has a straight left edge (ex: "l, b, m, etc"), then imageDrawText() begins drawing the text @ x+22) If 1st character of text string has a curved left edge (ex: "o, d, c, etc"), then imageDrawText() begins drawing the text @ x+1Related thread: https://prerelease.adobe.com/r/?4822f6f6135044fd97c6aa46e36f52d7
Method:
<cfscript>
myImage = imageNew("", 150, 150, "rgb", "orange");
myText = {x=50, y=100, string="by"};
myTextAttributes = {font="Arial", style="plain", size=24};
imageDrawText(myImage, myText.string, myText.x, myText.y, myTextAttributes);//bug?: imageDrawText() adds 1-2px to ’x’ (ex: 1px when text is "by"; 2px when text is "oy")
imageSetDrawingColor(myImage, "red");
imageDrawRect(myImage, 0, 0, myText.x, myText.y, true);//bug?: imageDrawRect() adds 1px to both width and height
</cfscript>
<cfimage action="writetobrowser" source="#myImage#" />
<!--- draw line around text, to illustrate imageDrawText() bug --->
<cfscript>
fontObject = createObject("java", "java.awt.Font");
myFont = fontObject.init(myTextAttributes.font, fontObject.plain, myTextAttributes.size);
myImageGraphics = imageGetBufferedImage(myImage).getGraphics();
myImageGraphicsFontRenderContext = myImageGraphics.getFontRenderContext();
textLayoutObject = createObject("java", "java.awt.font.TextLayout");
myTextLayout = textLayoutObject.init(myText.string, myFont, myImageGraphicsFontRenderContext);
myTextLayoutPixelBounds = myTextLayout.getPixelBounds(myImageGraphicsFontRenderContext, myText.x, myText.y);
imageSetDrawingColor(myImage, "blue");
imageSetDrawingTransparency(myImage, 50);
imageDrawRect(myImage, myTextLayoutPixelBounds.x, myTextLayoutPixelBounds.y, myTextLayoutPixelBounds.width, myTextLayoutPixelBounds.height);
</cfscript>
<cfimage action="writetobrowser" source="#myImage#" />
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3041453
External Customer Info:
External Company:
External Customer Name: Aaron Neff
External Customer Email: 3D1D17B03C844EBF992001AC
External Test Config: 05/15/2010
Attachments:
Comments: