Package: popplerkit.framework / 0.0.20051227svn-16

poppler06.patch Patch series | download
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
Description: Add support Poppler 0.6.
Author: Yen-Ju Chen
Forwarded: not-needed
Last-Update: 2012-05-31
---

--- popplerkit.orig/bindings/poppler_page.cc
+++ popplerkit/bindings/poppler_page.cc
@@ -33,7 +33,8 @@
       return NULL;
    }
    
-   if ((pageIndex <= 0) || (pageIndex > PDF_DOC(poppler_document)->getNumPages()))
+   if ((pageIndex <= 0) || 
+       ((int)pageIndex > PDF_DOC(poppler_document)->getNumPages()))
    {
       return NULL;
    }
@@ -69,8 +70,7 @@
 
 #ifdef POPPLER_0_4
    return PAGE(poppler_page)->getWidth();
-#endif
-#ifdef POPPLER_0_5
+#else
    return PAGE(poppler_page)->getMediaWidth();
 #endif
 
@@ -85,9 +85,7 @@
    
 #ifdef POPPLER_0_4
    return PAGE(poppler_page)->getHeight();
-#endif
-#ifdef POPPLER_0_5
+#else
    return PAGE(poppler_page)->getMediaHeight();
 #endif
-
 }
--- popplerkit.orig/bindings/poppler.cc
+++ popplerkit/bindings/poppler.cc
@@ -110,7 +110,7 @@
       }
       
       // tell fontconfig about application fonts
-      for (int i = 0; i < nappFonts; i++)
+      for (unsigned int i = 0; i < nappFonts; i++)
       {
          if (FcConfigAppFontAddFile(FcConfigGetCurrent(), appFonts[i]))
          {
@@ -118,12 +118,16 @@
          }
          else
          {
-            fprintf(stderr, "failed to register application font %s\n");
+            fprintf(stderr, "failed to register application font %s\n", appFonts[i]);
          }
          fflush(stderr);
       }
 
+#ifdef POPPLER_0_6
+      globalParams = new GlobalParams();
+#else
       globalParams = new GlobalParams(NULL);
+#endif
 #ifdef POPPLER_0_4
       globalParams->setupBaseFontsFc(NULL);
 #endif
--- popplerkit.orig/bindings/poppler_splash_renderer.cc
+++ popplerkit/bindings/poppler_splash_renderer.cc
@@ -38,8 +38,7 @@
 #ifdef POPPLER_0_4
       white.rgb8 = splashMakeRGB8(bg_red, bg_green, bg_blue);
       void* splashDevice = new SplashOutputDev(splashModeRGB8, gFalse, white);
-#endif
-#ifdef POPPLER_0_5
+#else // 0.5, 0.6
       white[0] = bg_red;
       white[1] = bg_green;
       white[2] = bg_blue;
@@ -86,13 +85,17 @@
    SYNCHRONIZED(PAGE(poppler_page)->displaySlice(SPLASH_DEV(output_dev),
                                                  (double)hDPI, (double)vDPI,
                                                  rotate,
-#ifdef POPPLER_0_5
+#ifndef POPPLER_0_4 // 0.5, 0.6
 						 gTrue, // useMediaBox
 #endif
                                                  gTrue, // Crop
                                                  (int)sliceX, (int)sliceY,
                                                  (int)sliceW, (int)sliceH,
+#ifdef POPPLER_0_6
+												 gFalse, // printing
+#else
                                                  NULL, // Links
+#endif
                                                  PDF_DOC(poppler_document)->getCatalog()));
 
    return 1;
@@ -123,16 +126,14 @@
 
 #ifdef POPPLER_0_4
    SplashRGB8*     rgb8;
-#endif
-#ifdef POPPLER_0_5
+#else // 0.5, 0.6
    SplashColorPtr  color;
 #endif
    unsigned char*  dataPtr;
 
 #ifdef POPPLER_0_4
    rgb8 = SPLASH_BITMAP(bitmap)->getDataPtr().rgb8;
-#endif
-#ifdef POPPLER_0_5
+#else // 0.5, 0.6
    color = SPLASH_BITMAP(bitmap)->getDataPtr();
 #endif
 
@@ -146,8 +147,7 @@
          *dataPtr++ = splashRGB8G(*rgb8);
          *dataPtr++ = splashRGB8B(*rgb8);
          ++rgb8;
-#endif
-#ifdef POPPLER_0_5
+#else // 0.5, 0.6
 	 *dataPtr++ = splashRGB8R(color);
 	 *dataPtr++ = splashRGB8G(color);
 	 *dataPtr++ = splashRGB8B(color);
--- popplerkit.orig/bindings/GNUmakefile
+++ popplerkit/bindings/GNUmakefile
@@ -52,4 +52,8 @@
    bindings_CFLAGS += -DPOPPLER_0_5
 endif
 
+ifeq ($(POPPLER_0_6), YES)
+   bindings_CFLAGS += -DPOPPLER_0_6
+endif
+
 include $(GNUSTEP_MAKEFILES)/subproject.make
--- popplerkit.orig/bindings/poppler_text.cc
+++ popplerkit/bindings/poppler_text.cc
@@ -51,10 +51,16 @@
 
    SYNCHRONIZED(PAGE(poppler_page)->display(TEXT_DEV(text_device), 
 			   hDPI, vDPI, rotate, 
-#ifdef POPPLER_0_5
+#ifndef POPPLER_0_4
 			   gTrue, // useMediaBox
 #endif
-			   crop, NULL, PDF_DOC(poppler_document)->getCatalog()));
+			   crop, 
+#ifdef POPPLER_0_6
+				gFalse, // printing
+#else
+				NULL, // links
+#endif
+				PDF_DOC(poppler_document)->getCatalog()));
    return 1;
 }
 
@@ -70,7 +76,7 @@
       int result = TEXT_DEV(text_device)->findText(text_utf32, text_len,
                                                    start_at_top, stop_at_bottom,
                                                    start_at_last, stop_at_last,
-#ifdef POPPLER_0_5
+#ifndef POPPLER_0_4 // 0.5, 0.6
 						   gTrue, gFalse,
 #endif
                                                    x_min, y_min, x_max, y_max);
--- popplerkit.orig/config.sh
+++ popplerkit/config.sh
@@ -59,6 +59,13 @@
   POPPLER_VERSION="POPPLER_0_5"
 fi
 
+${PKG_CONFIG} --atleast-version=0.5.9 poppler
+if [ $? -eq 0 ]; then
+  POPPLER_VERSION="POPPLER_0_6"
+fi
+
+echo $POPPLER_VERSION
+
 # include freetype, just to be sure
 ${PKG_CONFIG} --exists freetype2
 if [ $? -eq 0 ]; then