|
Duplicate :
|
|
|
Duplicate :
|
|
|
Duplicate :
|
|
|
Relates :
|
J2SE Version (please include all output from java -version flag):
Not working Java versions:
java.version: 1.7.0_75 Java(TM) SE Runtime Environment Linux amd64
java.version: 1.8.0_40 Java(TM) SE Runtime Environment Linux amd64
java.version: 1.8.0_45 Java(TM) SE Runtime Environment Windows 8.1 x86
java.version: 1.9.0-ea Java(TM) SE Runtime Environment Windows 8.1 x86
Working versions:
java.version: 1.7.0_75 OpenJDK Runtime Environment Linux amd64 =>
Does this problem occur on J2SE 6ux or 7ux? Yes / No (pick one)
This feature was added in Java 7.
Operating System Configuration Information (be specific):
Different OS (Windows, Linux)
Hardware Configuration Information (be specific):
Different systems
Bug Description:
The follow test program (also attached) returns a negative string width for
an OpenType fonts with Java SE. It works with OpenJDK. With Java SE it
returns -5 pixel as string width for the word "Test". On OpenJDK it returns
38 pixel.
Steps to Reproduce (be specific):
public static void main( String[] args ) throws FontFormatException,
IOException {
BufferedImage img = new BufferedImage( 100, 100,
BufferedImage.TYPE_INT_RGB );
Graphics2D g = img.createGraphics();
g.setFont( Font.createFont( Font.TRUETYPE_FONT, new
File("AdobeMingStd-Light.otf") ).deriveFont( 18f ) );
int stringWidth = g.getFontMetrics().stringWidth( "Test" );
System.out.println( "java.version: " + System.getProperty(
"java.version" )+" "+System.getProperty("java.runtime.name")+"
"+System.getProperty( "os.name" )+" "+System.getProperty( "os.arch" )+" =>
stringWidth: "+stringWidth );
}
|