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

Spacing of default bold font is odd

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
    • Environment:

      Product: javafx-2.0beta
      Platform: macosx-universal
      Build-Number: 213
      Build-ID: 2011-07-21_13-17-35

      Description

      This program produces the bold version of the default font using Font.font(defaultFont.getFamily(), FontWeight.BOLD, defaultFont.getSize()). That is the same font as the one you get with a CSS rule such as -fx-font-weight: bold, so we can expect that people will be seeing it often. On both Windows and Mac the spacing is wrong, as you can see in the attached screenshots. I suspect that the font metrics are being scaled to non-integer widths, but whatever the reason it is obviously not right for the spacing of the same letters to be different depending only on what letters precede them.

      I do not think that this is a problem with sub-pixel positioning as in RT-14423.

      public class DeleteMe extends Application {
          public static void main(String[] args) {
              launch(args);
          }

          @Override public void start(Stage stage) throws Exception {
              Font defaultFont = Font.getDefault();
              Font defaultBold = Font.font(defaultFont.getFamily(), FontWeight.BOLD, defaultFont.getSize());
              Label background = LabelBuilder.create().text("Background color").font(defaultBold).build();
              Label foreground = LabelBuilder.create().text("Foreground color").font(defaultBold).build();
              VBox vbox = VBoxBuilder.create().children(background, foreground).build();
              StageBuilder.create().scene(new Scene(vbox)).visible(true).applyTo(stage);
          }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              prr Philip Race
              Reporter:
              emcmanuswse Eamonn McManus (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported: