Browse Source

验证码图片自定义字体

andy 1 year ago
parent
commit
ae7256f101
1 changed files with 1 additions and 2 deletions
  1. 1 2
      mainFactory/src/main/java/org/bfkj/utils/GenerateImage.java

+ 1 - 2
mainFactory/src/main/java/org/bfkj/utils/GenerateImage.java

@@ -56,9 +56,8 @@ public class GenerateImage {
         if (font == null) {
             File fontFile = new ClassPathResource("font/SourceHanSansSC-Regular-2.otf").getFile();
             font = Font.createFont(Font.TRUETYPE_FONT, fontFile);
-//            改变字体大小
-            font = font.deriveFont((float) (HEIGHT - 10));
         }
+        font.deriveFont((float) (HEIGHT - 10));
         graphics.setFont(font);
 
         int desX, desY, distance = 16;