Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8356570

PrismTextLayout: incorrect computation of next tab position

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • jfx24
    • javafx
    • None

      While working on https://bugs.openjdk.org/browse/JDK-8314482 accidentally came across a subtle bug in the code that computes the next tab position. The probability of hitting the bug is rather low as it only happens with certain fonts(s?) and specific size(s?).

      The bug can be reproduced in the monkey tester using TextArea and InaiMathi font of size 24, which produces the float value of tabAdvance 57.6.

      The offending line in PrismTextLayout:1249

      ```
      float tabStop = ((int)(lineWidth / tabAdvance) +1) * tabAdvance;
      ```

      this formula fails to advance the tabStop when lineWidth (the current position) is 172.79999

      lineWidth=172.79999 next=172.79999

      (please see the screenshots with font sizes 16 (ok) and 24 (fail))
       

            angorya Andy Goryachev
            angorya Andy Goryachev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: