Merge lp:~james-page/ubuntu/oneiric/fop/mir into lp:ubuntu/oneiric/fop

Proposed by James Page
Status: Merged
Merged at revision: 17
Proposed branch: lp:~james-page/ubuntu/oneiric/fop/mir
Merge into: lp:ubuntu/oneiric/fop
Diff against target: 360 lines (+252/-6)
8 files modified
.pc/04_xmlgraphics-1.4_compat.patch/src/java/org/apache/fop/render/ps/NativeTextHandler.java (+188/-0)
.pc/applied-patches (+1/-0)
debian/changelog (+12/-0)
debian/control (+5/-4)
debian/patches/04_xmlgraphics-1.4_compat.patch (+37/-0)
debian/patches/series (+1/-0)
debian/rules (+1/-1)
src/java/org/apache/fop/render/ps/NativeTextHandler.java (+7/-1)
To merge this branch: bzr merge lp:~james-page/ubuntu/oneiric/fop/mir
Reviewer Review Type Date Requested Status
Dave Walker (community) Approve
Ubuntu branches Pending
Review via email: mp+63231@code.launchpad.net

Description of the change

Updates to fop to support migration to main.

These can be superceeded once fop 1.0 is release in Debian so not proposing to submit a patch back to Debian for this delta.

To post a comment you must log in.
19. By James Page

Re-enabled verbose build

Revision history for this message
Micah Gersten (micahg) wrote :

fop 1.0 is in experimental, does that not work for you?

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Micah, I believe the 1.0 from experimental needs the same changes as well.

Revision history for this message
Micah Gersten (micahg) wrote :

The description says otherwise, that's why I mentioned it :)

Revision history for this message
James Page (james-page) wrote :

Hi Micah

I don't want to sync fop 1.0 from Debian experimental for the following reasons:

 1) The orig.tar.gz includes a number of upstream bundled jar files
 2) It still depends on libservlet2.4-java

The first will be sorted out once its released to unstable (bug already raised in Debian) and I propose to work with the debian-java team to resolve the second one prior to sync.

This is really an interim patch so that the MIR can be approved; this will unblock the build of erlang in Oneiric which is currently failing due to component mismatches.

Cheers

James

Revision history for this message
James Page (james-page) wrote :

Hi

fop-1.0 is still not ready in Debian; see the latest update on the bug report:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=625869

There appear to be compatibility issues with libqdox-java which is a new dependency for fop-1.0.

I would still recommend that we use this patch in Ubuntu for the time being; once these issues have been resolved in Debian we can re-sync to 1.0

Cheers

James

Revision history for this message
Dave Walker (davewalker) wrote :

