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

Text element height with "Logical" bounds exhibits inconsistent behaviour.

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      Consider a function textHeight which takes a String, a Font and a TextBoundsType and returns the height of a Text element constructed from these parameters by constructing a local Text instance t and returning t.getLayoutBounds().getHeight(). Now fix a String s and a Font f, observe the output of calling:

      textHeight(s, f, TextBoundsType.LOGICAL); // A
      textHeight(s, f, TextBoundsType.LOGICAL_VERTICAL_CENTER); // B
      textHeight(s, f, TextBoundsType.LOGICAL); // C

      The result of lines A and C is affected by line B, that is A and C return different results. If you remove B then A and C return the same result (as they clearly should because textHeight is a pure function).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Implement the simple function described above or copy and paste code from this question: https://stackoverflow.com/questions/52424073/strange-javafx-behaviour-related-to-size-of-text-elements?noredirect=1#comment91803770_52424073


      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              aghaisas Ajit Ghaisas
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: