Login

    Register

Managed Hosting

PROJECT CATEGORIES

 

ImageUtils
Project Home Known Issues Contact Project

ImageUtils Issue: getCenteredTextPosition fails on all numeric text (e.g. 12345)

Name: getCenteredTextPosition fails on all numeric text (e.g. 12345)
ID: 5
Project: ImageUtils
Type: Bug
Area: Code
Severity: Low
Status: Open
Related URL:
Creator: Charlie Griefer
Created: 11/21/10 12:46 PM
Updated: 11/21/10 12:46 PM
Description: If you pass a string consisting of all numeric characters to getCenteredTextPosition(), you get an exception thrown on line 1058:

<cfset textLayout = createObject("java", "java.awt.font.TextLayout").init( arguments.text, textFont, context)>

The init() method expects the first argument to be a string, but if the string is comprised of all digits, it fails as Java can't find an init() with that particular method signature ( first arg as int).

Solution is to javacast the first argument to a string:

<cfset textLayout = createObject("java", "java.awt.font.TextLayout").init( javacast( 'string', arguments.text ), textFont, context)>
History: Created by cgriefer (Charlie Griefer) : 11/21/10 12:46 PM

To add a comment to this bug, please login using the link above.