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

San Francisco fonts (SFNSText*) are created 2X scaled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8, 9
    • client-libs
    • 2d
    • x86
    • os_x

      El-Capitan San Francisco fonts are incorrectly handled by JDK. For example font /System/Library/Fonts/SFNSText-RegularG2.otf created 2X scaled

      java version "1.8.0_91"
      Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

      ======= SFFont.java ======
      import java.awt.*;
      import java.awt.image.BufferedImage;
      import java.io.File;

      public class SFFont {
          public static void main(String[] args) throws Exception{
              Graphics2D g2d = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB).createGraphics();
              Font sfFont = Font.createFont(Font.TRUETYPE_FONT,
                      new File("/System/Library/Fonts/SFNSText-RegularG2.otf")).deriveFont(12.0f);

              System.err.print(sfFont.getStringBounds("ABC", g2d.getFontRenderContext()).getHeight());
          }
      }

      $java SFFont
      22.95538330078125

            prr Philip Race
            avu Alexey Ushakov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: