word is too long: try to use less letters, smaller font or bigger background: text bounds = {tex...

今天测试验证码,出现了如图的错误

java.awt.geom.Rectangle2D$Float[x=0.0,y=-46.411133,w=31.738281,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0

java.awt.geom.Rectangle2D$Float[x=17.24421,y=-46.411133,w=40.893555,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0

java.awt.geom.Rectangle2D$Float[x=39.462715,y=-46.411133,w=40.893555,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0

java.awt.geom.Rectangle2D$Float[x=61.681206,y=-46.411133,w=34.79004,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0

java.awt.geom.Rectangle2D$Float[x=80.583496,y=-46.411133,w=33.740234,h=58.203125] ascent=46.411133 descent=11.791992 leading=0.0

} with fonts {java.awt.Font[family=Dialog,name=Bell MT,style=bold,size=50]

java.awt.Font[family=Dialog,name=Credit valley,style=italic,size=50]

java.awt.Font[family=Dialog,name=Bell MT,style=plain,size=50]

java.awt.Font[family=Dialog,name=Credit valley,style=plain,size=50]

java.awt.Font[family=Dialog,name=Credit valley,style=bold,size=50]

} versus image width = 110, height = 100

at com.octo.captcha.image.gimpy.GimpyFactory.getImageCaptcha(GimpyFactory.java:84)

at com.octo.captcha.engine.image.ImageCaptchaEngine.getNextCaptcha(ImageCaptchaEngine.java:73)

at com.octo.captcha.service.AbstractCaptchaService.generateAndStoreCaptcha(AbstractCaptchaService.java:156)

at com.octo.captcha.service.AbstractManageableCaptchaService.generateCountTimeStampAndStoreCaptcha(AbstractManageableCaptchaService.java:342)

at com.octo.captcha.service.AbstractManageableCaptchaService.generateAndStoreCaptcha(AbstractManageableCaptchaService.java:331)

at com.octo.captcha.service.AbstractCaptchaService.getChallengeForID(AbstractCaptchaService.java:83)

at com.octo.captcha.service.image.AbstractManageableImageCaptchaService.getImageChallengeForID(AbstractManageableImageCaptchaService.java:62)

at com.pcitc.ecmall.international.user.util.ImageValidateCode.imageValidateCode(ImageValidateCode.java:34)

at com.pcitc.ecmall.international.user.controller.RegisterMultilingualController.initValidateCode(RegisterMultilingualController.java:318)

at sun.reflect.GeneratedMethodAccessor517.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)

字体的问题,翻看日志,分析日志,

下面三行报错代码:

java.awt.Font[family=Dialog,name=Bell MT,style=bold,size=50]

java.awt.Font[family=Dialog,name=Credit valley,style=italic,size=50]

java.awt.Font[family=Dialog,name=Bell MT,style=plain,size=50]

java.awt.Font[family=Dialog,name=Credit valley,style=plain,size=50]

java.awt.Font[family=Dialog,name=Credit valley,style=bold,size=50]

然后把name的三个字体在windows下找到,放到centos下,在/usr/share/fonts/ 下创建三个目录,分别把三个字体的文件存放进去,然后执行 fc-cache 重新加载字体;

[root@bogon fonts]# pwd

/usr/share/fonts

[root@bogon fonts]# ls

arial lyx tahoma Verdana

[root@bogon fonts]# fc-cache

问题解决,如果自己的电脑上找不到字体,去百度然后下载下来

你可能感兴趣的:(word is too long: try to use less letters, smaller font or bigger background: text bounds = {tex...)