eventProducer = AFPEventProducer.Provider.get(userAgent.getEventBroadcaster());
}
private AFPFontInfo buildFont(Configuration fontCfg, String fontPath)
throws ConfigurationException {
FontManager fontManager = this.userAgent.getFactory().getFontManager();
Configuration[] triple = fontCfg.getChildren("font-triplet");
List<FontTriplet> tripletList = new ArrayList<FontTriplet>();
if (triple.length == 0) {
eventProducer.fontConfigMissing(this, "<font-triplet...", fontCfg.getLocation());
return null;
}
for (Configuration config : triple) {
int weight = FontUtil.parseCSS2FontWeight(config.getAttribute("weight"));
FontTriplet triplet = new FontTriplet(config.getAttribute("name"),
config.getAttribute("style"),
weight);
tripletList.add(triplet);
}
//build the fonts
Configuration[] config = fontCfg.getChildren("afp-font");
if (config.length == 0) {
eventProducer.fontConfigMissing(this, "<afp-font...", fontCfg.getLocation());
return null;
}
Configuration afpFontCfg = config[0];
URI baseURI = null;
String uri = afpFontCfg.getAttribute("base-uri", fontPath);
if (uri == null) {
//Fallback for old attribute which only supports local filenames
String path = afpFontCfg.getAttribute("path", fontPath);
if (path != null) {
File f = new File(path);
baseURI = f.toURI();
}
} else {
try {
baseURI = new URI(uri);
} catch (URISyntaxException e) {
eventProducer.invalidConfiguration(this, e);
return null;
}
}
ResourceAccessor accessor = new DefaultFOPResourceAccessor(
this.userAgent,
fontManager.getFontBaseURL(),
baseURI);
AFPFont font = null;
try {
String type = afpFontCfg.getAttribute("type");