On Sat, 2 Apr 2022 08:29:43 GMT, Jay Bhaskar <jbhas...@openjdk.org> wrote:
> Issue: Floating point overflow , when making end point for line drawing as > FloatPoint endPoint = startPoint + FloatPoint(widths.last(), 0); > Solution: traverse widths to calculate end point and increment start point. The TextDecorationPainter class is responsible to call GraphicsContextJava::drawLinesForText. Before that GraphicsContextJava::drawLinesForText the TextDecorationPainter class compute the rect based on the text decoration style, text origin. Before calling GraphicsContextJava::drawLinesForText, The TextDecorationPainter class creates arrays of intersection points from rect. // using DashArray = Vector<DashArrayElement>; DashArray boundaries = translateIntersectionPointsToSkipInkBoundaries(intersections, underlineBoundingBox.height(), rect.width()); m_context.drawLinesForText(rect.location(), rect.height(), boundaries, m_isPrinting, style == TextDecorationStyle::Double, strokeStyle); So following code as fix for (const auto& width : widths) { FloatPoint endPoint = startPoint + FloatPoint(width, 0); drawLine( IntPoint(startPoint.x(), startPoint.y()), IntPoint(endPoint.x(), endPoint.y())); startPoint = endPoint; } avoid arithmetic overflow as in previous fix we were calculating end point FloatPoint endPoint = startPoint + FloatPoint(widths.last(), 0); I have tested all style of line drawing , continuous , dashes , overflow and underline , it is working well with the recent fix. ------------- PR: https://git.openjdk.java.net/jfx/pull/765