* @param color The <code>Color</code> to use when displaying
     *       the <code>nameString</code>.
     * @param font a <code>Font</code> value
     * @return The image that was created.
     */
    public Image createStringImage(Graphics g, String nameString, Color color, Font font) {
        if (color == null) {
            logger.warning("createStringImage called with color null");
            color = Color.WHITE;
        }

        // Lookup in the cache if the image has been generated already
        String key = "dynamic.stringImage." + nameString
            + "." + font.getFontName().replace(' ', '-')
            + "." + Integer.toString(font.getSize())
            + "." + Integer.toHexString(color.getRGB());
        Image image = (Image) ResourceManager.getImage(key);//, lib.getScalingFactor());
        if (image != null) {
            return image;
        }

        // create an image of the appropriate size
        FontMetrics fontMetrics = g.getFontMetrics(font);
        BufferedImage bi = new BufferedImage(fontMetrics.stringWidth(nameString) + 4,
                                             fontMetrics.getMaxAscent() + fontMetrics.getMaxDescent(),
                                             BufferedImage.TYPE_INT_ARGB);
        // draw the string with selected color
        Graphics2D big = bi.createGraphics();
        big.setColor(color);
        big.setFont(font);
        big.drawString(nameString, 2, fontMetrics.getMaxAscent());

        // draw the border around letters
        int textColor = color.getRGB();
        int borderColor = getStringBorderColor(color).getRGB();
        for (int biX = 0; biX < bi.getWidth(); biX++) {
            for (int biY = 0; biY < bi.getHeight(); biY++) {
                int r = bi.getRGB(biX, biY);

                if (r == textColor) {
                    continue;
                }

                for (int cX = -1; cX <= 1; cX++) {
                    for (int cY = -1; cY <= 1; cY++) {
                        if (biX+cX >= 0 && biY+cY >= 0
                            && biX+cX < bi.getWidth() && biY+cY < bi.getHeight()
                            && bi.getRGB(biX + cX, biY + cY) == textColor) {
                            bi.setRGB(biX, biY, borderColor);
                            continue;
                        }
                    }
                }
            }
        }
        ResourceManager.addGameMapping(key, new ImageResource(bi));
        return (Image) ResourceManager.getImage(key);//, lib.getScalingFactor());
    }