Font font = null;
if (cache != null) {
if ((font = (Font) cache.get(name)) != null) {
return font;
}
}
String fName = "fonts/" + name;
try {
InputStream is = ClassLoader.getSystemResourceAsStream(fName);
font = Font.createFont(Font.TRUETYPE_FONT, is);
} catch (Exception ex) {
ex.printStackTrace();
System.err.println(fName + " not loaded. Using serif font.");
font = new Font("serif", Font.PLAIN, 24);
}
return font;