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

inconsistent behaviour creating font with size 0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 7u6
    • javafx
    • None

      debug the following snippet of code and inspect the values as shown in the picture.
              Font font1 = new Font("Tahoma", 0);
              Font font2 = Font.font("Tahoma", 0);

      note that font2.nativeFont.fontSize == 1

      that happens because of this line in PrismFontLoader#font(family, weight, posture, size)
      float fontSize = size <= 0 ? 1 : size;

      Is this line of code there by accident how it really means what it is doing ?

      Note that fontSize < 0 means use default, but that is all taken care in Font.

            fheidric Felipe Heidrich (Inactive)
            fheidric Felipe Heidrich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: