_glyphPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
_glyphPath = new GeneralPath(GeneralPath.WIND_NON_ZERO);
    public void paint(Graphics graphics) {        super.paint(graphics);        if (_glyph == null) {            return;        }        Graphics2D g2d = (Graphics2D) graphics;        int unitsPerEmBy2 = _font.getHeadTable().getUnitsPerEm() / 2;        _translateX = 2 * unitsPerEmBy2;        _translateY = 2 * unitsPerEmBy2;                AffineTransform at = g2d.getTransform();        AffineTransform atOriginal = new AffineTransform(at);        at.scale(_scaleFactor, _scaleFactor);        at.translate(_translateX, _translateY);        g2d.setTransform(at);        // Draw grid        g2d.setPaint(Color.gray);        g2d.draw(new Line2D.Float(-unitsPerEmBy2, 0, unitsPerEmBy2, 0));        g2d.draw(new Line2D.Float(0, -unitsPerEmBy2, 0, unitsPerEmBy2));        // Draw guides        g2d.setPaint(Color.lightGray);        g2d.draw(new Line2D.Float(-unitsPerEmBy2, -_font.getAscent(), unitsPerEmBy2, -_font.getAscent()));        g2d.draw(new Line2D.Float(-unitsPerEmBy2, -_font.getDescent(), unitsPerEmBy2, -_font.getDescent()));        g2d.draw(new Line2D.Float(_glyph.getLeftSideBearing(), -unitsPerEmBy2, _glyph.getLeftSideBearing(), unitsPerEmBy2));        g2d.draw(new Line2D.Float(_glyph.getAdvanceWidth(), -unitsPerEmBy2, _glyph.getAdvanceWidth(), unitsPerEmBy2));        // Draw contours        g2d.setPaint(Color.black);        int firstIndex = 0;        int count = 0;        int i;        if (_glyphPath == null) {            _glyphPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD);            // Iterate through all of the points in the glyph.  Each time we find a            // contour end point, add the point range to the path.            for (i = 0; i < _glyph.getPointCount(); i++) {                count++;                if (_glyph.getPoint(i).endOfContour) {                    addContourToPath(_glyphPath, firstIndex, count);                    firstIndex = i + 1;                    count = 0;                }            }        }                // Render the glyph path        if (_preview) {            g2d.fill(_glyphPath);        } else {            g2d.draw(_glyphPath);        }        if (_drawControlPoints) {            g2d.setTransform(atOriginal);            // Draw control points            for (i = 0; i < _glyph.getPointCount(); i++) {                int x = (int) (_scaleFactor * (_glyph.getPoint(i).x + _translateX));                int y = (int) (_scaleFactor * (-_glyph.getPoint(i).y + _translateY));                // Set the point colour based on selection                if (_selectedPoints.contains(_glyph.getPoint(i))) {                    g2d.setPaint(Color.blue);                } else {                    g2d.setPaint(Color.black);                }                                // Draw the point based on its type (on or off curve)                if (_glyph.getPoint(i).onCurve) {                    g2d.fill(new Rectangle2D.Float(x - 2, y - 2, 5, 5));                } else {                    g2d.draw(new Rectangle2D.Float(x - 2, y - 2, 5, 5));                }                g2d.drawString(Integer.toString(i), x + 4, y - 4);            }        }    }    