private void generateCharDimensions() {
        Graphics2D g2 = (new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB)).createGraphics();
        g2.setFont(font);
        for (int i = 0; i < characterDimensions.length; i++) {
            characterDimensions[i] = font.layoutGlyphVector(g2.getFontRenderContext(), STANDARD_CHARS.toCharArray(), i, i+1, Font.LAYOUT_LEFT_TO_RIGHT).getPixelBounds(null, 0, 0);
            characterDimensions[i].y += size;
        }

        if (characterDimensions[' ' - FIRST_STANDARD_CHAR].width <= 0) {
            characterDimensions[' ' - FIRST_STANDARD_CHAR].width = (int)Math.round(size * DEFAULT_SPACE_RATIO);
        }

        descent = g2.getFontMetrics().getDescent();
        baseline = size - descent;

        g2.dispose();
    }