diff options
author | Jeremias Maerki <jeremias@apache.org> | 2009-07-27 16:33:01 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2009-07-27 16:33:01 +0000 |
commit | a11874283eb80e4ce5759196bb1a751e3c93e5ac (patch) | |
tree | a45243590a2691b1341667b2f86b607e3f71ad4d /src/java/org/apache/fop/afp/fonts | |
parent | c29f2ba1ecada01d680ff1ce9ce76898243681f0 (diff) | |
download | xmlgraphics-fop-a11874283eb80e4ce5759196bb1a751e3c93e5ac.tar.gz xmlgraphics-fop-a11874283eb80e4ce5759196bb1a751e3c93e5ac.zip |
Added support for AFP font embedding. Note: this changes the default behaviour. Like with PDF and PS, all fonts are embedded by default unless matched in the "referenced-fonts" section in the configuration.
Added support for embedding external AFP form maps (form defs) using the afp:include-form-map extension.
Fixed a small problem with AFP-related events.
DefaultFOPResourceAccessor got a fallback to the user agent's base URI if no category base URI is specified.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@798207 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/afp/fonts')
-rw-r--r-- | src/java/org/apache/fop/afp/fonts/AFPBase12FontCollection.java | 30 | ||||
-rw-r--r-- | src/java/org/apache/fop/afp/fonts/AFPFont.java | 12 |
2 files changed, 29 insertions, 13 deletions
diff --git a/src/java/org/apache/fop/afp/fonts/AFPBase12FontCollection.java b/src/java/org/apache/fop/afp/fonts/AFPBase12FontCollection.java index fd9b05304..417250df1 100644 --- a/src/java/org/apache/fop/afp/fonts/AFPBase12FontCollection.java +++ b/src/java/org/apache/fop/afp/fonts/AFPBase12FontCollection.java @@ -80,22 +80,22 @@ public class AFPBase12FontCollection implements FontCollection { /** standard font family reference names for Helvetica font */ final String[] helveticaNames = {"Helvetica", "Arial", "sans-serif"}; - font = new RasterFont("Helvetica"); + font = createReferencedRasterFont("Helvetica"); addCharacterSet(font, "C0H200", new Helvetica()); num = addFontProperties(fontInfo, font, helveticaNames, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL, num); - font = new RasterFont("Helvetica Italic"); + font = createReferencedRasterFont("Helvetica Italic"); addCharacterSet(font, "C0H300", new HelveticaOblique()); num = addFontProperties(fontInfo, font, helveticaNames, Font.STYLE_ITALIC, Font.WEIGHT_NORMAL, num); - font = new RasterFont("Helvetica (Semi) Bold"); + font = createReferencedRasterFont("Helvetica (Semi) Bold"); addCharacterSet(font, "C0H400", new HelveticaBold()); num = addFontProperties(fontInfo, font, helveticaNames, Font.STYLE_NORMAL, Font.WEIGHT_BOLD, num); - font = new RasterFont("Helvetica Italic (Semi) Bold"); + font = createReferencedRasterFont("Helvetica Italic (Semi) Bold"); addCharacterSet(font, "C0H500", new HelveticaOblique()); num = addFontProperties(fontInfo, font, helveticaNames, Font.STYLE_ITALIC, Font.WEIGHT_BOLD, num); @@ -107,22 +107,22 @@ public class AFPBase12FontCollection implements FontCollection { final String[] timesNames = {"Times", "TimesRoman", "Times Roman", "Times-Roman", "Times New Roman", "TimesNewRoman", "serif", "any"}; - font = new RasterFont("Times Roman"); + font = createReferencedRasterFont("Times Roman"); addCharacterSet(font, "CON200", new TimesRoman()); num = addFontProperties(fontInfo, font, timesNames, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL, num); - font = new RasterFont("Times Roman Italic"); + font = createReferencedRasterFont("Times Roman Italic"); addCharacterSet(font, "CON300", new TimesItalic()); num = addFontProperties(fontInfo, font, timesNames, Font.STYLE_ITALIC, Font.WEIGHT_NORMAL, num); - font = new RasterFont("Times Roman Bold"); + font = createReferencedRasterFont("Times Roman Bold"); addCharacterSet(font, "CON400", new TimesBold()); num = addFontProperties(fontInfo, font, timesNames, Font.STYLE_NORMAL, Font.WEIGHT_BOLD, num); - font = new RasterFont("Times Roman Italic Bold"); + font = createReferencedRasterFont("Times Roman Italic Bold"); addCharacterSet(font, "CON500", new TimesBoldItalic()); num = addFontProperties(fontInfo, font, timesNames, Font.STYLE_ITALIC, Font.WEIGHT_BOLD, num); @@ -131,22 +131,22 @@ public class AFPBase12FontCollection implements FontCollection { /** standard font family reference names for Courier font */ final String[] courierNames = {"Courier", "monospace"}; - font = new RasterFont("Courier"); + font = createReferencedRasterFont("Courier"); addCharacterSet(font, "C04200", new Courier()); num = addFontProperties(fontInfo, font, courierNames, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL, num); - font = new RasterFont("Courier Italic"); + font = createReferencedRasterFont("Courier Italic"); addCharacterSet(font, "C04300", new CourierOblique()); num = addFontProperties(fontInfo, font, courierNames, Font.STYLE_ITALIC, Font.WEIGHT_NORMAL, num); - font = new RasterFont("Courier Bold"); + font = createReferencedRasterFont("Courier Bold"); addCharacterSet(font, "C04400", new CourierBold()); num = addFontProperties(fontInfo, font, courierNames, Font.STYLE_NORMAL, Font.WEIGHT_BOLD, num); - font = new RasterFont("Courier Italic Bold"); + font = createReferencedRasterFont("Courier Italic Bold"); addCharacterSet(font, "C04500", new CourierBoldOblique()); num = addFontProperties(fontInfo, font, courierNames, Font.STYLE_ITALIC, Font.WEIGHT_BOLD, num); @@ -154,4 +154,10 @@ public class AFPBase12FontCollection implements FontCollection { return num; } + private RasterFont createReferencedRasterFont(String fontFamily) { + RasterFont font = new RasterFont(fontFamily); + font.setEmbeddable(false); //Font is assumed to be available on the target platform + return font; + } + } diff --git a/src/java/org/apache/fop/afp/fonts/AFPFont.java b/src/java/org/apache/fop/afp/fonts/AFPFont.java index f56611087..a1c257d3e 100644 --- a/src/java/org/apache/fop/afp/fonts/AFPFont.java +++ b/src/java/org/apache/fop/afp/fonts/AFPFont.java @@ -36,6 +36,8 @@ public abstract class AFPFont extends Typeface { /** The font name */ protected String name; + private boolean embeddable = true; + /** * Constructor for the base font requires the name. * @param name the name of the font @@ -98,11 +100,19 @@ public abstract class AFPFont extends Typeface { public abstract CharacterSet getCharacterSet(int size); /** + * Controls whether this font is embeddable or not. + * @param value true to enable embedding, false otherwise. + */ + public void setEmbeddable(boolean value) { + this.embeddable = value; + } + + /** * Indicates if this font may be embedded. * @return True, if embedding is possible/permitted */ public boolean isEmbeddable() { - return false; //TODO Complete AFP font embedding + return this.embeddable; } /** {@inheritDoc} */ |