From a30e3c29fd55d4d1b70f386180a8e7936a9dd799 Mon Sep 17 00:00:00 2001
From: Jeremias Maerki
+ The effect here is that whenever FOP encounters the URI specified in the extension, + it will effectively generate code to include the page segment with the given name + instead of embedding the image referenced by the URI. The URI is still required as + the underlying image serves as a provider for the intrinsic size of the image + (At the moment, FOP is unable to extract the intrinsic size of the page segment from + an AFP resource file). For the image to appear in an AFP viewer or to be printed, the + AFP resource must be available on the target device. FOP does not embed the page + segment in the generated file. Please also note that page segments cannot be scaled. + They are always rendered in their intrinsic size. +
Currently, two output formats are supported: PNG and TIFF. TIFF produces
one file with multiple pages, while PNG output produces one file per
- page. The quality of the bitmap depends on the target resolution setting
- on the FOUserAgent.
+ page. Note: FOP can only produce multiple files (with PNG output) if
+ you can set a java.io.File
indicating the primary PNG file
+ using the FOUserAgent.setOutputFile(File)
method.
+
+ The quality of the bitmap depends on the target resolution setting + on the FOUserAgent and on further settings described below.
- The default value for the "transparent-page-background" setting is "false" which
- paints an opaque, white background for the whole image. If you set this to true,
+ The default value for the "color-mode"
setting is "rgba"
which
+ is equivalent to a 24bit RGB image with an 8bit alpha channel for transparency.
+ Valid values are:
+
rgba
: RGB with alpha channel (24bit + 8bit = 32bit)rgb
: RGB (24bit)gray
: gray (8bit)bi-level
(or binary
): bi-level (1bit)+ Please note that there is currently no dithering or error diffusion available for bi-level + bitmap output. +
+
+ The default value for the "transparent-page-background"
setting is
+ "false"
which paints an opaque, white background for the whole image.
+ If you set this to "true"
,
no such background will be painted and you will get a transparent image if
an alpha channel is available in the output format.
+ The default value for the "background-color"
setting is "white"
.
+ The color specifies in which color the page background is painted. It will only be
+ painted if "transparent-page-background"
is not set to "true"
.
+ All XSL-FO colors (including color functions) can be used.
+
+ The default value for the "anti-aliasing"
setting is "true"
.
+ You can set this value to "false"
to disable anti-aliasing and
+ thus improve rendering speeds a bit at the loss of some image quality.
+
+ The default value for the "rendering"
setting is "true"
.
+ You can set this value to "false"
to improve rendering speeds a bit
+ at the loss of some image quality. If this setting has an actual effect depends
+ on the JVM's Java2D backend.
+
NONE
(no compression)PackBits
(RLE, run-length encoding)JPEG
Deflate
LZW
ZLib
CCITT T.4
(Fax Group 3)CCITT T.6
(Fax Group 4)
+ This setting may override any setting made using the "color-mode"
. For example, if
+ "CCITT T.6"
is selected, the color mode is automatically forced to "bi-level"
because
+ this compression format only supports bi-level images.
+
+ The IF-based bitmap output implementations support a rendering option with the key + "target-bitmap-size" (value: java.awt.Dimension) that allows to force the pages to + be proportionally fit into a bitmap of a given size. This can be used to produce + thumbnails or little preview images of the individual pages. An example: +
+font-family=".*"
.
+
+ The referenced-fonts
element can be placed either inside the general
+ fonts
element (right under the root) or in the fonts
element
+ under the renderer configuration. In the first case, matches apply to all renderers.
+ In the second case, matches only apply to the renderer where the element was specified.
+ Both cases can be used at the same time.
+
Various notes related to embedded fonts:
diff --git a/src/java/org/apache/fop/fonts/FontInfoConfigurator.java b/src/java/org/apache/fop/fonts/FontInfoConfigurator.java index 208c32803..e0d52ad43 100644 --- a/src/java/org/apache/fop/fonts/FontInfoConfigurator.java +++ b/src/java/org/apache/fop/fonts/FontInfoConfigurator.java @@ -33,6 +33,7 @@ import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.apache.fop.apps.FOPException; import org.apache.fop.fonts.autodetect.FontFileFinder; import org.apache.fop.fonts.autodetect.FontInfoFinder; @@ -83,7 +84,7 @@ public class FontInfoConfigurator { } FontAdder fontAdder = new FontAdder(fontManager, fontResolver, listener); - + // native o/s search (autodetect) configuration boolean autodetectFonts = (fonts.getChild("auto-detect", false) != null); if (autodetectFonts) { @@ -93,7 +94,7 @@ public class FontInfoConfigurator { // Add configured directories to FontInfo addDirectories(fonts, fontAdder, fontInfoList); - + // Add configured fonts to FontInfo FontCache fontCache = fontManager.getFontCache(); addFonts(fonts, fontCache, fontInfoList); @@ -101,6 +102,14 @@ public class FontInfoConfigurator { // Update referenced fonts (fonts which are not to be embedded) fontManager.updateReferencedFonts(fontInfoList); + // Renderer-specific referenced fonts + Configuration referencedFontsCfg = fonts.getChild("referenced-fonts", false); + if (referencedFontsCfg != null) { + FontTriplet.Matcher matcher = FontManagerConfigurator.createFontsMatcher( + referencedFontsCfg, strict); + fontManager.updateReferencedFonts(fontInfoList, matcher); + } + // Update font cache if it has changed if (fontCache != null && fontCache.hasChanged()) { fontCache.save(); @@ -112,7 +121,7 @@ public class FontInfoConfigurator { } } } - + private void addDirectories(Configuration fontsCfg, FontAdder fontAdder, List/*The mandatory name attribute must refer to an 8 character (space padded) resource name that - must be known in the AFP processing environment.
+ must be known in the AFP processing environment. Optional x and y attributes can be specified + to place the Overlay at an offset from the top left of the page.