import java.net.URI;
import java.net.URISyntaxException;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.io.InternalResourceResolver;
/**
import org.apache.fop.render.Renderer;
import org.apache.fop.render.RendererConfig;
import org.apache.fop.render.RendererConfig.RendererConfigParser;
-import org.apache.fop.render.RendererConfigOptions;
+import org.apache.fop.render.RendererConfigOption;
import org.apache.fop.render.RendererFactory;
import org.apache.fop.render.XMLHandlerRegistry;
import org.apache.fop.render.intermediate.IFDocumentHandler;
* @param option the renderer option
* @return the value
*/
- public Object getRendererOption(RendererConfigOptions option) {
+ public Object getRendererOption(RendererConfigOption option) {
return rendererOptions.get(option.getName());
}
String MIME_FOP_AREA_TREE = "application/X-fop-areatree";
/** Apache FOP's intermediate format XML */
String MIME_FOP_IF = "application/X-fop-intermediate-format";
+ /** Bitmap images */
+ String MIME_BITMAP = "image/x-bitmap";
}
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.apps.io;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.xmlgraphics.util.uri.DataURIResolver;
-
-public class URIResolverWrapper {
- private final URI baseUri;
- private final ResourceResolver uriResolver;
- private final DataURIResolver dataSchemeResolver = new DataURIResolver();
-
- public URIResolverWrapper(URI baseUri, ResourceResolver uriResolver) {
- this.baseUri = baseUri;
- this.uriResolver = uriResolver;
- }
-
- public URI getBaseURI() {
- return baseUri;
- }
-
- public InputStream resolveIn(String stringUri) throws IOException, URISyntaxException {
- if (stringUri.startsWith("data:")) {
- return resolveDataURI(stringUri);
- }
- return resolveIn(cleanURI(stringUri));
- }
-
- public InputStream resolveIn(URI uri) throws IOException {
- if (uri.getScheme() != null && uri.getScheme().startsWith("data")) {
- return resolveDataURI(uri.toASCIIString());
- }
- return uriResolver.getResource(resolveFromBase(uri));
- }
-
- public OutputStream resolveOut(URI uri) throws IOException {
- return uriResolver.getOutputStream(resolveFromBase(uri));
- }
-
- private URI resolveFromBase(URI uri) {
- return baseUri.resolve(uri);
- }
-
- public static URI cleanURI(String uriStr) throws URISyntaxException {
- // replace back slash with forward slash to ensure windows file:/// URLS are supported
- if (uriStr == null) {
- return null;
- }
- String fixedUri = uriStr.replace('\\', '/');
- fixedUri = fixedUri.replace(" ", "%20");
- URI baseURI = new URI(fixedUri);
- return baseURI;
- }
-
- public static URI getBaseURI(String base) throws URISyntaxException {
- String path = base + (base.endsWith("/") ? "" : "/");
- return cleanURI(path);
- }
-
- private InputStream resolveDataURI(String dataURI) {
- try {
- Source src = dataSchemeResolver.resolve(dataURI, "");
- return src == null ? null : ((StreamSource) src).getInputStream();
- } catch (TransformerException e) {
- throw new RuntimeException(e);
- }
- }
-}
import org.apache.fop.render.xml.XMLRenderer;
import org.apache.fop.util.CommandLineLogger;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.ENCRYPTION_PARAMS;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.ENCRYPTION_PARAMS;
/**
* Options parses the commandline arguments
// no font triplet info
if (tripletList.size() == 0) {
- //TODO: could be problematic!!
URI fontUri = resourceResolver.resolveFromBase(embedUri);
if (fontUri != null) {
FontInfoFinder finder = new FontInfoFinder();
import org.apache.commons.logging.LogFactory;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.apps.io.ResourceResolver;
import org.apache.fop.apps.io.InternalResourceResolver;
+import org.apache.fop.apps.io.ResourceResolver;
import org.apache.fop.fonts.substitute.FontSubstitutions;
import org.apache.fop.fonts.substitute.FontSubstitutionsConfigurator;
import org.apache.fop.util.LogUtil;
// caching (fonts)
if (cfg.getChild("use-cache", false) != null) {
try {
- // TODO: Find some way to deal with this!!
if (!cfg.getChild("use-cache").getValueAsBoolean()) {
fontManager.disableFontCache();
} else {
try {
returnFont.setEmbedURI(InternalResourceResolver.cleanURI(attributes.getValue("file")));
} catch (URISyntaxException e) {
- // TODO: dunno what to do here?!?!
+ throw new SAXException("URI syntax error in metrics file: " + e.getMessage(), e);
}
returnFont.setEmbedResourceName(attributes.getValue("class"));
} else if ("cid-widths".equals(localName)) {
* @param resourceResolver the font resolver
*/
private static void addConfiguredFonts(FontInfo fontInfo,
- List<EmbedFontInfo> embedFontInfoList, int num, InternalResourceResolver resourceResolver,
+ List<EmbedFontInfo> embedFontInfoList, int num,
+ InternalResourceResolver resourceResolver,
boolean base14Kerning) {
if (embedFontInfoList == null) {
return; //No fonts to process
if (fontEmbedURI == null) {
throw new RuntimeException("Cannot load font. No font URIs available.");
}
- realFont = FontLoader.loadFont(fontEmbedURI, this.subFontName,
- this.embedded, this.encodingMode, useKerning, useAdvanced, resourceResolver);
+ realFont = FontLoader.loadFont(fontEmbedURI, this.subFontName, embedded,
+ this.encodingMode, useKerning, useAdvanced, resourceResolver);
}
if (realFont instanceof FontDescriptor) {
realFontDescriptor = (FontDescriptor) realFont;
return style;
}
+ /**
+ * Attempts to determine FontInfo from a given custom font
+ * @param fontUri the font URI
+ * @param customFont the custom font
+ * @param fontCache font cache (may be null)
+ * @return FontInfo from the given custom font
+ */
private EmbedFontInfo getFontInfoFromCustomFont(URI fontUri, CustomFont customFont,
FontCache fontCache, InternalResourceResolver resourceResolver) {
List<FontTriplet> fontTripletList = new java.util.ArrayList<FontTriplet>();
String fontFileStr = fontFileURI.toASCIIString();
String partialAfmUri = fontFileStr.substring(0, fontFileStr.length() - 4);
String afmUri = null;
- for (int i = 0; i < AFM_EXTENSIONS.length; i++) {
+ for (String afmExtension : AFM_EXTENSIONS) {
try {
- afmUri = partialAfmUri + AFM_EXTENSIONS[i];
+ afmUri = partialAfmUri + afmExtension;
afmIn = resourceResolver.getResource(afmUri);
if (afmIn != null) {
break;
} catch (IOException ioe) {
// Ignore, AFM probably not available under the URI
} catch (URISyntaxException e) {
- // TODO: Not sure what the best thing to do here is?!?
- throw new RuntimeException(e);
+ // Ignore, AFM probably not available under the URI
}
}
if (afmIn != null) {
* The hyphenation trees are cached.
* @param lang the language
* @param country the country (may be null or "none")
- * @param resourceResolver resolver to find the hyphenation files
+ * @param resolver resolver to find the hyphenation files
* @param hyphPatNames the map with user-configured hyphenation pattern file names
* @return the hyphenation tree
*/
public static HyphenationTree getHyphenationTree(String lang,
- String country, InternalResourceResolver resourceResolver, Map hyphPatNames) {
+ String country, InternalResourceResolver resolver, Map hyphPatNames) {
String llccKey = HyphenationTreeCache.constructLlccKey(lang, country);
HyphenationTreeCache cache = getHyphenationTreeCache();
return null;
}
- HyphenationTree hTree = getHyphenationTree2(lang, country, resourceResolver, hyphPatNames);
+ HyphenationTree hTree = getHyphenationTree2(lang, country, resolver, hyphPatNames);
// fallback to lang only
if (hTree == null && country != null && !country.equals("none")) {
String llKey = HyphenationTreeCache.constructLlccKey(lang, null);
if (!cache.isMissing(llKey)) {
- hTree = getHyphenationTree2(lang, null, resourceResolver, hyphPatNames);
+ hTree = getHyphenationTree2(lang, null, resolver, hyphPatNames);
if (hTree != null && log.isDebugEnabled()) {
log.debug("Couldn't find hyphenation pattern "
+ "for lang=\"" + lang + "\",country=\"" + country + "\"."
* The hyphenation trees are cached.
* @param lang the language
* @param country the country (may be null or "none")
- * @param resourceResolver resource resolver to find the hyphenation files
+ * @param resourceResolver resolver to find the hyphenation files
* @param hyphPatNames the map with user-configured hyphenation pattern file names
* @return the hyphenation tree
*/
* Hyphenates a word.
* @param lang the language
* @param country the optional country code (may be null or "none")
- * @param resourceResolver resource resolver to find the hyphenation files
+ * @param resourceResolver resolver to find the hyphenation files
* @param hyphPatNames the map with user-configured hyphenation pattern file names
* @param word the word to hyphenate
* @param leftMin the minimum number of characters before the hyphenation point
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.fonts.FontCollection;
+import org.apache.fop.fonts.FontManager;
+import org.apache.fop.fonts.base14.Base14FontCollection;
+import org.apache.fop.render.RendererConfig.RendererConfigParser;
+
+/**
+ * This object represents the default renderer configurator and contains the methods for most the
+ * RendererConfigurators.
+ */
+public class DefaultRendererConfigurator extends PrintRendererConfigurator {
+
+ public DefaultRendererConfigurator(FOUserAgent userAgent, RendererConfigParser rendererConfigParser) {
+ super(userAgent, rendererConfigParser);
+ }
+
+ protected List<FontCollection> getDefaultFontCollection() {
+ FontManager fontManager = userAgent.getFontManager();
+ List<FontCollection> fontCollection = new ArrayList<FontCollection>();
+ fontCollection.add(new Base14FontCollection(fontManager.isBase14KerningEnabled()));
+ return fontCollection;
+ }
+
+}
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fonts.FontConfig;
+/**
+ * Implementations of this interface have all the renderer-specific configuration data found in the
+ * FOP-conf. This object is just a data object that is created by the {@link RendererConfigParser}
+ * when the FOP conf is parsed.
+ */
public interface RendererConfig {
+ /**
+ * Returns the render-specific font configuration information.
+ * @return the font config
+ */
FontConfig getFontInfoConfig();
+ /**
+ * Implementations of this interface parse the relevant renderer-specific configuration data
+ * within the FOP-conf and create a {@link RendererConfig}.
+ */
public interface RendererConfigParser {
+ /**
+ * Builds the object that contains the renderer configuration data.
+ *
+ * @param userAgent the user agent
+ * @param rendererConfiguration the Avalon config object for parsing the data
+ * @return the configuration data object
+ * @throws FOPException if an error occurs while parsing the fop conf
+ */
RendererConfig build(FOUserAgent userAgent, Configuration rendererConfiguration) throws FOPException;
+ /**
+ * The MIME type of the renderer.
+ *
+ * @return the mime type
+ */
String getMimeType();
}
}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render;
+
+/**
+ * Implementations of this interface enumerate the various renderer configuration options available
+ * to users in the FOP conf.
+ */
+public interface RendererConfigOption {
+ /** The name of the option. */
+ String getName();
+}
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render;
-
-public interface RendererConfigOptions {
- String getName();
-}
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.adobe;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.fonts.FontCollection;
-import org.apache.fop.fonts.FontManager;
-import org.apache.fop.fonts.base14.Base14FontCollection;
-import org.apache.fop.render.PrintRendererConfigurator;
-import org.apache.fop.render.RendererConfig.RendererConfigParser;
-
-public class AdobeRendererConfigurator extends PrintRendererConfigurator {
-
- public AdobeRendererConfigurator(FOUserAgent userAgent, RendererConfigParser rendererConfigParser) {
- super(userAgent, rendererConfigParser);
- }
-
- protected List<FontCollection> getDefaultFontCollection() {
- FontManager fontManager = userAgent.getFontManager();
- List<FontCollection> fontCollection = new ArrayList<FontCollection>();
- fontCollection.add(new Base14FontCollection(fontManager.isBase14KerningEnabled()));
- return fontCollection;
- }
-
-}
package org.apache.fop.render.afp;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.EnumMap;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.apps.io.InternalResourceResolver;
import org.apache.fop.fonts.FontManager;
import org.apache.fop.render.RendererConfig;
import org.apache.fop.render.afp.AFPFontConfig.AFPFontInfoConfigParser;
import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_COLOR;
import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_GRAYSCALE;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.DEFAULT_RESOURCE_LEVELS;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.GOCA;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.GOCA_TEXT;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_DITHERING_QUALITY;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_FS45;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_JPEG;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_MAPPING_OPTION;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_MODE;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_NATIVE;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_WRAP_PSEG;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.JPEG_ALLOW_JPEG_EMBEDDING;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.JPEG_BITMAP_ENCODING_QUALITY;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.LINE_WIDTH_CORRECTION;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.RENDERER_RESOLUTION;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.RESOURCE_GROUP_URI;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.SHADING;
-
+import static org.apache.fop.render.afp.AFPRendererConfigOption.DEFAULT_RESOURCE_LEVELS;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.GOCA;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.GOCA_TEXT;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_DITHERING_QUALITY;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_FS45;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_JPEG;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_MAPPING_OPTION;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_MODE;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_NATIVE;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_WRAP_PSEG;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.JPEG_ALLOW_JPEG_EMBEDDING;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.JPEG_BITMAP_ENCODING_QUALITY;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.LINE_WIDTH_CORRECTION;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.RENDERER_RESOLUTION;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.RESOURCE_GROUP_URI;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.SHADING;
+
+/**
+ * The AFP renderer config object.
+ */
public final class AFPRendererConfig implements RendererConfig {
+ /**
+ * An enumeration for the various images modes available to the AFP renderer.
+ */
public enum ImagesModeOptions {
MODE_GRAYSCALE("b+w", "bits-per-pixel"),
}
}
- public enum Options {
-
- DEFAULT_RESOURCE_LEVELS("default-resource-levels", AFPResourceLevelDefaults.class),
- IMAGES("images", null),
- IMAGES_JPEG("jpeg", null),
- IMAGES_DITHERING_QUALITY("dithering-quality", Float.class),
- IMAGES_FS45("fs45", Boolean.class),
- IMAGES_MAPPING_OPTION("mapping_option", Byte.class),
- IMAGES_MODE("mode", Boolean.class),
- IMAGES_NATIVE("native", Boolean.class),
- IMAGES_WRAP_PSEG("pseg", Boolean.class),
- JPEG_ALLOW_JPEG_EMBEDDING("allow-embedding", Boolean.class),
- JPEG_BITMAP_ENCODING_QUALITY("bitmap-encoding-quality", Float.class),
- RENDERER_RESOLUTION("renderer-resolution", Integer.class),
- RESOURCE_GROUP_URI("resource-group-file", URI.class),
- SHADING("shading", AFPShadingMode.class),
- LINE_WIDTH_CORRECTION("line-width-correction", Float.class),
- GOCA("goca", Boolean.class),
- GOCA_TEXT("text", Boolean.class);
-
- private final String name;
-
- private final Class<?> type;
-
- private Options(String name, Class<?> type) {
- this.name = name;
- this.type = type;
- }
-
- public String getName() {
- return name;
- }
- }
-
- private final EnumMap<Options, Object> params = new EnumMap<Options, Object>(Options.class);
+ private final EnumMap<AFPRendererConfigOption, Object> params = new EnumMap<AFPRendererConfigOption, Object>(AFPRendererConfigOption.class);
private final EnumMap<ImagesModeOptions, Object> imageModeParams
= new EnumMap<ImagesModeOptions, Object>(ImagesModeOptions.class);
return getParam(GOCA_TEXT, Boolean.class);
}
- private <T> T getParam(Options options, Class<T> type) {
- assert options.type.equals(type);
+ private <T> T getParam(AFPRendererConfigOption options, Class<T> type) {
+ assert options.getType().equals(type);
return type.cast(params.get(options));
}
- private <T> void setParam(Options option, T value) {
- assert option.type.isInstance(value);
+ private <T> void setParam(AFPRendererConfigOption option, T value) {
+ assert option.getType().isInstance(value);
params.put(option, value);
}
+ /**
+ * The parser for AFP renderer specific data in the FOP conf.
+ */
public static final class AFPRendererConfigParser implements RendererConfigParser {
private static final Log LOG = LogFactory.getLog(AFPRendererConfigParser.class);
+ /** {@inheritDoc} */
public AFPRendererConfig build(FOUserAgent userAgent, Configuration cfg) throws FOPException {
boolean strict = userAgent != null ? userAgent.validateUserConfigStrictly() : false;
AFPRendererConfig config = null;
return config;
}
+ /** {@inheritDoc} */
public String getMimeType() {
return MimeConstants.MIME_AFP;
}
}
-
private static final class ParserHelper {
private static final Log LOG = LogFactory.getLog(ParserHelper.class);
createResourceLevel();
}
- private void setParam(Options option, Object value) {
+ private void setParam(AFPRendererConfigOption option, Object value) {
config.setParam(option, value);
}
config.imageModeParams.put(MODE_GRAYSCALE,
imagesCfg.getAttributeAsInteger(imagesMode.getModeAttribute(), 8));
}
- String dithering = imagesCfg.getAttribute(Options.IMAGES_DITHERING_QUALITY.getName(), "medium");
+ String dithering = imagesCfg.getAttribute(AFPRendererConfigOption.IMAGES_DITHERING_QUALITY.getName(), "medium");
float dq;
if (dithering.startsWith("min")) {
dq = 0.0f;
}
}
setParam(IMAGES_DITHERING_QUALITY, dq);
- setParam(IMAGES_NATIVE, imagesCfg.getAttributeAsBoolean(Options.IMAGES_NATIVE.getName(), false));
+ setParam(IMAGES_NATIVE, imagesCfg.getAttributeAsBoolean(IMAGES_NATIVE.getName(), false));
setParam(IMAGES_WRAP_PSEG,
imagesCfg.getAttributeAsBoolean(IMAGES_WRAP_PSEG.getName(), false));
setParam(IMAGES_FS45, imagesCfg.getAttributeAsBoolean(IMAGES_FS45.getName(), false));
try {
Configuration resourceGroupUriCfg = cfg.getChild(RESOURCE_GROUP_URI.getName(), false);
if (resourceGroupUriCfg != null) {
- URI resourceGroupUri = URI.create(resourceGroupUriCfg.getValue());
- // TODO validate?
+ URI resourceGroupUri = InternalResourceResolver.cleanURI(resourceGroupUriCfg.getValue());
setParam(RESOURCE_GROUP_URI, resourceGroupUri);
}
} catch (ConfigurationException e) {
LogUtil.handleException(LOG, e, strict);
+ } catch (URISyntaxException use) {
+ LogUtil.handleException(LOG, use, strict);
}
}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.fop.render.afp;
+
+import java.net.URI;
+
+import org.apache.fop.afp.AFPResourceLevelDefaults;
+import org.apache.fop.render.RendererConfigOption;
+
+/**
+ * An enumeration of the configuration options available for the AFP renderer.
+ */
+public enum AFPRendererConfigOption implements RendererConfigOption {
+ DEFAULT_RESOURCE_LEVELS("default-resource-levels", AFPResourceLevelDefaults.class),
+ IMAGES("images", null),
+ IMAGES_JPEG("jpeg", null),
+ IMAGES_DITHERING_QUALITY("dithering-quality", Float.class),
+ IMAGES_FS45("fs45", Boolean.class),
+ IMAGES_MAPPING_OPTION("mapping_option", Byte.class),
+ IMAGES_MODE("mode", Boolean.class),
+ IMAGES_NATIVE("native", Boolean.class),
+ IMAGES_WRAP_PSEG("pseg", Boolean.class),
+ JPEG_ALLOW_JPEG_EMBEDDING("allow-embedding", Boolean.class),
+ JPEG_BITMAP_ENCODING_QUALITY("bitmap-encoding-quality", Float.class),
+ RENDERER_RESOLUTION("renderer-resolution", Integer.class),
+ RESOURCE_GROUP_URI("resource-group-file", URI.class),
+ SHADING("shading", AFPShadingMode.class),
+ LINE_WIDTH_CORRECTION("line-width-correction", Float.class),
+ GOCA("goca", Boolean.class),
+ GOCA_TEXT("text", Boolean.class);
+
+ private final String name;
+
+ private final Class<?> type;
+
+ private AFPRendererConfigOption(String name, Class<?> type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ /** {@inheritDoc}}*/
+ public String getName() {
+ return name;
+ }
+
+ public Class<?> getType() {
+ return type;
+ }
+}
import org.apache.fop.render.java2d.Java2DRendererConfig.Java2DRendererConfigParser;
import org.apache.fop.util.ColorUtil;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.ANTI_ALIASING;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.BACKGROUND_COLOR;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_QUALITY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_QUALITY_ELEMENT;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_SPEED;
-
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.ANTI_ALIASING;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.BACKGROUND_COLOR;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_QUALITY;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_QUALITY_ELEMENT;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_SPEED;
+
+/**
+ * The Bitmap renderer config data object.
+ */
public class BitmapRendererConfig implements RendererConfig {
- private final EnumMap<BitmapRendererConfigOptions, Object> params
- = new EnumMap<BitmapRendererConfigOptions, Object>(BitmapRendererConfigOptions.class);
+ private final EnumMap<BitmapRendererConfigOption, Object> params
+ = new EnumMap<BitmapRendererConfigOption, Object>(BitmapRendererConfigOption.class);
private final DefaultFontConfig fontConfig;
: JAVA2D_TRANSPARENT_PAGE_BACKGROUND.getDefaultValue());
}
- private Object get(BitmapRendererConfigOptions option) {
+ private Object get(BitmapRendererConfigOption option) {
return params.get(option);
}
+ /**
+ * The parser for the Bitmap renderer configuration data.
+ */
public static class BitmapRendererConfigParser implements RendererConfigParser {
private final String mimeType;
this.mimeType = mimeType;
}
- private void setParam(BitmapRendererConfig config, BitmapRendererConfigOptions option,
+ private void setParam(BitmapRendererConfig config, BitmapRendererConfigOption option,
Object value) {
config.params.put(option, value != null ? value : option.getDefaultValue());
}
- protected void build(BitmapRendererConfig config, FOUserAgent userAgent,
+ void build(BitmapRendererConfig config, FOUserAgent userAgent,
Configuration cfg) throws FOPException {
if (cfg != null) {
Java2DRendererConfig j2dConfig = new Java2DRendererConfigParser(null).build(
ColorUtil.parseColorString(userAgent, background));
}
- setParam(config, BitmapRendererConfigOptions.ANTI_ALIASING,
+ setParam(config, BitmapRendererConfigOption.ANTI_ALIASING,
getChild(cfg, ANTI_ALIASING).getValueAsBoolean(
(Boolean) ANTI_ALIASING.getDefaultValue()));
String optimization = getValue(cfg, RENDERING_QUALITY_ELEMENT);
setParam(config, RENDERING_QUALITY,
- !(BitmapRendererConfigOptions.getValue(optimization) == RENDERING_SPEED));
+ !(BitmapRendererConfigOption.getValue(optimization) == RENDERING_SPEED));
String color = getValue(cfg, COLOR_MODE);
setParam(config, COLOR_MODE,
- getBufferedImageIntegerFromColor(BitmapRendererConfigOptions.getValue(color)));
+ getBufferedImageIntegerFromColor(BitmapRendererConfigOption.getValue(color)));
}
}
return config;
}
- private Integer getBufferedImageIntegerFromColor(BitmapRendererConfigOptions option) {
+ private Integer getBufferedImageIntegerFromColor(BitmapRendererConfigOption option) {
if (option == null) {
return null;
}
}
}
- private Configuration getChild(Configuration cfg, BitmapRendererConfigOptions option) {
+ private Configuration getChild(Configuration cfg, BitmapRendererConfigOption option) {
return cfg.getChild(option.getName());
}
- private String getValue(Configuration cfg, BitmapRendererConfigOptions option) {
+ private String getValue(Configuration cfg, BitmapRendererConfigOption option) {
return cfg.getChild(option.getName()).getValue(null);
}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.bitmap;
+
+import java.awt.Color;
+import java.awt.image.BufferedImage;
+
+import org.apache.fop.render.RendererConfigOption;
+
+/**
+ * An enumeration of the Bitmap renderer configuration opetions available to the user via the FOP
+ * conf.
+ */
+public enum BitmapRendererConfigOption implements RendererConfigOption {
+ JAVA2D_TRANSPARENT_PAGE_BACKGROUND("transparent-page-background", false),
+ BACKGROUND_COLOR("background-color", Color.WHITE),
+ ANTI_ALIASING("anti-aliasing", true),
+ RENDERING_QUALITY_ELEMENT("rendering"),
+ RENDERING_QUALITY("quality", true),
+ RENDERING_SPEED("speed"),
+ COLOR_MODE("color-mode", BufferedImage.TYPE_INT_ARGB),
+ COLOR_MODE_RGBA("rgba"),
+ COLOR_MODE_RGB("rgb"),
+ COLOR_MODE_GRAY("gray"),
+ COLOR_MODE_BINARY("binary"),
+ COLOR_MODE_BILEVEL("bi-level");
+
+ private final String name;
+ private final Object defaultValue;
+
+ private BitmapRendererConfigOption(String name, Object defaultValue) {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+
+ private BitmapRendererConfigOption(String name) {
+ this(name, null);
+ }
+
+ /** {@inheritDoc} */
+ public String getName() {
+ return name;
+ }
+
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+
+ public static BitmapRendererConfigOption getValue(String str) {
+ for (BitmapRendererConfigOption opt : BitmapRendererConfigOption.values()) {
+ if (opt.getName().equalsIgnoreCase(str)) {
+ return opt;
+ }
+ }
+ return null;
+ }
+}
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.bitmap;
-
-import java.awt.Color;
-import java.awt.image.BufferedImage;
-
-import org.apache.fop.render.RendererConfigOptions;
-
-public enum BitmapRendererConfigOptions implements RendererConfigOptions {
- JAVA2D_TRANSPARENT_PAGE_BACKGROUND("transparent-page-background", false),
- BACKGROUND_COLOR("background-color", Color.WHITE),
- ANTI_ALIASING("anti-aliasing", true),
- RENDERING_QUALITY_ELEMENT("rendering"),
- RENDERING_QUALITY("quality", true),
- RENDERING_SPEED("speed"),
- COLOR_MODE("color-mode", BufferedImage.TYPE_INT_ARGB),
- COLOR_MODE_RGBA("rgba"),
- COLOR_MODE_RGB("rgb"),
- COLOR_MODE_GRAY("gray"),
- COLOR_MODE_BINARY("binary"),
- COLOR_MODE_BILEVEL("bi-level");
-
- private final String name;
- private final Object defaultValue;
-
- private BitmapRendererConfigOptions(String name, Object defaultValue) {
- this.name = name;
- this.defaultValue = defaultValue;
- }
-
- private BitmapRendererConfigOptions(String name) {
- this(name, null);
- }
-
- public String getName() {
- return name;
- }
-
- public Object getDefaultValue() {
- return defaultValue;
- }
-
- public static BitmapRendererConfigOptions getValue(String str) {
- for (BitmapRendererConfigOptions opt : BitmapRendererConfigOptions.values()) {
- if (opt.getName().equalsIgnoreCase(str)) {
- return opt;
- }
- }
- return null;
- }
-}
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.MimeConstants;
import org.apache.fop.apps.io.InternalResourceResolver;
import org.apache.fop.fonts.EmbedFontInfo;
import org.apache.fop.fonts.FontCollection;
public void configure(IFDocumentHandler documentHandler) throws FOPException {
AbstractBitmapDocumentHandler bitmapHandler = (AbstractBitmapDocumentHandler) documentHandler;
BitmapRenderingSettings settings = bitmapHandler.getSettings();
- // TODO: magic strings!
- configure(documentHandler, settings, new BitmapRendererConfigParser("image/bitmap"));
+ configure(documentHandler, settings,
+ new BitmapRendererConfigParser(MimeConstants.MIME_BITMAP));
}
void configure(IFDocumentHandler documentHandler, BitmapRenderingSettings settings,
import org.apache.fop.render.java2d.Java2DRenderingSettings;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.ANTI_ALIASING;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_QUALITY;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.ANTI_ALIASING;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_QUALITY;
/**
* This class holds settings used when rendering to bitmaps.
import org.apache.fop.fonts.DefaultFontConfig;
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser;
+/**
+ * The PNG renderer configuration data object.
+ */
public final class PNGRendererConfig extends BitmapRendererConfig {
private PNGRendererConfig(DefaultFontConfig fontConfig) {
super(fontConfig);
}
+ /**
+ * The PNG renderer configuration parser.
+ */
public static class PNGRendererConfigParser implements RendererConfigParser {
public PNGRendererConfig build(FOUserAgent userAgent, Configuration cfg)
userAgent.validateStrictly()));
}
+ /** {@inheritDoc} */
public String getMimeType() {
return MimeConstants.MIME_PNG;
}
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.AbstractRendererMaker;
import org.apache.fop.render.Renderer;
+import org.apache.fop.render.bitmap.PNGRendererConfig.PNGRendererConfigParser;
import org.apache.fop.render.java2d.Java2DRendererConfigurator;
/**
@Override
public void configureRenderer(FOUserAgent userAgent, Renderer renderer) throws FOPException {
- // TODO what constructir params?
- new Java2DRendererConfigurator(userAgent, null).configure(renderer);
+ new Java2DRendererConfigurator(userAgent, new PNGRendererConfigParser()).configure(renderer);
}
@Override
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fonts.DefaultFontConfig;
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser;
-import org.apache.fop.render.RendererConfigOptions;
+import org.apache.fop.render.RendererConfigOption;
+/**
+ * The renderer configuration object for the TIFF renderer.
+ */
public final class TIFFRendererConfig extends BitmapRendererConfig {
- public enum TIFFRendererConfigOptions implements RendererConfigOptions {
+ public enum TIFFRendererConfigOption implements RendererConfigOption {
COMPRESSION("compression", TIFFCompressionValues.PACKBITS);
private final String name;
private final Object defaultValue;
- private TIFFRendererConfigOptions(String name, Object defaultValue) {
+ private TIFFRendererConfigOption(String name, Object defaultValue) {
this.name = name;
this.defaultValue = defaultValue;
}
}
}
- private final EnumMap<TIFFRendererConfigOptions, Object> params
- = new EnumMap<TIFFRendererConfigOptions, Object>(TIFFRendererConfigOptions.class);
+ private final EnumMap<TIFFRendererConfigOption, Object> params
+ = new EnumMap<TIFFRendererConfigOption, Object>(TIFFRendererConfigOption.class);
private TIFFRendererConfig(DefaultFontConfig fontConfig) {
super(fontConfig);
}
public TIFFCompressionValues getCompressionType() {
- return (TIFFCompressionValues) params.get(TIFFRendererConfigOptions.COMPRESSION);
+ return (TIFFCompressionValues) params.get(TIFFRendererConfigOption.COMPRESSION);
}
+ /**
+ * The TIFF renderer configuration parser.
+ */
public static final class TIFFRendererConfigParser extends BitmapRendererConfigParser {
public TIFFRendererConfigParser() {
private TIFFRendererConfig config;
- private void setParam(TIFFRendererConfigOptions option, Object value) {
+ private void setParam(TIFFRendererConfigOption option, Object value) {
config.params.put(option, value != null ? value : option.getDefaultValue());
}
- private String getValue(Configuration cfg, TIFFRendererConfigOptions option) {
+ private String getValue(Configuration cfg, TIFFRendererConfigOption option) {
return cfg.getChild(option.getName()).getValue(null);
}
+ /** {@inheritDoc} */
public TIFFRendererConfig build(FOUserAgent userAgent, Configuration cfg) throws FOPException {
config = new TIFFRendererConfig(new DefaultFontConfigParser()
.parse(cfg, userAgent.validateStrictly()));
super.build(config, userAgent, cfg);
if (cfg != null) {
- setParam(TIFFRendererConfigOptions.COMPRESSION,
+ setParam(TIFFRendererConfigOption.COMPRESSION,
TIFFCompressionValues.getValue(getValue(cfg,
- TIFFRendererConfigOptions.COMPRESSION)));
+ TIFFRendererConfigOption.COMPRESSION)));
}
return config;
}
import org.apache.fop.fonts.FontConfig;
import org.apache.fop.render.RendererConfig;
+/**
+ * The Intermediate Format renderer configuration data object.
+ */
public final class IFRendererConfig implements RendererConfig {
private final DefaultFontConfig fontConfig;
return fontConfig;
}
+ /**
+ * The Intermediate Format configuration data parser.
+ */
public static final class IFRendererConfigParser implements RendererConfigParser {
+ /** {@inheritDoc} */
public RendererConfig build(FOUserAgent userAgent, Configuration cfg)
throws FOPException {
return new IFRendererConfig(new DefaultFontConfigParser().parse(cfg,
userAgent.validateStrictly()));
}
+ /** {@inheritDoc} */
public String getMimeType() {
return "application/X-fop-intermediate-format";
}
import org.apache.fop.accessibility.StructureTreeEventHandler;
import org.apache.fop.fo.extensions.InternalElementMapping;
import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.render.DefaultRendererConfigurator;
import org.apache.fop.render.RenderingContext;
-import org.apache.fop.render.adobe.AdobeRendererConfigurator;
import org.apache.fop.render.intermediate.IFRendererConfig.IFRendererConfigParser;
import org.apache.fop.render.intermediate.IFStructureTreeBuilder.IFStructureTreeElement;
import org.apache.fop.render.intermediate.extensions.AbstractAction;
if (this.mimicHandler != null) {
return getMimickedDocumentHandler().getConfigurator();
} else {
- return new AdobeRendererConfigurator(getUserAgent(), new IFRendererConfigParser());
+ return new DefaultRendererConfigurator(getUserAgent(), new IFRendererConfigParser());
}
}
import org.apache.fop.util.CharUtilities;
import org.apache.fop.util.ColorUtil;
-import static org.apache.fop.render.java2d.Java2DRendererOptions.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
+import static org.apache.fop.render.java2d.Java2DRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
/**
* The <code>Java2DRenderer</code> class provides the abstract technical
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser;
import org.apache.fop.render.RendererConfig;
-import static org.apache.fop.render.java2d.Java2DRendererOptions.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
+import static org.apache.fop.render.java2d.Java2DRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
+/**
+ * The Java2D renderer configuration data object.
+ */
public final class Java2DRendererConfig implements RendererConfig {
- private final EnumMap<Java2DRendererOptions, Object> params
- = new EnumMap<Java2DRendererOptions, Object>(Java2DRendererOptions.class);
+ private final EnumMap<Java2DRendererOption, Object> params
+ = new EnumMap<Java2DRendererOption, Object>(Java2DRendererOption.class);
private final DefaultFontConfig fontConfig;
return Boolean.class.cast(params.get(JAVA2D_TRANSPARENT_PAGE_BACKGROUND));
}
+ /**
+ * The Java2D renderer configuration data parser.
+ */
public static class Java2DRendererConfigParser implements RendererConfigParser {
private final String mimeType;
this.mimeType = mimeType;
}
+ /** {@inheritDoc} */
public Java2DRendererConfig build(FOUserAgent userAgent, Configuration cfg)
throws FOPException {
Java2DRendererConfig config = new Java2DRendererConfig(new DefaultFontConfigParser()
return config;
}
+ /** {@inheritDoc} */
public String getMimeType() {
return mimeType;
}
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.render.DefaultRendererConfigurator;
import org.apache.fop.render.Renderer;
import org.apache.fop.render.RendererConfig.RendererConfigParser;
-import org.apache.fop.render.adobe.AdobeRendererConfigurator;
/**
* Configurerer for Java 2D renderer
*/
-public class Java2DRendererConfigurator extends AdobeRendererConfigurator {
+public class Java2DRendererConfigurator extends DefaultRendererConfigurator {
/**
* Default constructor
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.java2d;
+
+import org.apache.fop.render.RendererConfigOption;
+
+public enum Java2DRendererOption implements RendererConfigOption {
+ /** Rendering Options key for the controlling the transparent page background option. */
+ JAVA2D_TRANSPARENT_PAGE_BACKGROUND("transparent-page-background");
+
+ private final String name;
+
+ private Java2DRendererOption(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.java2d;
-
-import org.apache.fop.render.RendererConfigOptions;
-
-public enum Java2DRendererOptions implements RendererConfigOptions {
- /** Rendering Options key for the controlling the transparent page background option. */
- JAVA2D_TRANSPARENT_PAGE_BACKGROUND("transparent-page-background");
-
- private final String name;
-
- private Java2DRendererOptions(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.fop.render.pcl;
+
+import org.apache.fop.render.RendererConfigOption;
+
+/**
+ * An enumeration of the renderer configuration options available to the Java2D renderer via the
+ * FOP conf.
+ */
+public enum Java2DRendererConfigOption implements RendererConfigOption {
+
+ RENDERING_MODE("rendering", PCLRenderingMode.class),
+ TEXT_RENDERING("text-rendering", Boolean.class),
+ DISABLE_PJL("disable-pjl", Boolean.class);
+
+ private final String name;
+
+ private final Class<?> type;
+
+ private Java2DRendererConfigOption(String name, Class<?> type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ /** {@inheritDoc} */
+ public String getName() {
+ return name;
+ }
+
+ Class<?> getType() {
+ return type;
+ }
+}
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser;
import org.apache.fop.render.RendererConfig;
-import static org.apache.fop.render.pcl.PCLRendererConfig.Options.DISABLE_PJL;
-import static org.apache.fop.render.pcl.PCLRendererConfig.Options.RENDERING_MODE;
-import static org.apache.fop.render.pcl.PCLRendererConfig.Options.TEXT_RENDERING;
+import static org.apache.fop.render.pcl.Java2DRendererConfigOption.DISABLE_PJL;
+import static org.apache.fop.render.pcl.Java2DRendererConfigOption.RENDERING_MODE;
+import static org.apache.fop.render.pcl.Java2DRendererConfigOption.TEXT_RENDERING;
+/**
+ * The PCL renderer configuration data object.
+ */
public final class PCLRendererConfig implements RendererConfig {
- public enum Options {
-
- RENDERING_MODE("rendering", PCLRenderingMode.class),
- TEXT_RENDERING("text-rendering", Boolean.class),
- DISABLE_PJL("disable-pjl", Boolean.class);
-
- private final String name;
-
- private final Class<?> type;
-
- private Options(String name, Class<?> type) {
- this.name = name;
- this.type = type;
- }
-
- public String getName() {
- return name;
- }
- }
-
- private final Map<Options, Object> params = new EnumMap<Options, Object>(Options.class);
+ private final Map<Java2DRendererConfigOption, Object> params
+ = new EnumMap<Java2DRendererConfigOption, Object>(Java2DRendererConfigOption.class);
private final DefaultFontConfig fontConfig;
return getParam(DISABLE_PJL, Boolean.class);
}
- private <T> T getParam(Options option, Class<T> type) {
- assert option.type.equals(type);
+ private <T> T getParam(Java2DRendererConfigOption option, Class<T> type) {
+ assert option.getType().equals(type);
return type.cast(params.get(option));
}
- private <T> void setParam(Options option, T value) {
- assert option.type.isInstance(value);
+ private <T> void setParam(Java2DRendererConfigOption option, T value) {
+ assert option.getType().isInstance(value);
params.put(option, value);
}
+ /**
+ * The PCL renderer configuration data parser.
+ */
public static final class PCLRendererConfigParser implements RendererConfigParser {
+ /** {@inheritDoc} */
public PCLRendererConfig build(FOUserAgent userAgent, Configuration cfg) throws FOPException {
PCLRendererConfig config = new PCLRendererConfig(new DefaultFontConfigParser()
.parse(cfg, userAgent.validateStrictly()));
}
}
+ /** {@inheritDoc} */
public String getMimeType() {
return MimeConstants.MIME_PCL;
}
import org.apache.fop.render.RendererConfig;
import org.apache.fop.util.LogUtil;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.DISABLE_SRGB_COLORSPACE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.ENCRYPTION_LENGTH;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.ENCRYPTION_PARAMS;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.FILTER_LIST;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_ACCESSCONTENT;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_ANNOTATIONS;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_ASSEMBLEDOC;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_COPY_CONTENT;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_EDIT_CONTENT;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_FILLINFORMS;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_PRINT;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_PRINTHQ;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.OUTPUT_PROFILE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.OWNER_PASSWORD;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.PDF_A_MODE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.PDF_X_MODE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.USER_PASSWORD;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.VERSION;
-
-
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.DISABLE_SRGB_COLORSPACE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.ENCRYPTION_LENGTH;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.ENCRYPTION_PARAMS;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.FILTER_LIST;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_ACCESSCONTENT;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_ANNOTATIONS;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_ASSEMBLEDOC;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_COPY_CONTENT;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_EDIT_CONTENT;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_FILLINFORMS;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_PRINT;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_PRINTHQ;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.OUTPUT_PROFILE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.OWNER_PASSWORD;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.PDF_A_MODE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.PDF_X_MODE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.USER_PASSWORD;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.VERSION;
+
+/**
+ * The PDF renderer configuration data object.
+ */
public final class PDFRendererConfig implements RendererConfig {
private static final Log LOG = LogFactory.getLog(PDFRendererConfig.class);
- private final Map<PDFRendererConfigOptions, Object> configOptions
- = new EnumMap<PDFRendererConfigOptions, Object>(PDFRendererConfigOptions.class);
+ private final Map<PDFRendererConfigOption, Object> configOptions
+ = new EnumMap<PDFRendererConfigOption, Object>(PDFRendererConfigOption.class);
private final DefaultFontConfig fontConfig;
return pdfVersion == null ? null : Version.getValueOf(pdfVersion);
}
+ /**
+ * The PDF renderer configuration data parser.
+ */
public static final class PDFRendererConfigParser implements RendererConfigParser {
public PDFRendererConfig build(FOUserAgent userAgent, Configuration cfg) throws FOPException {
}
}
- private void put(PDFRendererConfigOptions option, Object value) {
+ private void put(PDFRendererConfigOption option, Object value) {
if (value != null && !value.equals(option.getDefaultValue())) {
pdfConfig.configOptions.put(option, value);
}
put(FILTER_LIST, filterMap);
}
- private String parseConfig(Configuration cfg, PDFRendererConfigOptions option) {
+ private String parseConfig(Configuration cfg, PDFRendererConfigOption option) {
Configuration child = cfg.getChild(option.getName());
return child.getValue(null);
}
- private boolean doesValueExist(Configuration cfg, PDFRendererConfigOptions option) {
+ private boolean doesValueExist(Configuration cfg, PDFRendererConfigOption option) {
return cfg.getChild(option.getName(), false) != null;
}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.pdf;
+
+import org.apache.fop.pdf.PDFAMode;
+import org.apache.fop.pdf.PDFXMode;
+import org.apache.fop.render.RendererConfigOption;
+
+public enum PDFRendererConfigOption implements RendererConfigOption {
+ FILTER_LIST("filterList"),
+ /** Rendering Options key for the PDF/A mode, default: {@link PDFAMode#DISABLED} */
+ PDF_A_MODE("pdf-a-mode", PDFAMode.DISABLED),
+ /** Rendering Options key for the PDF/X mode, default: {@link PDFXMode#DISABLED} */
+ PDF_X_MODE("pdf-x-mode", PDFXMode.DISABLED),
+ /** PDF version entry: specify the version of the PDF document created, datatype: String */
+ VERSION("version"),
+ /**
+ * Rendering Options key for disabling the sRGB color space (only possible if no PDF/A or
+ * PDF/X profile is active), default: false
+ */
+ DISABLE_SRGB_COLORSPACE("disable-srgb-colorspace", false),
+ /** Rendering Options key for the ICC profile for the output intent. */
+ OUTPUT_PROFILE("output-profile"),
+ /** PDF encryption parameter: all parameters as object, datatype: PDFEncryptionParams */
+ ENCRYPTION_PARAMS("encryption-params"),
+ /**
+ * PDF encryption length parameter: must be a multiple of 8 between 40 and 128,
+ * default value 40, datatype: int, default: 40
+ */
+ ENCRYPTION_LENGTH("encryption-length", 40),
+ /**
+ * PDF encryption parameter: Forbids printing to high quality, datatype: Boolean or
+ * "true"/"false", default: false
+ */
+ NO_PRINTHQ("noprinthq", 40),
+ /**
+ * PDF encryption parameter: Forbids assembling document, datatype: Boolean or
+ * "true"/"false", default: false
+ */
+ NO_ASSEMBLEDOC("noassembledoc", false),
+ /**
+ * PDF encryption parameter: Forbids extracting text and graphics, datatype: Boolean
+ * or "true"/"false", default: false
+ */
+ NO_ACCESSCONTENT("noaccesscontent", false),
+ /**
+ * PDF encryption parameter: Forbids filling in existing interactive forms, datatype:
+ * Boolean or "true"/"false", default: false
+ */
+ NO_FILLINFORMS("nofillinforms", false),
+ /**
+ * PDF encryption parameter: Forbids annotations, datatype: Boolean or "true"/"false",
+ * default: false
+ */
+ NO_ANNOTATIONS("noannotations", false),
+ /**
+ * PDF encryption parameter: Forbids printing, datatype: Boolean or "true"/"false",
+ * default: false
+ */
+ NO_PRINT("noprint", false),
+ /**
+ * PDF encryption parameter: Forbids copying content, datatype: Boolean or "true"/"false",
+ * default: false
+ */
+ NO_COPY_CONTENT("nocopy", false),
+ /**
+ * PDF encryption parameter: Forbids editing content, datatype: Boolean or "true"/"false",
+ * default: false
+ */
+ NO_EDIT_CONTENT("noedit", false),
+ /** PDF encryption parameter: user password, datatype: String, default: "" */
+ USER_PASSWORD("user-password", ""),
+ /** PDF encryption parameter: owner password, datatype: String, default: "" */
+ OWNER_PASSWORD("owner-password", "");
+
+ private final String name;
+ private final Object defaultValue;
+
+ private PDFRendererConfigOption(String name, Object defaultValue) {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+
+ private PDFRendererConfigOption(String name) {
+ this(name, null);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+}
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.pdf;
-
-import org.apache.fop.pdf.PDFAMode;
-import org.apache.fop.pdf.PDFXMode;
-import org.apache.fop.render.RendererConfigOptions;
-
-public enum PDFRendererConfigOptions implements RendererConfigOptions {
- FILTER_LIST("filterList"),
- /** Rendering Options key for the PDF/A mode, default: {@link PDFAMode#DISABLED} */
- PDF_A_MODE("pdf-a-mode", PDFAMode.DISABLED),
- /** Rendering Options key for the PDF/X mode, default: {@link PDFXMode#DISABLED} */
- PDF_X_MODE("pdf-x-mode", PDFXMode.DISABLED),
- /** PDF version entry: specify the version of the PDF document created, datatype: String */
- VERSION("version"),
- /**
- * Rendering Options key for disabling the sRGB color space (only possible if no PDF/A or
- * PDF/X profile is active), default: false
- */
- DISABLE_SRGB_COLORSPACE("disable-srgb-colorspace", false),
- /** Rendering Options key for the ICC profile for the output intent. */
- OUTPUT_PROFILE("output-profile"),
- /** PDF encryption parameter: all parameters as object, datatype: PDFEncryptionParams */
- ENCRYPTION_PARAMS("encryption-params"),
- /**
- * PDF encryption length parameter: must be a multiple of 8 between 40 and 128,
- * default value 40, datatype: int, default: 40
- */
- ENCRYPTION_LENGTH("encryption-length", 40),
- /**
- * PDF encryption parameter: Forbids printing to high quality, datatype: Boolean or
- * "true"/"false", default: false
- */
- NO_PRINTHQ("noprinthq", 40),
- /**
- * PDF encryption parameter: Forbids assembling document, datatype: Boolean or
- * "true"/"false", default: false
- */
- NO_ASSEMBLEDOC("noassembledoc", false),
- /**
- * PDF encryption parameter: Forbids extracting text and graphics, datatype: Boolean
- * or "true"/"false", default: false
- */
- NO_ACCESSCONTENT("noaccesscontent", false),
- /**
- * PDF encryption parameter: Forbids filling in existing interactive forms, datatype:
- * Boolean or "true"/"false", default: false
- */
- NO_FILLINFORMS("nofillinforms", false),
- /**
- * PDF encryption parameter: Forbids annotations, datatype: Boolean or "true"/"false",
- * default: false
- */
- NO_ANNOTATIONS("noannotations", false),
- /**
- * PDF encryption parameter: Forbids printing, datatype: Boolean or "true"/"false",
- * default: false
- */
- NO_PRINT("noprint", false),
- /**
- * PDF encryption parameter: Forbids copying content, datatype: Boolean or "true"/"false",
- * default: false
- */
- NO_COPY_CONTENT("nocopy", false),
- /**
- * PDF encryption parameter: Forbids editing content, datatype: Boolean or "true"/"false",
- * default: false
- */
- NO_EDIT_CONTENT("noedit", false),
- /** PDF encryption parameter: user password, datatype: String, default: "" */
- USER_PASSWORD("user-password", ""),
- /** PDF encryption parameter: owner password, datatype: String, default: "" */
- OWNER_PASSWORD("owner-password", "");
-
- private final String name;
- private final Object defaultValue;
-
- private PDFRendererConfigOptions(String name, Object defaultValue) {
- this.name = name;
- this.defaultValue = defaultValue;
- }
-
- private PDFRendererConfigOptions(String name) {
- this(name, null);
- }
-
- public String getName() {
- return name;
- }
-
- public Object getDefaultValue() {
- return defaultValue;
- }
-}
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.pdf.PDFEncryptionParams;
+import org.apache.fop.render.DefaultRendererConfigurator;
import org.apache.fop.render.RendererConfig.RendererConfigParser;
-import org.apache.fop.render.adobe.AdobeRendererConfigurator;
import org.apache.fop.render.intermediate.IFDocumentHandler;
/**
* PDF renderer configurator.
*/
-public class PDFRendererConfigurator extends AdobeRendererConfigurator {
+public class PDFRendererConfigurator extends DefaultRendererConfigurator {
/**
* Default constructor
import org.apache.fop.pdf.VersionController;
import org.apache.fop.render.pdf.extensions.PDFEmbeddedFileExtensionAttachment;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.DISABLE_SRGB_COLORSPACE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.ENCRYPTION_PARAMS;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_ACCESSCONTENT;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_ANNOTATIONS;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_ASSEMBLEDOC;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_COPY_CONTENT;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_EDIT_CONTENT;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_FILLINFORMS;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_PRINT;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.NO_PRINTHQ;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.OUTPUT_PROFILE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.OWNER_PASSWORD;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.PDF_A_MODE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.PDF_X_MODE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.USER_PASSWORD;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.DISABLE_SRGB_COLORSPACE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.ENCRYPTION_PARAMS;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_ACCESSCONTENT;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_ANNOTATIONS;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_ASSEMBLEDOC;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_COPY_CONTENT;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_EDIT_CONTENT;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_FILLINFORMS;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_PRINT;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.NO_PRINTHQ;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.OUTPUT_PROFILE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.OWNER_PASSWORD;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.PDF_A_MODE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.PDF_X_MODE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.USER_PASSWORD;
/**
* Utility class which enables all sorts of features that are not directly connected to the
private PDFDocument pdfDoc;
/** the PDF/A mode (Default: disabled) */
- private PDFAMode pdfAMode = (PDFAMode) PDFRendererConfigOptions.PDF_A_MODE.getDefaultValue();
+ private PDFAMode pdfAMode = (PDFAMode) PDFRendererConfigOption.PDF_A_MODE.getDefaultValue();
/** the PDF/X mode (Default: disabled) */
- private PDFXMode pdfXMode = (PDFXMode) PDFRendererConfigOptions.PDF_X_MODE.getDefaultValue();
+ private PDFXMode pdfXMode = (PDFXMode) PDFRendererConfigOption.PDF_X_MODE.getDefaultValue();
/** the (optional) encryption parameters */
private PDFEncryptionParams encryptionParams;
import org.apache.fop.render.RendererConfig;
import org.apache.fop.util.LogUtil;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.AUTO_ROTATE_LANDSCAPE;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.DSC_COMPLIANT;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.LANGUAGE_LEVEL;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.OPTIMIZE_RESOURCES;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.RENDERING_MODE;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.SAFE_SET_PAGE_DEVICE;
-
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.AUTO_ROTATE_LANDSCAPE;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.DSC_COMPLIANT;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.LANGUAGE_LEVEL;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.OPTIMIZE_RESOURCES;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.RENDERING_MODE;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.SAFE_SET_PAGE_DEVICE;
+
+/**
+ * The PostScript renderer configuration data object.
+ */
public final class PSRendererConfig implements RendererConfig {
- private final EnumMap<PSRendererConfigurationOptions, Object> params
- = new EnumMap<PSRendererConfigurationOptions, Object>(PSRendererConfigurationOptions.class);
+ private final EnumMap<PSRendererConfigurationOption, Object> params
+ = new EnumMap<PSRendererConfigurationOption, Object>(PSRendererConfigurationOption.class);
private final DefaultFontConfig fontConfig;
return (PSRenderingMode) params.get(RENDERING_MODE);
}
+ /**
+ * The PostScript renderer configuration data parser.
+ */
public static final class PSRendererConfigParser implements RendererConfigParser {
private static final Log LOG = LogFactory.getLog(PSRendererConfigParser.class);
}
}
- private void setConfigParameter(PSRendererConfigurationOptions option,
+ private void setConfigParameter(PSRendererConfigurationOption option,
Object value) {
config.params.put(option, value != null ? value : option.getDefaultValue());
}
- private void setBoolConfigParam(Configuration cfg, PSRendererConfigurationOptions option) {
+ private void setBoolConfigParam(Configuration cfg, PSRendererConfigurationOption option) {
setConfigParameter(option, cfg.getChild(
option.getName()).getValueAsBoolean((Boolean) option.getDefaultValue()));
}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.ps;
+
+import org.apache.xmlgraphics.ps.PSGenerator;
+
+import org.apache.fop.render.RendererConfigOption;
+
+/**
+ * An enumeration of the PostScript renderer configuration options along with their default values.
+ */
+public enum PSRendererConfigurationOption implements RendererConfigOption {
+ /** Indicates whether landscape pages should be rotated, default: false */
+ AUTO_ROTATE_LANDSCAPE("auto-rotate-landscape", false),
+ /** Sets the PostScript language leven, default: {@see PSGenerator#DEFAULT_LANGUAGE_LEVEL}*/
+ LANGUAGE_LEVEL("language-level", PSGenerator.DEFAULT_LANGUAGE_LEVEL),
+ /** Whether resources should be optimized in a post-processing run, default: false */
+ OPTIMIZE_RESOURCES("optimize-resources", false),
+ /** Indicates whether the "safe setpagedevice" mode is active, default: false */
+ SAFE_SET_PAGE_DEVICE("safe-set-page-device", false),
+ /** Indicates whether the PostScript output should be DSC compliant, default: true*/
+ DSC_COMPLIANT("dsc-compliant", true),
+ RENDERING_MODE("rendering", PSRenderingMode.QUALITY);
+
+ private final String name;
+ private final Object defaultValue;
+
+ private PSRendererConfigurationOption(String name, Object defaultValue) {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Object getDefaultValue() {
+ return defaultValue;
+ }
+}
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.render.ps;
-
-import org.apache.xmlgraphics.ps.PSGenerator;
-
-import org.apache.fop.render.RendererConfigOptions;
-
-/**
- * An enumeration of the PostScript renderer configuration options along with their default values.
- */
-public enum PSRendererConfigurationOptions implements RendererConfigOptions {
- /** Indicates whether landscape pages should be rotated, default: false */
- AUTO_ROTATE_LANDSCAPE("auto-rotate-landscape", false),
- /** Sets the PostScript language leven, default: {@see PSGenerator#DEFAULT_LANGUAGE_LEVEL}*/
- LANGUAGE_LEVEL("language-level", PSGenerator.DEFAULT_LANGUAGE_LEVEL),
- /** Whether resources should be optimized in a post-processing run, default: false */
- OPTIMIZE_RESOURCES("optimize-resources", false),
- /** Indicates whether the "safe setpagedevice" mode is active, default: false */
- SAFE_SET_PAGE_DEVICE("safe-set-page-device", false),
- /** Indicates whether the PostScript output should be DSC compliant, default: true*/
- DSC_COMPLIANT("dsc-compliant", true),
- RENDERING_MODE("rendering", PSRenderingMode.QUALITY);
-
- private final String name;
- private final Object defaultValue;
-
- private PSRendererConfigurationOptions(String name, Object defaultValue) {
- this.name = name;
- this.defaultValue = defaultValue;
- }
-
- public String getName() {
- return name;
- }
-
- public Object getDefaultValue() {
- return defaultValue;
- }
-}
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.render.DefaultRendererConfigurator;
import org.apache.fop.render.RendererConfig.RendererConfigParser;
-import org.apache.fop.render.adobe.AdobeRendererConfigurator;
import org.apache.fop.render.intermediate.IFDocumentHandler;
import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator;
/**
* Postscript renderer config
*/
-public class PSRendererConfigurator extends AdobeRendererConfigurator
+public class PSRendererConfigurator extends DefaultRendererConfigurator
implements IFDocumentHandlerConfigurator {
/**
import org.apache.fop.render.ps.extensions.PSExtensionAttachment;
import org.apache.fop.render.ps.extensions.PSSetupCode;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.AUTO_ROTATE_LANDSCAPE;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.LANGUAGE_LEVEL;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.OPTIMIZE_RESOURCES;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.AUTO_ROTATE_LANDSCAPE;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.LANGUAGE_LEVEL;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.OPTIMIZE_RESOURCES;
/**
* Utility class which enables all sorts of features that are not directly connected to the
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.render.DefaultRendererConfigurator;
import org.apache.fop.render.Renderer;
import org.apache.fop.render.RendererConfig.RendererConfigParser;
-import org.apache.fop.render.adobe.AdobeRendererConfigurator;
/**
* TXT Renderer configurator
*/
-public class TXTRendererConfigurator extends AdobeRendererConfigurator {
+public class TXTRendererConfigurator extends DefaultRendererConfigurator {
/**
* Default constructor
import org.apache.fop.fonts.DefaultFontConfig;
import org.apache.fop.fonts.DefaultFontConfig.DefaultFontConfigParser;
import org.apache.fop.render.RendererConfig;
-import org.apache.fop.render.RendererConfigOptions;
+import org.apache.fop.render.RendererConfigOption;
-public class TxtRendererConfig implements RendererConfig {
+/**
+ * The Text renderer configuration data object.
+ */
+public final class TxtRendererConfig implements RendererConfig {
- public enum TxtRendererConfigOptions implements RendererConfigOptions {
+ public enum TxtRendererConfigOption implements RendererConfigOption {
ENCODING("encoding", "UTF-8");
private final String name;
private final Object defaultValue;
- private TxtRendererConfigOptions(String name, Object defaultValue) {
+ private TxtRendererConfigOption(String name, Object defaultValue) {
this.name = name;
this.defaultValue = defaultValue;
}
}
}
- private final EnumMap<TxtRendererConfigOptions, Object> params
- = new EnumMap<TxtRendererConfigOptions, Object>(TxtRendererConfigOptions.class);
+ private final EnumMap<TxtRendererConfigOption, Object> params
+ = new EnumMap<TxtRendererConfigOption, Object>(TxtRendererConfigOption.class);
private final DefaultFontConfig fontConfig;
}
public String getEncoding() {
- return (String) params.get(TxtRendererConfigOptions.ENCODING);
+ return (String) params.get(TxtRendererConfigOption.ENCODING);
}
+ /**
+ * The Text renderer configuration data parser.
+ */
public static final class TxtRendererConfigParser implements RendererConfigParser {
+ /** {@inheritDoc} */
public TxtRendererConfig build(FOUserAgent userAgent, Configuration cfg) throws FOPException {
TxtRendererConfig config = new TxtRendererConfig(new DefaultFontConfigParser().parse(cfg,
userAgent.validateStrictly()));
if (cfg != null) {
- TxtRendererConfigOptions option = TxtRendererConfigOptions.ENCODING;
+ TxtRendererConfigOption option = TxtRendererConfigOption.ENCODING;
String value = cfg.getChild(option.getName(), true).getValue(null);
config.params.put(option, value != null ? value : option.getDefaultValue());
}
return config;
}
+ /** {@inheritDoc} */
public String getMimeType() {
return MimeConstants.MIME_PLAIN_TEXT;
}
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.apps.io.ResourceResolverFactory;
import org.apache.fop.apps.io.InternalResourceResolver;
+import org.apache.fop.apps.io.ResourceResolverFactory;
import org.apache.fop.fonts.DefaultFontConfig;
import org.apache.fop.fonts.DefaultFontConfigurator;
import org.apache.fop.fonts.EmbedFontInfo;
package org.apache.fop.apps;
-
-import java.net.URI;
import java.util.Map;
import org.w3c.dom.Element;
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
import org.apache.fop.render.afp.AFPRendererConfig;
-import org.apache.fop.render.afp.AFPRendererConfig.Options;
+import org.apache.fop.render.afp.AFPRendererConfigOption;
import org.apache.fop.render.afp.AFPShadingMode;
import static org.apache.fop.render.afp.AFPRendererConfig.ImagesModeOptions.MODE_GRAYSCALE;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.DEFAULT_RESOURCE_LEVELS;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_DITHERING_QUALITY;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_FS45;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_JPEG;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_MAPPING_OPTION;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_MODE;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_NATIVE;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.IMAGES_WRAP_PSEG;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.JPEG_ALLOW_JPEG_EMBEDDING;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.JPEG_BITMAP_ENCODING_QUALITY;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.RENDERER_RESOLUTION;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.LINE_WIDTH_CORRECTION;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.RESOURCE_GROUP_URI;
-import static org.apache.fop.render.afp.AFPRendererConfig.Options.SHADING;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.DEFAULT_RESOURCE_LEVELS;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_DITHERING_QUALITY;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_FS45;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_JPEG;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_MAPPING_OPTION;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_MODE;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_NATIVE;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.IMAGES_WRAP_PSEG;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.JPEG_ALLOW_JPEG_EMBEDDING;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.JPEG_BITMAP_ENCODING_QUALITY;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.LINE_WIDTH_CORRECTION;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.RENDERER_RESOLUTION;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.RESOURCE_GROUP_URI;
+import static org.apache.fop.render.afp.AFPRendererConfigOption.SHADING;
/**
* A config builder specific to a particular renderer for specific MIME type.
super(MimeConstants.MIME_AFP);
}
- private AFPRendererConfBuilder createTextElement(Options option, String value) {
+ private AFPRendererConfBuilder createTextElement(AFPRendererConfigOption option, String value) {
createTextElement(option.getName(), value);
return this;
}
return AFPRendererConfBuilder.this.endImages();
}
- private ImagesBuilder setAttribute(Options options, Object value) {
+ private ImagesBuilder setAttribute(AFPRendererConfigOption options, Object value) {
return setAttribute(options.getName(), value);
}
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.ANTI_ALIASING;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.BACKGROUND_COLOR;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_QUALITY_ELEMENT;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.ANTI_ALIASING;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.BACKGROUND_COLOR;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_QUALITY_ELEMENT;
public class BitmapRendererConfBuilder extends RendererConfBuilder {
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.fop.apps;
+
+import java.net.URI;
+
+import org.junit.Test;
+
+import org.apache.fop.apps.io.ResourceResolver;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+
+public class EnvironmentalProfileFactoryTestCase {
+
+ private final URI testURI = URI.create("this.is.purely.for.test.purposes");
+
+ @Test
+ public void testCreateDefault() {
+ ResourceResolver mockedResolver = mock(ResourceResolver.class);
+ EnvironmentProfile sut = EnvironmentalProfileFactory.createDefault(testURI, mockedResolver);
+ assertEquals(mockedResolver, sut.getResourceResolver());
+ }
+}
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.apache.fop.render.RendererConfigOptions;
+import org.apache.fop.render.RendererConfigOption;
/**
* A builder class for creating fop.xconf XML DOMs for test purposes. You can set all the necessary
return createTextElement(name, value, rendererEl);
}
- protected final Element createTextElement(RendererConfigOptions option, String value) {
+ protected final Element createTextElement(RendererConfigOption option, String value) {
return createTextElement(option.getName(), value, rendererEl);
}
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
-import static org.apache.fop.render.java2d.Java2DRendererOptions.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
+import static org.apache.fop.render.java2d.Java2DRendererOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
public class Java2DRendererConfBuilder extends RendererConfBuilder {
import org.w3c.dom.Element;
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
-import org.apache.fop.render.RendererConfigOptions;
-import org.apache.fop.render.pdf.PDFRendererConfigOptions;
-
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.DISABLE_SRGB_COLORSPACE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.ENCRYPTION_LENGTH;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.ENCRYPTION_PARAMS;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.FILTER_LIST;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.OUTPUT_PROFILE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.OWNER_PASSWORD;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.PDF_A_MODE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.PDF_X_MODE;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.USER_PASSWORD;
-import static org.apache.fop.render.pdf.PDFRendererConfigOptions.VERSION;
+import org.apache.fop.render.RendererConfigOption;
+import org.apache.fop.render.pdf.PDFRendererConfigOption;
+
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.DISABLE_SRGB_COLORSPACE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.ENCRYPTION_LENGTH;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.ENCRYPTION_PARAMS;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.FILTER_LIST;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.OUTPUT_PROFILE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.OWNER_PASSWORD;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.PDF_A_MODE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.PDF_X_MODE;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.USER_PASSWORD;
+import static org.apache.fop.render.pdf.PDFRendererConfigOption.VERSION;
/**
* A config builder specific to a particular renderer for specific MIME type.
return this;
}
- public EncryptionParamsBuilder setAllowParam(PDFRendererConfigOptions option) {
+ public EncryptionParamsBuilder setAllowParam(PDFRendererConfigOption option) {
el.appendChild(createElement(option.getName()));
return this;
}
return PDFRendererConfBuilder.this.endEncryptionParams();
}
- private void createTextElement(RendererConfigOptions name, String value) {
+ private void createTextElement(RendererConfigOption name, String value) {
PDFRendererConfBuilder.this.createTextElement(name.getName(), value, el);
}
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.AUTO_ROTATE_LANDSCAPE;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.DSC_COMPLIANT;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.LANGUAGE_LEVEL;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.OPTIMIZE_RESOURCES;
-import static org.apache.fop.render.ps.PSRendererConfigurationOptions.SAFE_SET_PAGE_DEVICE;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.AUTO_ROTATE_LANDSCAPE;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.DSC_COMPLIANT;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.LANGUAGE_LEVEL;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.OPTIMIZE_RESOURCES;
+import static org.apache.fop.render.ps.PSRendererConfigurationOption.SAFE_SET_PAGE_DEVICE;
/**
* A fop conf builder specific to a particular renderer for Postscript.
package org.apache.fop.apps;
-import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigOptions.COMPRESSION;
+import static org.apache.fop.render.bitmap.TIFFRendererConfig.TIFFRendererConfigOption.COMPRESSION;
public class TIFFRendererConfBuilder extends BitmapRendererConfBuilder {
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
-import static org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigOptions.ENCODING;
+import static org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigOption.ENCODING;
public class TxtRendererConfBuilder extends RendererConfBuilder {
import org.apache.fop.apps.BitmapRendererConfBuilder;
import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_BILEVEL;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_BINARY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_GRAY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_RGB;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_RGBA;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_QUALITY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_SPEED;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_BILEVEL;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_BINARY;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_GRAY;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_RGB;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_RGBA;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.JAVA2D_TRANSPARENT_PAGE_BACKGROUND;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_QUALITY;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_SPEED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import org.apache.fop.render.intermediate.IFDocumentHandler;
import org.apache.fop.util.ColorUtil;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_BILEVEL;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_BINARY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_GRAY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_RGB;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.COLOR_MODE_RGBA;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_QUALITY;
-import static org.apache.fop.render.bitmap.BitmapRendererConfigOptions.RENDERING_SPEED;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_BILEVEL;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_BINARY;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_GRAY;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_RGB;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.COLOR_MODE_RGBA;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_QUALITY;
+import static org.apache.fop.render.bitmap.BitmapRendererConfigOption.RENDERING_SPEED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
package org.apache.fop.render.bitmap;
+import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.bitmap.BitmapRendererConfig.BitmapRendererConfigParser;
public class BitmapRendererConfigParserTestCase extends AbstractBitmapRendererConfigParserTester {
public BitmapRendererConfigParserTestCase() {
- super(new BitmapRendererConfigParser("bitmap"));
+ super(new BitmapRendererConfigParser(MimeConstants.MIME_BITMAP));
}
}
import org.apache.fop.apps.FopConfBuilder.RendererConfBuilder;
import org.apache.fop.apps.MimeConstants;
-import org.apache.fop.render.pcl.PCLRendererConfig.Options;
-import static org.apache.fop.render.pcl.PCLRendererConfig.Options.DISABLE_PJL;
-import static org.apache.fop.render.pcl.PCLRendererConfig.Options.RENDERING_MODE;
-import static org.apache.fop.render.pcl.PCLRendererConfig.Options.TEXT_RENDERING;
+import static org.apache.fop.render.pcl.Java2DRendererConfigOption.DISABLE_PJL;
+import static org.apache.fop.render.pcl.Java2DRendererConfigOption.RENDERING_MODE;
+import static org.apache.fop.render.pcl.Java2DRendererConfigOption.TEXT_RENDERING;
/**
* A config builder specific to a particular renderer for specific MIME type.
*/
return createTextElement(DISABLE_PJL, String.valueOf(value));
}
- private PCLRendererConfBuilder createTextElement(Options option, String value) {
+ private PCLRendererConfBuilder createTextElement(Java2DRendererConfigOption option, String value) {
createTextElement(option.getName(), value);
return this;
}
assertEquals(testPassword, conf.getEncryptionParameters().getUserPassword());
}
- private void testRestrictEncryptionParameter(PDFRendererConfigOptions option)
+ private void testRestrictEncryptionParameter(PDFRendererConfigOption option)
throws Exception {
parseConfig(createRenderer().startEncryptionParams()
.setAllowParam(option)
assertTrue(testEncryptionParameter(option));
}
- public boolean testEncryptionParameter(PDFRendererConfigOptions option) throws Exception {
+ public boolean testEncryptionParameter(PDFRendererConfigOption option) throws Exception {
switch (option) {
case NO_PRINT:
return conf.getEncryptionParameters().isAllowPrint();
@Test
public void testAllEncryptionRestrictions() throws Exception {
- testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_PRINT);
- testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_ACCESSCONTENT);
- testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_ANNOTATIONS);
- testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_ASSEMBLEDOC);
- testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_COPY_CONTENT);
- testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_EDIT_CONTENT);
- testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_FILLINFORMS);
- testRestrictEncryptionParameter(PDFRendererConfigOptions.NO_PRINTHQ);
+ testRestrictEncryptionParameter(PDFRendererConfigOption.NO_PRINT);
+ testRestrictEncryptionParameter(PDFRendererConfigOption.NO_ACCESSCONTENT);
+ testRestrictEncryptionParameter(PDFRendererConfigOption.NO_ANNOTATIONS);
+ testRestrictEncryptionParameter(PDFRendererConfigOption.NO_ASSEMBLEDOC);
+ testRestrictEncryptionParameter(PDFRendererConfigOption.NO_COPY_CONTENT);
+ testRestrictEncryptionParameter(PDFRendererConfigOption.NO_EDIT_CONTENT);
+ testRestrictEncryptionParameter(PDFRendererConfigOption.NO_FILLINFORMS);
+ testRestrictEncryptionParameter(PDFRendererConfigOption.NO_PRINTHQ);
}
@Test
import org.apache.fop.apps.AbstractRendererConfigParserTester;
import org.apache.fop.apps.TxtRendererConfBuilder;
import org.apache.fop.render.RendererConfig.RendererConfigParser;
-import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigOptions;
+import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigOption;
import org.apache.fop.render.txt.TxtRendererConfig.TxtRendererConfigParser;
import static org.junit.Assert.assertEquals;
// Check the default behaviour is expected
parseConfig(createRenderer());
- assertEquals(TxtRendererConfigOptions.ENCODING.getDefaultValue(), conf.getEncoding());
+ assertEquals(TxtRendererConfigOption.ENCODING.getDefaultValue(), conf.getEncoding());
}
}