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

今天測(cè)試驗(yàn)證碼,出現(xiàn)了如圖的錯(cuò)誤

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)

字體的問題,翻看日志,分析日志,

下面三行報(bào)錯(cuò)代碼:

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的三個(gè)字體在windows下找到,放到centos下,在/usr/share/fonts/ 下創(chuàng)建三個(gè)目錄,分別把三個(gè)字體的文件存放進(jìn)去,然后執(zhí)行 fc-cache 重新加載字體;

[root@bogon fonts]# pwd

/usr/share/fonts

[root@bogon fonts]# ls

arial lyx tahoma Verdana

[root@bogon fonts]# fc-cache

問題解決,如果自己的電腦上找不到字體,去百度然后下載下來

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容