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

[Font] Support Font Weights other than Bold and Regular, like Light

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u20
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
      None
    • Environment:

      All

      Description

      All font weights other than FontWeight.BOLD are ignored. To get the light font you want to do something like this:

          private static final Font UNIT_FONT = Font.font("Segoe UI", FontWeight.LIGHT, 24);

      We have the API but it is ignored and not implemented at the moment. The only way to get a light font is via its name not family name. Like:

          private static final Font UNIT_FONT = new Font("Segoe UI Light",24);

      You can see where it is ignored in:
      com.sun.javafx.font.PrismFontLoader#font(String family, FontWeight weight, FontPosture posture, float size)

      It even has a comment that we should come back and fix it :-)


              // REMIND. Some day need to have better granularity.

              boolean bold = weight != null &&
                             weight.ordinal() >= FontWeight.BOLD.ordinal();
              boolean italic = posture == FontPosture.ITALIC;
              PGFont prismFont = fontFactory.createFont(family, bold, italic, size);

      So at the moment its just treated as 2 booleans not a enum from Prism down.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jasper Jasper Potts (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Imported: