I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Unverified Commit 54f3f7a8 authored by zzz's avatar zzz
Browse files

imagegen: QR code text size/placement tweaks

parent 2093131f
No related branches found
No related tags found
No related merge requests found
......@@ -162,7 +162,7 @@ public class QRServlet extends HttpServlet {
g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
// scale font
float shrink = Math.min(1.0f, 14.0f / text.length());
int pts = Math.round(shrink * 16.0f * size / 160);
int pts = Math.min(28, Math.round(shrink * 16.0f * size / 160));
Font font = new Font(DEFAULT_FONT_NAME, Font.BOLD, pts);
g.setFont(font);
Color color = Color.BLACK;
......@@ -172,7 +172,7 @@ public class QRServlet extends HttpServlet {
double swidth = font.getStringBounds(text, 0, text.length(),
g.getFontRenderContext()).getBounds().getWidth();
int x = (width - (int) swidth) / 2;
int y = height - 10;
int y = height - 6;
g.drawString(text, x, y);
if (!ImageIO.write(bi, IDENTICON_IMAGE_FORMAT, byteOut))
throw new IOException("ImageIO.write() fail");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment