in fop-core/src/main/java/org/apache/fop/apps/FopConfParser.java [168:309]
private void configure(final URI baseURI, final ResourceResolver resourceResolver,
Configuration cfg) throws FOPException {
if (log.isDebugEnabled()) {
log.debug("Initializing FopFactory Configuration");
}
// strict fo validation
if (cfg.getChild("strict-validation", false) != null) {
try {
boolean strict = cfg.getChild("strict-validation").getValueAsBoolean();
fopFactoryBuilder.setStrictFOValidation(strict);
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, false);
}
}
boolean strict = false;
if (cfg.getChild("strict-configuration", false) != null) {
try {
strict = cfg.getChild("strict-configuration").getValueAsBoolean();
fopFactoryBuilder.setStrictUserConfigValidation(strict);
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, false);
}
}
if (cfg.getChild("accessibility", false) != null) {
try {
fopFactoryBuilder.setAccessibility(cfg.getChild("accessibility").getValueAsBoolean());
fopFactoryBuilder.setKeepEmptyTags(
cfg.getChild("accessibility").getAttributeAsBoolean(Accessibility.KEEP_EMPTY_TAGS, true));
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, false);
}
}
// base definitions for relative path resolution
if (cfg.getChild("base", false) != null) {
try {
URI confUri = InternalResourceResolver.getBaseURI(cfg.getChild("base").getValue(null));
fopFactoryBuilder.setBaseURI(baseURI.resolve(confUri));
} catch (URISyntaxException use) {
LogUtil.handleException(log, use, strict);
}
}
// renderer options
if (cfg.getChild("source-resolution", false) != null) {
float srcRes = cfg.getChild("source-resolution").getValueAsFloat(
FopFactoryConfig.DEFAULT_SOURCE_RESOLUTION);
fopFactoryBuilder.setSourceResolution(srcRes);
if (log.isDebugEnabled()) {
log.debug("source-resolution set to: " + srcRes + "dpi");
}
}
if (cfg.getChild("target-resolution", false) != null) {
float targetRes = cfg.getChild("target-resolution").getValueAsFloat(
FopFactoryConfig.DEFAULT_TARGET_RESOLUTION);
fopFactoryBuilder.setTargetResolution(targetRes);
if (log.isDebugEnabled()) {
log.debug("target-resolution set to: " + targetRes + "dpi");
}
}
if (cfg.getChild("break-indent-inheritance", false) != null) {
try {
fopFactoryBuilder.setBreakIndentInheritanceOnReferenceAreaBoundary(
cfg.getChild("break-indent-inheritance").getValueAsBoolean());
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, strict);
}
}
Configuration pageConfig = cfg.getChild("default-page-settings");
if (pageConfig.getAttribute("height", null) != null) {
String pageHeight = pageConfig.getAttribute("height",
FopFactoryConfig.DEFAULT_PAGE_HEIGHT);
fopFactoryBuilder.setPageHeight(pageHeight);
if (log.isInfoEnabled()) {
log.info("Default page-height set to: " + pageHeight);
}
}
if (pageConfig.getAttribute("width", null) != null) {
String pageWidth = pageConfig.getAttribute("width",
FopFactoryConfig.DEFAULT_PAGE_WIDTH);
fopFactoryBuilder.setPageWidth(pageWidth);
if (log.isInfoEnabled()) {
log.info("Default page-width set to: " + pageWidth);
}
}
if (cfg.getChild("complex-scripts") != null) {
Configuration csConfig = cfg.getChild("complex-scripts");
fopFactoryBuilder.setComplexScriptFeatures(!csConfig.getAttributeAsBoolean("disabled",
false));
}
setHyphenationBase(cfg, resourceResolver, baseURI, fopFactoryBuilder);
setHyphPatNames(cfg, fopFactoryBuilder, strict);
// prefer Renderer over IFDocumentHandler
if (cfg.getChild(PREFER_RENDERER, false) != null) {
try {
fopFactoryBuilder.setPreferRenderer(
cfg.getChild(PREFER_RENDERER).getValueAsBoolean());
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, strict);
}
}
if (cfg.getChild(TABLE_BORDER_OVERPAINT, false) != null) {
try {
fopFactoryBuilder.setTableBorderOverpaint(
cfg.getChild(TABLE_BORDER_OVERPAINT).getValueAsBoolean());
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, false);
}
}
if (cfg.getChild(SIMPLE_LINE_BREAKING, false) != null) {
try {
fopFactoryBuilder.setSimpleLineBreaking(
cfg.getChild(SIMPLE_LINE_BREAKING).getValueAsBoolean());
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, false);
}
}
if (cfg.getChild(SKIP_PAGE_POSITION_ONLY_ALLOWED, false) != null) {
try {
fopFactoryBuilder.setSkipPagePositionOnlyAllowed(
cfg.getChild(SKIP_PAGE_POSITION_ONLY_ALLOWED).getValueAsBoolean());
} catch (ConfigurationException e) {
LogUtil.handleException(log, e, false);
}
}
// configure font manager
new FontManagerConfigurator(cfg, baseURI, fopFactoryBuilder.getBaseURI(), resourceResolver)
.configure(fopFactoryBuilder.getFontManager(), strict);
// configure image loader framework
configureImageLoading(cfg.getChild("image-loading", false), strict);
}