From: Simon Steiner Date: Mon, 28 Apr 2014 12:54:29 +0000 (+0000) Subject: FOP-2337 Remove xobj type=form X-Git-Tag: fop-2_0~121 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bc584b5ceac0a3fbc692292b617b183396239742;p=xmlgraphics-fop.git FOP-2337 Remove xobj type=form git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1590619 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/pdf/PDFResources.java b/src/java/org/apache/fop/pdf/PDFResources.java index 6d09d5738..dc6319f07 100644 --- a/src/java/org/apache/fop/pdf/PDFResources.java +++ b/src/java/org/apache/fop/pdf/PDFResources.java @@ -45,7 +45,7 @@ public class PDFResources extends PDFDictionary { /** * /Font objects keyed by their internal name */ - protected Map fonts = new LinkedHashMap(); + protected Map fonts = new LinkedHashMap(); /** * Set of XObjects @@ -76,6 +76,8 @@ public class PDFResources extends PDFDictionary { /** Named properties */ protected Map properties = new LinkedHashMap(); + private PDFResources parent; + /** * create a /Resources object. * @@ -87,13 +89,29 @@ public class PDFResources extends PDFDictionary { setObjectNumber(objnum); } + public void setParentResources(PDFResources p) { + parent = p; + } + + public PDFResources getParentResources() { + return parent; + } + /** * add font object to resources list. * * @param font the PDFFont to add */ public void addFont(PDFFont font) { - this.fonts.put(font.getName(), font); + fonts.put(font.getName(), font); + } + + public void addFont(String name, PDFDictionary font) { + fonts.put(name, font); + } + + public Map getFonts() { + return fonts; } /** @@ -220,12 +238,17 @@ public class PDFResources extends PDFDictionary { } private void populateDictionary() { - if (!this.fonts.isEmpty()) { + if (!this.fonts.isEmpty() || (parent != null && !parent.getFonts().isEmpty())) { PDFDictionary dict = new PDFDictionary(this); /* construct PDF dictionary of font object references */ - for (Map.Entry entry : fonts.entrySet()) { + for (Map.Entry entry : fonts.entrySet()) { dict.put(entry.getKey(), entry.getValue()); } + if (parent != null) { + for (Map.Entry entry : parent.getFonts().entrySet()) { + dict.put(entry.getKey(), entry.getValue()); + } + } put("Font", dict); } diff --git a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java b/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java index ac7b1d905..3f75554fb 100644 --- a/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java +++ b/src/java/org/apache/fop/render/pdf/PDFContentGenerator.java @@ -486,6 +486,13 @@ public class PDFContentGenerator { restoreGraphicsState(); } + public void placeImage(AffineTransform at, String stream) { + saveGraphicsState(); + concatenate(at); + add(stream); + restoreGraphicsState(); + } + /** * Places a previously registered image at a certain place on the page, * bracketing it as a marked-content sequence.