if ("raster".equalsIgnoreCase(type)) {
String name = afpFontCfg.getAttribute("name", "Unknown");
// Create a new font object
RasterFont font = new RasterFont(name);
Configuration[] rasters = afpFontCfg.getChildren("afp-raster-font");
if (rasters.length == 0) {
log.error("Mandatory font configuration elements '<afp-raster-font...' are missing");
return null;
}
for (int j = 0; j < rasters.length; j++) {
Configuration rasterCfg = rasters[j];
String characterset = rasterCfg.getAttribute("characterset");
if (characterset == null) {
log.error("Mandatory afp-raster-font configuration attribute 'characterset=' is missing");
return null;
}
int size = rasterCfg.getAttributeAsInteger("size");
String base14 = rasterCfg.getAttribute("base14-font", null);
if (base14 != null) {
try {
Class clazz = Class.forName("org.apache.fop.fonts.base14."
+ base14);
try {
Typeface tf = (Typeface)clazz.newInstance();
font.addCharacterSet(size, new FopCharacterSet(
codepage, encoding, characterset, size, tf));
} catch (Exception ie) {
String msg = "The base 14 font class " + clazz.getName()
+ " could not be instantiated";
log.error(msg);
}
} catch (ClassNotFoundException cnfe) {
String msg = "The base 14 font class for " + characterset
+ " could not be found";
log.error(msg);
}
} else {
font.addCharacterSet(size, new CharacterSet(
codepage, encoding, characterset, path));
}
}
return new AFPFontInfo(font, tripleList);