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

XMLWordPrintable

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

      All

      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.

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

              Created:
              Updated:
              Imported: