jfree/jfreechart-fse

Rendering problem in TextUtilities

graben opened this issue · 1 comments

Some texts gets rendered several times causing overlapping. Therefore drawRotatedString should return after usage of drawAlignedString.

public static void drawRotatedString(String text, Graphics2D g2,
float x, float y, TextAnchor textAnchor,
double angle, TextAnchor rotationAnchor) {

    if (text == null || text.equals("")) {
        return;
    }
    if (angle == 0.0) {
        drawAlignedString(text, g2, x, y, textAnchor);
        return;
    }
    float[] textAdj = deriveTextBoundsAnchorOffsets(g2, text, textAnchor, 
            null);
    float[] rotateAdj = deriveRotationAnchorOffsets(g2, text, 
            rotationAnchor);
    drawRotatedString(text, g2, x + textAdj[0], y + textAdj[1],
            angle, x + textAdj[0] + rotateAdj[0],
            y + textAdj[1] + rotateAdj[1]);

}

Thanks for letting me know. I've committed the fix.