X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFontChooser.java;h=2ffb166a98ac1f6891b0195e1575d3875e461ee0;hb=ec48924dda6dc02a967e413eea0a5fc6609c2ae3;hp=92d2b2b22efbf76e9d19ef427d703d1664c3c80c;hpb=5351b9fbb6e8a15f4c3cc83d8cc58cec4e1c016a;p=jalview.git diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index 92d2b2b..2ffb166 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -23,6 +23,7 @@ package jalview.gui; import java.awt.Font; import java.awt.FontMetrics; import java.awt.event.ActionEvent; +import java.awt.geom.Rectangle2D; import javax.swing.JInternalFrame; import javax.swing.JLayeredPane; @@ -241,14 +242,17 @@ public class FontChooser extends GFontChooser fontStyle.getSelectedIndex(), (Integer) fontSize.getSelectedItem()); FontMetrics fm = getGraphics().getFontMetrics(newFont); - double mw = fm.getStringBounds("M", getGraphics()).getWidth(), iw = fm - .getStringBounds("I", getGraphics()).getWidth(); + double mw = fm.getStringBounds("M", getGraphics()).getWidth(); + final Rectangle2D iBounds = fm.getStringBounds("I", getGraphics()); + double iw = iBounds.getWidth(); if (mw < 1 || iw < 1) { + final String messageKey = iBounds.getHeight() < 1 ? "label.font_doesnt_have_letters_defined" + : "label.font_too_small"; JOptionPane .showInternalMessageDialog( this, - MessageManager.getString("label.font_doesnt_have_letters_defined"), + MessageManager.getString(messageKey), MessageManager.getString("label.invalid_font"), JOptionPane.WARNING_MESSAGE); /* * Restore the changed value - note this will reinvoke this method via the