-
Bug
-
Resolution: Unresolved
-
P4
-
8, 9
-
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
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