File: 02_poppler06.dpatch

package info (click to toggle)
popplerkit.framework 0.0.20051227svn-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,396 kB
  • ctags: 120
  • sloc: objc: 2,303; sh: 914; cpp: 574; ansic: 55; makefile: 24
file content (198 lines) | stat: -rw-r--r-- 5,987 bytes parent folder | download | duplicates (2)
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
186
187
188
189
190
191
192
193
194
195
196
197
198
#! /bin/sh /usr/share/dpatch/dpatch-run
## 02_poppler06.dpatch by Yen-Ju Chen
##                     dpatch by Hubert Chathi <uhoreg@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Patche from Étoilé:
## DP: - Add support Poppler 0.6
Index: PopplerKit/bindings/poppler_page.cc
===================================================================
--- PopplerKit/bindings/poppler_page.cc	(revision 2341)
+++ PopplerKit/bindings/poppler_page.cc	(revision 2342)
@@ -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
-
 }
Index: PopplerKit/bindings/poppler.cc
===================================================================
--- PopplerKit/bindings/poppler.cc	(revision 2341)
+++ PopplerKit/bindings/poppler.cc	(revision 2342)
@@ -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
Index: PopplerKit/bindings/poppler_splash_renderer.cc
===================================================================
--- PopplerKit/bindings/poppler_splash_renderer.cc	(revision 2341)
+++ PopplerKit/bindings/poppler_splash_renderer.cc	(revision 2342)
@@ -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);
Index: PopplerKit/bindings/GNUmakefile
===================================================================
--- PopplerKit/bindings/GNUmakefile	(revision 2341)
+++ PopplerKit/bindings/GNUmakefile	(revision 2342)
@@ -55,4 +55,8 @@
    bindings_CFLAGS += -DPOPPLER_0_5
 endif
 
+ifeq ($(POPPLER_0_6), YES)
+   bindings_CFLAGS += -DPOPPLER_0_6
+endif
+
 include $(GNUSTEP_MAKEFILES)/subproject.make
Index: PopplerKit/bindings/poppler_text.cc
===================================================================
--- PopplerKit/bindings/poppler_text.cc	(revision 2341)
+++ PopplerKit/bindings/poppler_text.cc	(revision 2342)
@@ -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);
Index: PopplerKit/config.sh
===================================================================
--- PopplerKit/config.sh	(revision 2341)
+++ PopplerKit/config.sh	(revision 2342)
@@ -60,6 +60,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