Hi all,
My customer encountered this issue.
I think this issue is caused by Bug 1435 [1] and 1659 [2] in IcedTea.
I read source code of "freetype-2.5.0-4.fc20" .
Bold style should affect Font Glyph only. However, current implementation
of OpenJDK affects Font Face. Thus value of Ascent/Descent is incorrect.
OracleJDK seems to use sun.font.T2KFontScaler to calculate these values.
So this issue occurs in OpenJDK only.
I think we need to merge patches of Bug 1435 and 1659 in IcedTea
to fix JDK-8017773 .
Could you merge these patches ?
Please cooperate.
Thanks,
Yasumasa
[1] http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1435
[2] http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1659
------ D E T A I L S ------
I've created testcase as "JavaApplication1.java" .
Result as:
OracleJDK 6 Update 31
----------------
[root@RHEL6-5 font]# /usr/local/jdk1.6.0_31/bin/java JavaApplication1
JDK: 1.6.0_31
VM: Java HotSpot(TM) 64-Bit Server VM
java.awt.Font[family=IPAMincho,name=IPAMincho,style=plain,size=50]
Ascent: 43.99414
Descent: 6.0058594
java.awt.Font[family=IPAMincho,name=IPAMincho,style=bold,size=50]
Ascent: 43.99414
Descent: 6.0058594
----------------
OpenJDK7 (in RHEL6.5)
----------------
[root@RHEL6-5 font]# java JavaApplication1
JDK: 1.7.0_45
VM: OpenJDK 64-Bit Server VM
java.awt.Font[family=IPAMincho,name=IPAMincho,style=plain,size=50]
Ascent: 43.99414
Descent: 6.0058594
java.awt.Font[family=IPAMincho,name=IPAMincho,style=bold,size=50]
Ascent: 45.60547
Descent: 4.3945312
----------------
import java.awt.Font;
import java.awt.font.FontRenderContext;
import java.awt.font.TextLayout;
public class JavaApplication1 {
public static void main(String[] args) throws Exception {
System.out.println("JDK: " + System.getProperty("java.version"));
System.out.println(" VM: " + System.getProperty("java.vm.name"));
System.out.println();
Font plain = new Font("IPAMincho", Font.PLAIN, 50);
Font bold = new Font("IPAMincho", Font.BOLD, 50);
TextLayout plain_layout = new TextLayout("IPAMincho", plain,
new FontRenderContext(null, true, true));
TextLayout bold_layout = new TextLayout("IPAMincho", bold,
new FontRenderContext(null, true, true));
System.out.println(plain.toString());
System.out.println(" Ascent: " + plain_layout.getAscent());
System.out.println(" Descent: " + plain_layout.getDescent());
System.out.println();
System.out.println(bold.toString());
System.out.println(" Ascent: " + bold_layout.getAscent());
System.out.println(" Descent: " + bold_layout.getDescent());
}
}