From 371acb31989b93dbd29848d31d8b9f014771bb49 Mon Sep 17 00:00:00 2001 From: synchronized Date: Fri, 27 Jul 2018 16:30:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E6=95=88=E6=9E=9C=E5=92=8C=E5=B9=B2=E6=89=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 -- src/main/java/com/wf/captcha/SpecCaptcha.java | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e6ce35e..43f803c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # EasyCaptcha -![GitHub release](https://img.shields.io/github/release/whvcse/EasyCaptcha.svg?style=flat-square) -![GitHub Release Date](https://img.shields.io/github/release-date/whvcse/EasyCaptcha.svg?style=flat-square) ![JitPack](https://img.shields.io/jitpack/v/whvcse/EasyCaptcha.svg?style=flat-square) ![Hex.pm](https://img.shields.io/hexpm/l/plug.svg?style=flat-square) diff --git a/src/main/java/com/wf/captcha/SpecCaptcha.java b/src/main/java/com/wf/captcha/SpecCaptcha.java index eb78941..a7028bb 100644 --- a/src/main/java/com/wf/captcha/SpecCaptcha.java +++ b/src/main/java/com/wf/captcha/SpecCaptcha.java @@ -14,9 +14,11 @@ import javax.imageio.ImageIO; public class SpecCaptcha extends Captcha { public SpecCaptcha() { + setFont(new Font(font.getFontName(), Font.ITALIC, font.getSize())); } public SpecCaptcha(int width, int height) { + this(); setWidth(width); setHeight(height); } @@ -72,7 +74,7 @@ public class SpecCaptcha extends Captcha { g.setColor(color(100, 250)); g.drawOval(num(width), num(height), 5 + num(25), 5 + num(25)); } - g.setFont(new Font(font.getFontName(), Font.ITALIC, font.getSize())); + g.setFont(font); int h = height - ((height - font.getSize()) >> 1); int w = width / len; // 画字符串