static void drawTextDecorations(
            TextRunSegment trs, Graphics2D g2d,
            float xOffset, float yOffset
    ) {
        Decoration d = trs.decoration;

        if (!d.ulOn && d.imUlStroke == null && !d.strikeThrough) {
            return; // Nothing to do
        }

        float left = xOffset + (float) trs.getLogicalBounds().getMinX();
        float right = xOffset + (float) trs.getLogicalBounds().getMaxX();

        Stroke savedStroke = g2d.getStroke();

        d.getStrokes(trs.metrics);

        if (d.strikeThrough) {
            float y = trs.y + yOffset + trs.metrics.strikethroughOffset;
            g2d.setStroke(d.strikeThroughStroke);
            g2d.draw(new Line2D.Float(left, y, right, y));
        }

        if (d.ulOn) {
            float y = trs.y + yOffset + trs.metrics.underlineOffset;
            g2d.setStroke(d.ulStroke);
            g2d.draw(new Line2D.Float(left, y, right, y));
        }

        if (d.imUlStroke != null) {
            float y = trs.y + yOffset + trs.metrics.underlineOffset;
            g2d.setStroke(d.imUlStroke);
            g2d.draw(new Line2D.Float(left, y, right, y));
            if (d.imUlStroke2 != null) {
                y++;
                g2d.setStroke(d.imUlStroke2);
                g2d.draw(new Line2D.Float(left, y, right, y));
            }
        }

        g2d.setStroke(savedStroke);
    }