-
Bug
-
Resolution: Fixed
-
P4
-
7
-
b112
-
x86
-
linux
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2201356 | OpenJDK6 | Philip Race | P4 | Resolved | Fixed | b21 |
FULL PRODUCT VERSION :
java version "1.7.0_89-icedtea"
OpenJDK Runtime Environment (IcedTea7 1.14-pre+r90b892525f1b) (Fedora build 1.7.0_89-icedtea-b89)
OpenJDK 64-Bit Server VM (build 18.0-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux hostname 2.6.33.8-149.fc13.x86_64 #1 SMP Tue Aug 17 22:53:15 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The calculation used by the GTK Look and Feel results in font sizes that are slightly different from the rest of applications using GTK. As the comment in lookupFont in jdk/com/sun/java/swing/plaf/gtk/PangoFonts.java [1] explains:
* 3) Because of rounding errors sizes may differ very slightly
* between JDK and GTK. To fix that would at the very least require
* Swing to specify floating pt font sizes.
* Eg "10 pts" for GTK at 96 dpi to get the same size at Java 2D's
* 72 dpi you'd need to specify exactly 13.33.
A patch to fix the problem is available [2] and was approved [3].
[1] http://hg.openjdk.java.net/jdk7/swing/jdk/file/23f72ec0d8e8/src/share/classes/com/sun/java/swing/plaf/gtk/PangoFonts.java
[2] http://cr.openjdk.java.net/~omajid/webrevs/gtk-floating-point-font-size-support/webrev.01/
[3] http://mail.openjdk.java.net/pipermail/swing-dev/2010-August/001144.html
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compare the font sizes of the menu produce by the test case with the font size of gnome-terminal
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The size of the fonts in the JMenu should be the same as the font sizes in a native gtk application, such as gnome-terminal.
ACTUAL -
Font sizes are differnt.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
public class FontSizeTest {
public static void main(String[] arg) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final JMenuBar mb = new JMenuBar();
final JMenu file = new JMenu("File");
file.setMnemonic(KeyEvent.VK_F);
mb.add(file);
final JMenu edit = new JMenu("Edit");
edit.setMnemonic(KeyEvent.VK_E);
mb.add(edit);
final JMenu view = new JMenu("View");
view.setMnemonic(KeyEvent.VK_V);
mb.add(view);
final JMenu term = new JMenu("Terminal");
term.setMnemonic(KeyEvent.VK_T);
mb.add(term);
final JMenu help = new JMenu("Help");
help.setMnemonic(KeyEvent.VK_H);
mb.add(help);
final JFrame frame = new JFrame();
frame.setJMenuBar(mb);
frame.setSize(400, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
java version "1.7.0_89-icedtea"
OpenJDK Runtime Environment (IcedTea7 1.14-pre+r90b892525f1b) (Fedora build 1.7.0_89-icedtea-b89)
OpenJDK 64-Bit Server VM (build 18.0-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux hostname 2.6.33.8-149.fc13.x86_64 #1 SMP Tue Aug 17 22:53:15 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
The calculation used by the GTK Look and Feel results in font sizes that are slightly different from the rest of applications using GTK. As the comment in lookupFont in jdk/com/sun/java/swing/plaf/gtk/PangoFonts.java [1] explains:
* 3) Because of rounding errors sizes may differ very slightly
* between JDK and GTK. To fix that would at the very least require
* Swing to specify floating pt font sizes.
* Eg "10 pts" for GTK at 96 dpi to get the same size at Java 2D's
* 72 dpi you'd need to specify exactly 13.33.
A patch to fix the problem is available [2] and was approved [3].
[1] http://hg.openjdk.java.net/jdk7/swing/jdk/file/23f72ec0d8e8/src/share/classes/com/sun/java/swing/plaf/gtk/PangoFonts.java
[2] http://cr.openjdk.java.net/~omajid/webrevs/gtk-floating-point-font-size-support/webrev.01/
[3] http://mail.openjdk.java.net/pipermail/swing-dev/2010-August/001144.html
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compare the font sizes of the menu produce by the test case with the font size of gnome-terminal
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The size of the fonts in the JMenu should be the same as the font sizes in a native gtk application, such as gnome-terminal.
ACTUAL -
Font sizes are differnt.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
public class FontSizeTest {
public static void main(String[] arg) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final JMenuBar mb = new JMenuBar();
final JMenu file = new JMenu("File");
file.setMnemonic(KeyEvent.VK_F);
mb.add(file);
final JMenu edit = new JMenu("Edit");
edit.setMnemonic(KeyEvent.VK_E);
mb.add(edit);
final JMenu view = new JMenu("View");
view.setMnemonic(KeyEvent.VK_V);
mb.add(view);
final JMenu term = new JMenu("Terminal");
term.setMnemonic(KeyEvent.VK_T);
mb.add(term);
final JMenu help = new JMenu("Help");
help.setMnemonic(KeyEvent.VK_H);
mb.add(help);
final JFrame frame = new JFrame();
frame.setJMenuBar(mb);
frame.setSize(400, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
- backported by
-
JDK-2201356 Rounding error in font sizes selected by the GTK Look and Feel
-
- Resolved
-
- duplicates
-
JDK-6807469 Rounding dpi to integral in PangoFonts.java
-
- Closed
-