Warning: session_start(): open(/var/lib/php/sessions/sess_dcm56q49qbtukdbu6135inlso6, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static new ThreadLocal renderText_fg;
static new ThreadLocal renderText_bg;
static BufferedImage renderText(S fontName, float fontSize, S text) {
ret renderText(loadFont_cached(fontName), fontSize, text);
}
static BufferedImage renderText(Font font, float fontSize, S text) {
Color background = optPar(renderText_bg, Color.white);
Color foreground = optPar(renderText_fg, Color.black);
font = font.deriveFont(fontSize);
// for font metrics
BufferedImage dummyImg = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
Graphics g = dummyImg.getGraphics();
g.setFont(font);
FontMetrics fm = g.getFontMetrics();
int width = fm.stringWidth(text);
if (width <= 0) null;
int height = fm.getHeight();
int y = fm.getAscent();
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
g = img.getGraphics();
g.setColor(background);
g.fillRect(0, 0, width, height);
g.setColor(foreground);
g.setFont(font);
g.drawString(text, 0, y);
g.dispose();
return img;
}