@@ -336,8 +336,8 @@ public void setSkipIndex(final int skipIndex) {
336336 }
337337
338338 private static class ConvertFontToSprite {
339- private static BufferedImage WORK_IMAGE = new BufferedImage (64 , 64 , BufferedImage .TYPE_INT_ARGB );
340- private static Graphics2D GRAPHICS = WORK_IMAGE .createGraphics ();
339+ private static BufferedImage workImage = new BufferedImage (64 , 64 , BufferedImage .TYPE_INT_ARGB );
340+ private static Graphics2D graphics = workImage .createGraphics ();
341341
342342 private final int width ;
343343 private final int height ;
@@ -361,24 +361,24 @@ public static CharacterSprite getSprite(final char ch, final Font font) {
361361 int baseline = metrics .getAscent ();
362362 int fontHeight = baseline + metrics .getDescent ();
363363
364- if (fontWidth > WORK_IMAGE .getWidth () || fontHeight > WORK_IMAGE .getHeight ()) {
365- WORK_IMAGE = new BufferedImage (
366- Math .max (fontWidth , WORK_IMAGE .getWidth ()),
367- Math .max (fontHeight , WORK_IMAGE .getHeight ()),
364+ if (fontWidth > workImage .getWidth () || fontHeight > workImage .getHeight ()) {
365+ workImage = new BufferedImage (
366+ Math .max (fontWidth , workImage .getWidth ()),
367+ Math .max (fontHeight , workImage .getHeight ()),
368368 BufferedImage .TYPE_INT_ARGB
369369 );
370- GRAPHICS = WORK_IMAGE .createGraphics ();
370+ graphics = workImage .createGraphics ();
371371 metrics = initGraphicsForFont (font );
372372 fontWidth = metrics .charWidth (ch );
373373 baseline = metrics .getAscent ();
374374 fontHeight = baseline + metrics .getDescent ();
375375 }
376- GRAPHICS .setComposite (AlphaComposite .Clear );
377- GRAPHICS .fillRect (0 , 0 , WORK_IMAGE .getWidth (), WORK_IMAGE .getHeight ());
378- GRAPHICS .setComposite (AlphaComposite .SrcOver );
376+ graphics .setComposite (AlphaComposite .Clear );
377+ graphics .fillRect (0 , 0 , workImage .getWidth (), workImage .getHeight ());
378+ graphics .setComposite (AlphaComposite .SrcOver );
379379
380- GRAPHICS .setColor (Color .WHITE );
381- GRAPHICS .drawString (String .valueOf (ch ), 1 , baseline );
380+ graphics .setColor (Color .WHITE );
381+ graphics .drawString (String .valueOf (ch ), 1 , baseline );
382382
383383 ConvertFontToSprite result = new ConvertFontToSprite (fontWidth , fontHeight );
384384 return result .extractGlyph ();
@@ -390,7 +390,7 @@ private CharacterSprite extractGlyph() {
390390
391391 for (int y = 0 ; y < this .height ; y ++) {
392392 for (int x = 0 ; x < width ; x ++) {
393- if ((WORK_IMAGE .getRGB (x , y ) & 0xFF000000 ) != 0 ) {
393+ if ((workImage .getRGB (x , y ) & 0xFF000000 ) != 0 ) {
394394 minX = Math .min (minX , x );
395395 maxX = Math .max (maxX , x );
396396 }
@@ -414,16 +414,16 @@ private CharacterSprite toSprite(final int minX, final int maxX) {
414414 for (int y = 0 ; y < this .height ; y ++) {
415415 for (int x = 0 ; x < trimmedWidth ; x ++) {
416416 pixels [y * trimmedWidth + x ] =
417- (WORK_IMAGE .getRGB (x + minX , y ) & 0xFF000000 ) != 0 ;
417+ (workImage .getRGB (x + minX , y ) & 0xFF000000 ) != 0 ;
418418 }
419419 }
420420 return new CharacterSprite (trimmedWidth , this .height , minX , pixels );
421421 }
422422
423423 private static FontMetrics initGraphicsForFont (Font font ) {
424- GRAPHICS .setFont (font );
425- GRAPHICS .setRenderingHint (RenderingHints .KEY_TEXT_ANTIALIASING , RenderingHints .VALUE_TEXT_ANTIALIAS_OFF );
426- return GRAPHICS .getFontMetrics ();
424+ graphics .setFont (font );
425+ graphics .setRenderingHint (RenderingHints .KEY_TEXT_ANTIALIASING , RenderingHints .VALUE_TEXT_ANTIALIAS_OFF );
426+ return graphics .getFontMetrics ();
427427 }
428428
429429 }
0 commit comments