summaryrefslogtreecommitdiff
path: root/libre/fop/fop-replace_sRGB_profile.patch
blob: 035a7e4b35b0cfbf7f3c20f060796cc301cc33cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--- fop-2.0.orig/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java	2015-05-26 03:03:48.000000000 -0500
+++ fop-2.0/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java	2015-12-21 16:38:02.149485578 -0500
@@ -21,6 +21,8 @@
 
 import java.awt.color.ColorSpace;
 import java.awt.color.ICC_Profile;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Set;
@@ -136,11 +138,14 @@
      * @return the ICC stream with the sRGB profile
      */
     public static PDFICCStream setupsRGBColorProfile(PDFDocument pdfDoc) {
-        ICC_Profile profile;
+        ICC_Profile profile = null;
         PDFICCStream sRGBProfile = pdfDoc.getFactory().makePDFICCStream();
-        InputStream in = PDFDocument.class.getResourceAsStream("sRGB Color Space Profile.icm");
-        if (in != null) {
+        // Load the sRGB profile installed by the openicc package
+        File file = new File("/usr/share/color/icc/OpenICC/sRGB.icc");
+        if (file.exists()) {
+            InputStream in = null;
             try {
+                in = new FileInputStream(file);
                 profile = ColorProfileUtil.getICC_Profile(in);
             } catch (IOException ioe) {
                 throw new RuntimeException(
@@ -148,7 +153,8 @@
             } finally {
                 IOUtils.closeQuietly(in);
             }
-        } else {
+        }
+        if (profile == null) {
             // Fallback: Use the sRGB profile from the JRE (about 140KB)
             profile = ColorProfileUtil.getICC_Profile(ColorSpace.CS_sRGB);
         }