Looks good to me, uploading.

Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc/04_xmlgraphics-1.4_compat.patch'
2=== added directory '.pc/04_xmlgraphics-1.4_compat.patch/src'
3=== added directory '.pc/04_xmlgraphics-1.4_compat.patch/src/java'
4=== added directory '.pc/04_xmlgraphics-1.4_compat.patch/src/java/org'
5=== added directory '.pc/04_xmlgraphics-1.4_compat.patch/src/java/org/apache'
6=== added directory '.pc/04_xmlgraphics-1.4_compat.patch/src/java/org/apache/fop'
7=== added directory '.pc/04_xmlgraphics-1.4_compat.patch/src/java/org/apache/fop/render'
8=== added directory '.pc/04_xmlgraphics-1.4_compat.patch/src/java/org/apache/fop/render/ps'
9=== added file '.pc/04_xmlgraphics-1.4_compat.patch/src/java/org/apache/fop/render/ps/NativeTextHandler.java'
10--- .pc/04_xmlgraphics-1.4_compat.patch/src/java/org/apache/fop/render/ps/NativeTextHandler.java 1970-01-01 00:00:00 +0000
11+++ .pc/04_xmlgraphics-1.4_compat.patch/src/java/org/apache/fop/render/ps/NativeTextHandler.java 2011-06-02 13:11:16 +0000
12@@ -0,0 +1,188 @@
13+/*
14+ * Licensed to the Apache Software Foundation (ASF) under one or more
15+ * contributor license agreements. See the NOTICE file distributed with
16+ * this work for additional information regarding copyright ownership.
17+ * The ASF licenses this file to You under the Apache License, Version 2.0
18+ * (the "License"); you may not use this file except in compliance with
19+ * the License. You may obtain a copy of the License at
20+ *
21+ * http://www.apache.org/licenses/LICENSE-2.0
22+ *
23+ * Unless required by applicable law or agreed to in writing, software
24+ * distributed under the License is distributed on an "AS IS" BASIS,
25+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26+ * See the License for the specific language governing permissions and
27+ * limitations under the License.
28+ */
29+
30+/* $Id: NativeTextHandler.java 627367 2008-02-13 12:03:30Z maxberger $ */
31+
32+package org.apache.fop.render.ps;
33+
34+import java.awt.Shape;
35+import java.awt.geom.AffineTransform;
36+import java.io.IOException;
37+
38+import org.apache.fop.fonts.Font;
39+import org.apache.fop.fonts.FontInfo;
40+import org.apache.fop.fonts.FontSetup;
41+import org.apache.fop.fonts.FontTriplet;
42+import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
43+import org.apache.xmlgraphics.java2d.ps.PSTextHandler;
44+import org.apache.xmlgraphics.ps.PSGenerator;
45+
46+/**
47+ * Specialized TextHandler implementation that the PSGraphics2D class delegates to to paint text
48+ * using PostScript text operations.
49+ */
50+public class NativeTextHandler implements PSTextHandler {
51+
52+ private PSGraphics2D g2d;
53+
54+ /** FontInfo containing all available fonts */
55+ protected FontInfo fontInfo;
56+
57+ /** Currently valid Font */
58+ protected Font font;
59+
60+ /** Overriding FontState */
61+ protected Font overrideFont = null;
62+
63+ /** the current (internal) font name */
64+ protected String currentFontName;
65+
66+ /** the current font size in millipoints */
67+ protected int currentFontSize;
68+
69+ /**
70+ * Main constructor.
71+ * @param g2d the PSGraphics2D instance this instances is used by
72+ * @param fontInfo the FontInfo object with all available fonts
73+ */
74+ public NativeTextHandler(PSGraphics2D g2d, FontInfo fontInfo) {
75+ this.g2d = g2d;
76+ if (fontInfo != null) {
77+ this.fontInfo = fontInfo;
78+ } else {
79+ setupFontInfo();
80+ }
81+ }
82+
83+ private void setupFontInfo() {
84+ //Sets up a FontInfo with default fonts
85+ fontInfo = new FontInfo();
86+ FontSetup.setup(fontInfo, null, null);
87+ }
88+
89+ /**
90+ * Return the font information associated with this object
91+ * @return the FontInfo object
92+ */
93+ public FontInfo getFontInfo() {
94+ return fontInfo;
95+ }
96+
97+ private PSGenerator getPSGenerator() {
98+ return this.g2d.getPSGenerator();
99+ }
100+
101+ /** {@inheritDoc} */
102+ public void writeSetup() throws IOException {
103+ if (fontInfo != null) {
104+ PSFontUtils.writeFontDict(getPSGenerator(), fontInfo);
105+ }
106+ }
107+
108+ /** {@inheritDoc} */
109+ public void writePageSetup() throws IOException {
110+ //nop
111+ }
112+
113+ /**
114+ * Draw a string to the PostScript document. The text is painted using
115+ * text operations.
116+ * {@inheritDoc}
117+ */
118+ public void drawString(String s, float x, float y) throws IOException {
119+ g2d.preparePainting();
120+ if (this.overrideFont == null) {
121+ java.awt.Font awtFont = g2d.getFont();
122+ this.font = createFont(awtFont);
123+ } else {
124+ this.font = this.overrideFont;
125+ this.overrideFont = null;
126+ }
127+
128+ //Color and Font state
129+ g2d.establishColor(g2d.getColor());
130+ establishCurrentFont();
131+
132+ PSGenerator gen = getPSGenerator();
133+ gen.saveGraphicsState();
134+
135+ //Clip
136+ Shape imclip = g2d.getClip();
137+ g2d.writeClip(imclip);
138+
139+ //Prepare correct transformation
140+ AffineTransform trans = g2d.getTransform();
141+ gen.concatMatrix(trans);
142+ gen.writeln(gen.formatDouble(x) + " "
143+ + gen.formatDouble(y) + " moveto ");
144+ gen.writeln("1 -1 scale");
145+
146+ StringBuffer sb = new StringBuffer("(");
147+ escapeText(s, sb);
148+ sb.append(") t ");
149+
150+ gen.writeln(sb.toString());
151+
152+ gen.restoreGraphicsState();
153+ }
154+
155+ private void escapeText(final String text, StringBuffer target) {
156+ final int l = text.length();
157+ for (int i = 0; i < l; i++) {
158+ final char ch = text.charAt(i);
159+ final char mch = this.font.mapChar(ch);
160+ PSGenerator.escapeChar(mch, target);
161+ }
162+ }
163+
164+ private Font createFont(java.awt.Font f) {
165+ String fontFamily = f.getFamily();
166+ if (fontFamily.equals("sanserif")) {
167+ fontFamily = "sans-serif";
168+ }
169+ int fontSize = 1000 * f.getSize();
170+ String style = f.isItalic() ? "italic" : "normal";
171+ int weight = f.isBold() ? Font.WEIGHT_BOLD : Font.WEIGHT_NORMAL;
172+
173+ FontTriplet triplet = fontInfo.findAdjustWeight(fontFamily, style, weight);
174+ if (triplet == null) {
175+ triplet = fontInfo.findAdjustWeight("sans-serif", style, weight);
176+ }
177+ return fontInfo.getFontInstance(triplet, fontSize);
178+ }
179+
180+ private void establishCurrentFont() throws IOException {
181+ if ((currentFontName != this.font.getFontName())
182+ || (currentFontSize != this.font.getFontSize())) {
183+ PSGenerator gen = getPSGenerator();
184+ gen.writeln(this.font.getFontName() + " "
185+ + gen.formatDouble(font.getFontSize() / 1000f) + " F");
186+ currentFontName = this.font.getFontName();
187+ currentFontSize = this.font.getFontSize();
188+ }
189+ }
190+
191+ /**
192+ * Sets the overriding font.
193+ * @param override Overriding Font to set
194+ */
195+ public void setOverrideFont(Font override) {
196+ this.overrideFont = override;
197+ }
198+
199+
200+}
201
202=== modified file '.pc/applied-patches'
203--- .pc/applied-patches 2010-04-12 09:53:37 +0000
204+++ .pc/applied-patches 2011-06-02 13:11:16 +0000
205@@ -1,3 +1,4 @@
206 01_from_svn_16_bit_alpha_png.patch
207 02_fix_segfault_with_anchors.patch
208 03_fix_tablecol.patch
209+04_xmlgraphics-1.4_compat.patch
210
211=== modified file 'debian/changelog'
212--- debian/changelog 2011-04-03 13:14:49 +0000
213+++ debian/changelog 2011-06-02 13:11:16 +0000
214@@ -1,3 +1,15 @@
215+fop (1:0.95.dfsg-11ubuntu2) oneiric; urgency=low
216+
217+ * MIR updates for Ubuntu (LP: #778216):
218+ - debian/control: Build-Depends on ant-optional and libservlet2.5-java
219+ - debian/control: fop - Suggests libservlet2.5-java
220+ - debian/rules: removed ant-trax.jar (not needed for ant >= 1.8.2) and
221+ upgraded to servlet-api-2.5
222+ - debian/patches/04_xmlgraphics-1.4_compat.patch: compat patch to
223+ support compilation/use against libxmlgraphics-commons-java >= 1.4.
224+
225+ -- James Page <james.page@canonical.com> Thu, 02 Jun 2011 10:55:35 +0100
226+
227 fop (1:0.95.dfsg-11ubuntu1) natty; urgency=low
228
229 * Build-depend on ant1.7-optional to fix FTBFS.
230
231=== modified file 'debian/control'
232--- debian/control 2011-04-03 13:14:49 +0000
233+++ debian/control 2011-06-02 13:11:16 +0000
234@@ -1,17 +1,18 @@
235 Source: fop
236 Section: text
237 Priority: optional
238-Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
239+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
240+XSBC-Original-Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
241 DM-Upload-Allowed: yes
242 Uploaders: Michael Koch <konqueror@gmx.de>, Sylvestre Ledru <sylvestre@debian.org>,
243 Vincent Fourmond <fourmond@debian.org>, Torsten Werner <twerner@debian.org>,
244 Mathieu Malaterre <mathieu.malaterre@gmail.com>
245 Build-Depends: debhelper (>= 5), cdbs (>= 0.4.27)
246-Build-Depends-Indep: ant1.7-optional, libbatik-java (>= 1.7),
247+Build-Depends-Indep: ant-optional, libbatik-java (>= 1.7),
248 libavalon-framework-java (>=4.1.2-2), libxalan2-java,
249 libxerces2-java, default-jdk, libcommons-io-java,
250 libcommons-logging-java, junit, libxmlgraphics-commons-java (>= 1.3),
251- libservlet2.4-java, libxml-commons-external-java, maven-repo-helper
252+ libservlet2.5-java, libxml-commons-external-java, maven-repo-helper
253 Standards-Version: 3.8.4
254 Homepage: http://xmlgraphics.apache.org/fop/
255 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/fop
256@@ -27,7 +28,7 @@
257 java-wrappers (>= 0.1.15), libxml-commons-external-java,
258 ${misc:Depends}
259 Recommends: libsaxon-java
260-Suggests: fop-doc, libservlet2.4-java
261+Suggests: fop-doc, libservlet2.5-java
262 Replaces: libfop-java
263 Description: XML to PDF Translator
264 FOP is a print formatter driven by XSL formatting objects.
265
266=== added file 'debian/patches/04_xmlgraphics-1.4_compat.patch'
267--- debian/patches/04_xmlgraphics-1.4_compat.patch 1970-01-01 00:00:00 +0000
268+++ debian/patches/04_xmlgraphics-1.4_compat.patch 2011-06-02 13:11:16 +0000
269@@ -0,0 +1,37 @@
270+Description: Compatibility patch to support use with xmlgraphics-commons
271+ >= 1.4. This can be dropped on upgrade to fop 1.0.
272+Author: James Page <james.page@canonical.com>
273+Forwarded: not-needed
274+
275+Index: fop/src/java/org/apache/fop/render/ps/NativeTextHandler.java
276+===================================================================
277+--- fop.orig/src/java/org/apache/fop/render/ps/NativeTextHandler.java 2011-06-02 11:32:47.259233851 +0100
278++++ fop/src/java/org/apache/fop/render/ps/NativeTextHandler.java 2011-06-02 11:34:50.779233886 +0100
279+@@ -19,6 +19,7 @@
280+
281+ package org.apache.fop.render.ps;
282+
283++import java.awt.Graphics2D;
284+ import java.awt.Shape;
285+ import java.awt.geom.AffineTransform;
286+ import java.io.IOException;
287+@@ -140,6 +141,12 @@
288+ gen.restoreGraphicsState();
289+ }
290+
291++ /** {@inheritDoc} */
292++ public void drawString(Graphics2D g, String s, float x, float y) throws IOException {
293++ // Just wrap call to existing method for the time being
294++ drawString(s,x,y);
295++ }
296++
297+ private void escapeText(final String text, StringBuffer target) {
298+ final int l = text.length();
299+ for (int i = 0; i < l; i++) {
300+@@ -183,6 +190,5 @@
301+ public void setOverrideFont(Font override) {
302+ this.overrideFont = override;
303+ }
304+-
305+
306+ }
307
308=== modified file 'debian/patches/series'
309--- debian/patches/series 2010-04-12 09:53:37 +0000
310+++ debian/patches/series 2011-06-02 13:11:16 +0000
311@@ -1,3 +1,4 @@
312 01_from_svn_16_bit_alpha_png.patch
313 02_fix_segfault_with_anchors.patch
314 03_fix_tablecol.patch
315+04_xmlgraphics-1.4_compat.patch
316
317=== modified file 'debian/rules'
318--- debian/rules 2010-03-06 21:02:37 +0000
319+++ debian/rules 2011-06-02 13:11:16 +0000
320@@ -6,7 +6,7 @@
321 include /usr/share/cdbs/1/class/ant.mk
322
323 JAVA_HOME := /usr/lib/jvm/java-6-openjdk
324-DEB_JARS := $(ANT_HOME)/lib/ant-trax.jar batik-all xml-apis-ext batik-libs xml-apis avalon-framework xercesImpl xmlParserAPIs xalan2 junit commons-io commons-logging xmlgraphics-commons servlet-api-2.4
325+DEB_JARS := batik-all xml-apis-ext batik-libs xml-apis avalon-framework xercesImpl xmlParserAPIs xalan2 junit commons-io commons-logging xmlgraphics-commons servlet-api-2.5
326 DEB_ANT_BUILD_TARGET := package javadocs #docs
327 DEB_ANT_CLEAN_TARGET := distclean
328 DEB_ANT_ARGS := -verbose
329
330=== modified file 'src/java/org/apache/fop/render/ps/NativeTextHandler.java'
331--- src/java/org/apache/fop/render/ps/NativeTextHandler.java 2008-12-11 21:09:32 +0000
332+++ src/java/org/apache/fop/render/ps/NativeTextHandler.java 2011-06-02 13:11:16 +0000
333@@ -19,6 +19,7 @@
334
335 package org.apache.fop.render.ps;
336
337+import java.awt.Graphics2D;
338 import java.awt.Shape;
339 import java.awt.geom.AffineTransform;
340 import java.io.IOException;
341@@ -140,6 +141,12 @@
342 gen.restoreGraphicsState();
343 }
344
345+ /** {@inheritDoc} */
346+ public void drawString(Graphics2D g, String s, float x, float y) throws IOException {
347+ // Just wrap call to existing method for the time being
348+ drawString(s,x,y);
349+ }
350+
351 private void escapeText(final String text, StringBuffer target) {
352 final int l = text.length();
353 for (int i = 0; i < l; i++) {
354@@ -183,6 +190,5 @@
355 public void setOverrideFont(Font override) {
356 this.overrideFont = override;
357 }
358-
359
360 }

Subscribers

People subscribed via source and target branches

to all changes: