diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2012-04-13 16:49:35 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2012-04-13 16:49:35 +0000 |
commit | a438a377ef974181a4b0a71f9d399e31f654588b (patch) | |
tree | 0eb9720c40f65c19437f731db0b34483e9f9b545 /src/java/org/apache/fop/afp | |
parent | 55c1f8be3cf6da96f690f34743d47ecee95243bb (diff) | |
parent | 50b34f584998b9083b07ec018d84dd38b96e732c (diff) | |
download | xmlgraphics-fop-a438a377ef974181a4b0a71f9d399e31f654588b.tar.gz xmlgraphics-fop-a438a377ef974181a4b0a71f9d399e31f654588b.zip |
Merged changes from trunk up to rev. 1325806
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript@1325839 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/afp')
6 files changed, 62 insertions, 18 deletions
diff --git a/src/java/org/apache/fop/afp/AFPPaintingState.java b/src/java/org/apache/fop/afp/AFPPaintingState.java index 1c87b27d2..7e6b940a5 100644 --- a/src/java/org/apache/fop/afp/AFPPaintingState.java +++ b/src/java/org/apache/fop/afp/AFPPaintingState.java @@ -84,6 +84,13 @@ public class AFPPaintingState extends org.apache.fop.util.AbstractPaintingState /** determines whether to stroke text in GOCA mode or to use text operators where possible */ private boolean strokeGocaText = false; + + /** use page segment with F11 and F45 images*/ + private boolean pSeg; + + /** use FS45 images*/ + private boolean fs45; + /** the current page */ private transient AFPPagePaintingState pagePaintingState = new AFPPagePaintingState(); @@ -356,6 +363,41 @@ public class AFPPaintingState extends org.apache.fop.util.AbstractPaintingState return this.strokeGocaText; } + /** + * Whether FS11 and SF45 non-inline images should be wrapped in a page segment + * @return true iff images should be wrapped + */ + public boolean getWrapPSeg() { + return pSeg; + } + + /** + * Sets whether FS11 and FS45 non-inline images should be wrapped in a page segment + * @param pSeg true iff images should be wrapped + */ + public void setWrapPSeg(boolean pSeg) { + this.pSeg = pSeg; + } + + + /** + * gets whether images should be FS45 + * @return true iff images should be FS45 + */ + public boolean getFS45() { + return fs45; + } + + /** + * sets whether images should be FS45 + * @param fs45 true iff images should be FS45 + */ + public void setFS45(boolean fs45) { + this.fs45 = fs45; + } + + + /** {@inheritDoc} */ @Override protected AbstractData instantiateData() { diff --git a/src/java/org/apache/fop/afp/AFPResourceLevel.java b/src/java/org/apache/fop/afp/AFPResourceLevel.java index 327a99bd5..d884b56a6 100644 --- a/src/java/org/apache/fop/afp/AFPResourceLevel.java +++ b/src/java/org/apache/fop/afp/AFPResourceLevel.java @@ -186,7 +186,7 @@ public class AFPResourceLevel { } AFPResourceLevel rl = (AFPResourceLevel)obj; - return (level == level) + return (level == rl.level) && (extFilePath == rl.extFilePath || extFilePath != null && extFilePath.equals(rl.extFilePath)); } diff --git a/src/java/org/apache/fop/afp/fonts/AFPFont.java b/src/java/org/apache/fop/afp/fonts/AFPFont.java index f64410fdd..8a4ae3dc1 100644 --- a/src/java/org/apache/fop/afp/fonts/AFPFont.java +++ b/src/java/org/apache/fop/afp/fonts/AFPFont.java @@ -19,6 +19,7 @@ package org.apache.fop.afp.fonts; +import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -62,8 +63,8 @@ public abstract class AFPFont extends Typeface { } /** {@inheritDoc} */ - public Set getFamilyNames() { - Set s = new java.util.HashSet(); + public Set<String> getFamilyNames() { + Set<String> s = new HashSet<String>(); s.add(this.name); return s; } diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java b/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java index e6c4e6907..4988bb949 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java +++ b/src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java @@ -285,12 +285,12 @@ public abstract class CharacterSetBuilder { CharacterSetOrientation[] characterSetOrientations = processFontOrientation(structuredFieldReader); - int metricNormalizationFactor; + double metricNormalizationFactor; if (fontControl.isRelative()) { metricNormalizationFactor = 1; } else { int dpi = fontControl.getDpi(); - metricNormalizationFactor = 1000 * 72000 + metricNormalizationFactor = 1000.0d * 72000.0d / fontDescriptor.getNominalFontSizeInMillipoints() / dpi; } diff --git a/src/java/org/apache/fop/afp/fonts/RasterFont.java b/src/java/org/apache/fop/afp/fonts/RasterFont.java index da5060ccc..30704b2b0 100644 --- a/src/java/org/apache/fop/afp/fonts/RasterFont.java +++ b/src/java/org/apache/fop/afp/fonts/RasterFont.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.SortedMap; +import java.util.TreeMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -39,9 +40,8 @@ public class RasterFont extends AFPFont { /** Static logging instance */ protected static final Log LOG = LogFactory.getLog("org.apache.fop.afp.fonts"); - private final SortedMap/*<Integer,CharacterSet>*/ charSets - = new java.util.TreeMap/*<Integer,CharacterSet>*/(); - private Map/*<Integer,CharacterSet>*/ substitutionCharSets; + private final SortedMap<Integer, CharacterSet> charSets = new TreeMap<Integer, CharacterSet>(); + private Map<Integer, CharacterSet> substitutionCharSets; private CharacterSet charSet = null; @@ -92,8 +92,8 @@ public class RasterFont extends AFPFont { // No match or substitution found, but there exist entries // for other sizes // Get char set with nearest, smallest font size - SortedMap smallerSizes = charSets.headMap(requestedSize); - SortedMap largerSizes = charSets.tailMap(requestedSize); + SortedMap<Integer, CharacterSet> smallerSizes = charSets.headMap(requestedSize); + SortedMap<Integer, CharacterSet> largerSizes = charSets.tailMap(requestedSize); int smallerSize = smallerSizes.isEmpty() ? 0 : ((Integer)smallerSizes.lastKey()).intValue(); int largerSize = largerSizes.isEmpty() ? Integer.MAX_VALUE @@ -112,7 +112,7 @@ public class RasterFont extends AFPFont { // Add the substitute mapping, so subsequent calls will // find it immediately if (substitutionCharSets == null) { - substitutionCharSets = new HashMap(); + substitutionCharSets = new HashMap<Integer, CharacterSet>(); } substitutionCharSets.put(requestedSize, csm); // do not output the warning if the font size is closer to an integer less than 0.1 @@ -140,9 +140,9 @@ public class RasterFont extends AFPFont { * @return the first character in this font. */ public int getFirstChar() { - Iterator it = charSets.values().iterator(); + Iterator<CharacterSet> it = charSets.values().iterator(); if (it.hasNext()) { - CharacterSet csm = (CharacterSet) it.next(); + CharacterSet csm = it.next(); return csm.getFirstChar(); } else { String msg = "getFirstChar() - No character set found for font:" + getFontName(); @@ -157,9 +157,9 @@ public class RasterFont extends AFPFont { */ public int getLastChar() { - Iterator it = charSets.values().iterator(); + Iterator<CharacterSet> it = charSets.values().iterator(); if (it.hasNext()) { - CharacterSet csm = (CharacterSet) it.next(); + CharacterSet csm = it.next(); return csm.getLastChar(); } else { String msg = "getLastChar() - No character set found for font:" + getFontName(); diff --git a/src/java/org/apache/fop/afp/modca/ImageObject.java b/src/java/org/apache/fop/afp/modca/ImageObject.java index c6cfa3808..adb56e626 100644 --- a/src/java/org/apache/fop/afp/modca/ImageObject.java +++ b/src/java/org/apache/fop/afp/modca/ImageObject.java @@ -75,10 +75,11 @@ public class ImageObject extends AbstractDataObject { int dataHeightRes = imageObjectInfo.getDataWidthRes(); ImageDataDescriptor imageDataDescriptor = factory.createImageDataDescriptor(dataWidth, dataHeight, dataWidthRes, dataHeightRes); - if (imageObjectInfo.getBitsPerPixel() == 1) { - imageDataDescriptor.setFunctionSet(ImageDataDescriptor.FUNCTION_SET_FS10); - } else if (MimeConstants.MIME_AFP_IOCA_FS45.equals(imageObjectInfo.getMimeType())) { + + if (MimeConstants.MIME_AFP_IOCA_FS45.equals(imageObjectInfo.getMimeType())) { imageDataDescriptor.setFunctionSet(ImageDataDescriptor.FUNCTION_SET_FS45); + } else if (imageObjectInfo.getBitsPerPixel() == 1) { + imageDataDescriptor.setFunctionSet(ImageDataDescriptor.FUNCTION_SET_FS10); } getObjectEnvironmentGroup().setDataDescriptor(imageDataDescriptor); getObjectEnvironmentGroup().setMapImageObject( |