void updateFont () {
updateFont(false);
}
private void updateFont (boolean ignoreFileText) {
UnicodeFont unicodeFont;
int fontSize = ((Integer)fontSizeSpinner.getValue()).intValue();
File file = new File(fontFileText.getText());
if (!ignoreFileText && file.exists() && file.isFile()) {
// Load from file.
fontFileRadio.setSelected(true);
fontList.setEnabled(false);
systemFontRadio.setEnabled(false);
try {
unicodeFont = new UnicodeFont(fontFileText.getText(), fontSize, boldCheckBox.isSelected(),
italicCheckBox.isSelected());
} catch (Throwable ex) {
ex.printStackTrace();
updateFont(true);
return;
}
} else {
// Load from java.awt.Font (kerning not available!).
fontList.setEnabled(true);
systemFontRadio.setEnabled(true);
systemFontRadio.setSelected(true);
unicodeFont = new UnicodeFont(Font.decode((String)fontList.getSelectedValue()), fontSize, boldCheckBox.isSelected(),
italicCheckBox.isSelected());
}
unicodeFont.setPaddingTop(((Integer)padTopSpinner.getValue()).intValue());
unicodeFont.setPaddingRight(((Integer)padRightSpinner.getValue()).intValue());
unicodeFont.setPaddingBottom(((Integer)padBottomSpinner.getValue()).intValue());
unicodeFont.setPaddingLeft(((Integer)padLeftSpinner.getValue()).intValue());
unicodeFont.setPaddingAdvanceX(((Integer)padAdvanceXSpinner.getValue()).intValue());
unicodeFont.setPaddingAdvanceY(((Integer)padAdvanceYSpinner.getValue()).intValue());
unicodeFont.setGlyphPageWidth(((Integer)glyphPageWidthCombo.getSelectedItem()).intValue());
unicodeFont.setGlyphPageHeight(((Integer)glyphPageHeightCombo.getSelectedItem()).intValue());
unicodeFont.setNativeRendering(nativeRadio.isSelected());
for (Iterator iter = effectPanels.iterator(); iter.hasNext();) {
EffectPanel panel = (EffectPanel)iter.next();
unicodeFont.getEffects().add(panel.getEffect());
}
int size = sampleTextPane.getFont().getSize();
if (size < 14) size = 14;
sampleTextPane.setFont(unicodeFont.getFont().deriveFont((float)size));
this.newUnicodeFont = unicodeFont;
}