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; // 画字符串