79437936

Date: 2025-02-13 23:12:38
Score: 2
Natty:
Report link

In fact, Gilbert's suggestion painted the string centered around the rotation point, so the rotated string has extra space (r.height - textWidth) / 2. If I subtract this value from x-position, it starts working perfectly. So, the simplified correct version should be:

            g2d.drawString(text, x0 - r.height / 2, y0 + fontMetrics.getDescent());

enter image description here

Reasons:
  • Blacklisted phrase (1): enter image description here
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Alex B.