On Thu, 10 Feb 2022 11:36:38 GMT, Jay Bhaskar <d...@openjdk.java.net> wrote:

> Issue: The end point of  line in drawLinesForText , add thickness to the 
> endPoint.y(). In this case origin which is start point and the end point 
> would not be same, and line would be drawn not straight.
> Solution: Do not add thickness to the y position of end point of line.
> Start Point(x,y) ----------End Point(x + width, 0)

StrokeStyle savedStrokeStyle = strokeStyle();
        setStrokeStyle(stroke);
        float savedStrokeThickness = strokeThickness();
        setStrokeThickness(thickness);

        FloatPoint startPoint = origin + FloatPoint(0, thickness / 2);
        FloatPoint endPoint = startPoint + FloatPoint(width, 0);
        drawLine(
            IntPoint(startPoint.x(), startPoint.y()),
            IntPoint(endPoint.x(), endPoint.y()));

        setStrokeStyle(savedStrokeStyle);
        setStrokeThickness(savedStrokeThickness);

It works , and stroke thickness is effective.

-------------

PR: https://git.openjdk.java.net/jfx/pull/731

Reply via email to