@Override
    public Shape getGlyphVisualBounds(int glyphIndex) {
        if ((glyphIndex < 0) || (glyphIndex >= this.getNumGlyphs())) {
            // awt.43=glyphIndex is out of vector's limits
            throw new IndexOutOfBoundsException(Messages.getString("awt.43")); //$NON-NLS-1$
        }

        int idx  = glyphIndex << 1;

        AffineTransform fontTransform = this.transform;
        double xOffs = fontTransform.getTranslateX();
        double yOffs = fontTransform.getTranslateY();

        if (vector[glyphIndex].getWidth() == 0){
            return new Rectangle2D.Float((float)xOffs, (float)yOffs, 0, 0);
        }

        AffineTransform at = AffineTransform.getTranslateInstance(xOffs, yOffs);
        AffineTransform glyphTransform = getGlyphTransform(glyphIndex);

        if (transform.isIdentity() && ((glyphTransform == null) || glyphTransform.isIdentity())){
            Rectangle2D blackBox = vector[glyphIndex].getGlyphMetrics().getBounds2D();
            at.translate(visualPositions[idx], visualPositions[idx+1]);
            return(at.createTransformedShape(blackBox));
        }

        GeneralPath shape = (GeneralPath)this.getGlyphOutline(glyphIndex);
        shape.transform(at);
        return shape.getBounds2D();
    }