public void startup(Display display, Map<String, String> properties) throws Exception {
String language = properties.get(LANGUAGE_KEY);
Locale locale = (language == null) ? Locale.getDefault() : new Locale(language);
Resources resources = new Resources(getClass().getName(), locale);
Theme theme = Theme.getTheme();
Font font = theme.getFont();
// Search for a font that can support the sample string
String sampleResource = (String)resources.get("firstName");
if (font.canDisplayUpTo(sampleResource) != -1) {
Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
for (int i = 0; i < fonts.length; i++) {
if (fonts[i].canDisplayUpTo(sampleResource) == -1) {
theme.setFont(fonts[i].deriveFont(Font.PLAIN, 12));
break;
}
}
}