|
@@ -113,7 +113,7 @@ public class QRCodeUtilEx {
|
|
|
g2.clearRect(0, 0, width, height);
|
|
g2.clearRect(0, 0, width, height);
|
|
|
g2.setPaint(Color.BLACK);
|
|
g2.setPaint(Color.BLACK);
|
|
|
FontRenderContext context = g2.getFontRenderContext();
|
|
FontRenderContext context = g2.getFontRenderContext();
|
|
|
- Font font = new Font("微软雅黑", Font.BOLD, FONT_SIZE);
|
|
|
|
|
|
|
+ Font font = new Font("宋体", Font.BOLD, FONT_SIZE);
|
|
|
g2.setFont(font);
|
|
g2.setFont(font);
|
|
|
LineMetrics lineMetrics = font.getLineMetrics(str, context);
|
|
LineMetrics lineMetrics = font.getLineMetrics(str, context);
|
|
|
FontMetrics fontMetrics = FontDesignMetrics.getMetrics(font);
|
|
FontMetrics fontMetrics = FontDesignMetrics.getMetrics(font);
|
|
@@ -121,9 +121,7 @@ public class QRCodeUtilEx {
|
|
|
float y =
|
|
float y =
|
|
|
(height + lineMetrics.getAscent() - lineMetrics.getDescent() - lineMetrics.getLeading())
|
|
(height + lineMetrics.getAscent() - lineMetrics.getDescent() - lineMetrics.getLeading())
|
|
|
/ 2;
|
|
/ 2;
|
|
|
-
|
|
|
|
|
g2.drawString(str, (int) offset, (int) y);
|
|
g2.drawString(str, (int) offset, (int) y);
|
|
|
-
|
|
|
|
|
return textImage;
|
|
return textImage;
|
|
|
}
|
|
}
|
|
|
|
|
|