RFR: 8280020: Underline and line-through not straight in WebView
Kevin Rushforth
kcr at openjdk.java.net
Sat Feb 12 01:04:18 UTC 2022
On Thu, 10 Feb 2022 11:36:38 GMT, Jay Bhaskar <duke at 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)
I don't follow the last point about using the same origin and overlapped lines being wasteful.
It seems there are either two or three issues here.
1. Text underline and line-through are drawn slanted as described in this bug, which is a result of incorrectly adjusting the y coord one of the two end points passed into a `drawLine` call by the `thickness`.
2. The text is always drawn as a thin line, possibly because the stroke width doesn't take `thickness` into account (and while this could conceivably be done with `drawRect`, setting the stroke attributes and calling `drawLine` is the right way to do it).
3. MAYBE: there might be problem with drawing dashed line; if this doesn't work, the fix would probably be to set the dash pattern in the stroke.
This PR addresses the first problem, which is the problem described in the bug report. The propose change looks correct.
We could expand the bug report to cover at least the second case (since that is a somewhat related bug), but it might be better to file and fix that one separately (if it really is as simple as multiplying the existing stroke width by the thickness in the `drawLinesForText` method, then I wouldn't be opposed to fixing it in this PR, since it is somewhat related).
In any case, I think the third issue of line pattern should be dealt with separately, if in fact, it is a problem.
-------------
PR: https://git.openjdk.java.net/jfx/pull/731
More information about the openjfx-dev
mailing list