made convertPath public in SplashOutputDev
[swftools.git] / lib / pdf / xpdf-changes.patch
1 Index: Gfx.cc
2 ===================================================================
3 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/Gfx.cc,v
4 retrieving revision 1.9
5 retrieving revision 1.10
6 diff -u -r1.9 -r1.10
7 --- Gfx.cc      3 Dec 2005 10:11:33 -0000       1.9
8 +++ Gfx.cc      3 Dec 2005 10:30:41 -0000       1.10
9 @@ -439,7 +439,11 @@
10    fontChanged = gFalse;
11    clip = clipNone;
12    ignoreUndef = 0;
13 -  out->startPage(pageNum, state);
14 +  if(cropBox) {
15 +      out->startPage(pageNum, state, cropBox->x1,cropBox->y1,cropBox->x2,cropBox->y2);
16 +  } else {
17 +      out->startPage(pageNum, state, 0,0,0,0);
18 +  }
19    out->setDefaultCTM(state->getCTM());
20    out->updateAll(state);
21    for (i = 0; i < 6; ++i) {
22 @@ -450,7 +450,8 @@
23    abortCheckCbkData = abortCheckCbkDataA;
24  
25    // set crop box
26 -  if (cropBox) {
27 +#ifdef XPDFEXE
28 +  if (cropBox) {
29      state->moveTo(cropBox->x1, cropBox->y1);
30      state->lineTo(cropBox->x2, cropBox->y1);
31      state->lineTo(cropBox->x2, cropBox->y2);
32 @@ -459,7 +460,8 @@
33      state->clip();
34      out->clip(state);
35      state->clearPath();
36 -  }
37 +  }
38 +#endif
39  }
40  
41  Gfx::Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict,
42 Index: GfxFont.h
43 ===================================================================
44 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/GfxFont.h,v
45 retrieving revision 1.6
46 retrieving revision 1.7
47 diff -u -r1.6 -r1.7
48 --- GfxFont.h   3 Dec 2005 10:11:33 -0000       1.6
49 +++ GfxFont.h   3 Dec 2005 10:30:41 -0000       1.7
50 @@ -207,7 +207,7 @@
51    CharCodeToUnicode *getToUnicode();
52  
53    // Return the character name associated with <code>.
54 -  char *getCharName(int code) { return enc[code]; }
55 +  char *getCharName(int code) { return code>=256?0:enc[code]; }
56  
57    // Returns true if the PDF font specified an encoding.
58    GBool getHasEncoding() { return hasEncoding; }
59 Index: GfxState.cc
60 ===================================================================
61 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/GfxState.cc,v
62 retrieving revision 1.10
63 retrieving revision 1.12
64 diff -u -r1.10 -r1.12
65 --- GfxState.cc 3 Dec 2005 10:11:33 -0000       1.10
66 +++ GfxState.cc 3 Dec 2005 12:41:32 -0000       1.12
67 @@ -21,6 +21,7 @@
68  #include "Array.h"
69  #include "Page.h"
70  #include "GfxState.h"
71 +#include "cmyk.h"
72  
73  //------------------------------------------------------------------------
74  
75 @@ -468,6 +469,18 @@
76                                 - 0.11 * color->c[2] + 0.5));
77  }
78  
79 +/*void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
80 +    unsigned char r,g,b;
81 +    float c = color->c[0];
82 +    float m = color->c[1];
83 +    float y = color->c[2];
84 +    float k = color->c[3];
85 +    convert_cmyk2rgb(c,m,y,k, &r,&g,&b);
86 +    rgb->r = r/255.0;
87 +    rgb->g = g/255.0;
88 +    rgb->b = b/255.0;
89 +}*/
90 +
91  void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
92    double c, m, y, k, c1, m1, y1, k1, r, g, b, x;
93  
94 @@ -3099,6 +3112,7 @@
95    GfxIndexedColorSpace *indexedCS;
96    GfxSeparationColorSpace *sepCS;
97    int maxPixel, indexHigh;
98 +  int maxPixelForAlloc;
99    Guchar *lookup2;
100    Function *sepFunc;
101    Object obj;
102 @@ -3111,6 +3125,7 @@
103    // bits per component and color space
104    bits = bitsA;
105    maxPixel = (1 << bits) - 1;
106 +  maxPixelForAlloc = (1 << (bits>8?bits:8));
107    colorSpace = colorSpaceA;
108  
109    // get decode map
110 @@ -3163,7 +3178,7 @@
111      lookup2 = indexedCS->getLookup();
112      colorSpace2->getDefaultRanges(x, y, indexHigh);
113      for (k = 0; k < nComps2; ++k) {
114 -      lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
115 +      lookup[k] = (GfxColorComp *)gmallocn(maxPixelForAlloc + 1,
116                                            sizeof(GfxColorComp));
117        for (i = 0; i <= maxPixel; ++i) {
118         j = (int)(decodeLow[0] + (i * decodeRange[0]) / maxPixel + 0.5);
119 @@ -3182,7 +3197,7 @@
120      nComps2 = colorSpace2->getNComps();
121      sepFunc = sepCS->getFunc();
122      for (k = 0; k < nComps2; ++k) {
123 -      lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
124 +      lookup[k] = (GfxColorComp *)gmallocn(maxPixelForAlloc + 1,
125                                            sizeof(GfxColorComp));
126        for (i = 0; i <= maxPixel; ++i) {
127         x[0] = decodeLow[0] + (i * decodeRange[0]) / maxPixel;
128 @@ -3192,7 +3207,7 @@
129      }
130    } else {
131      for (k = 0; k < nComps; ++k) {
132 -      lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
133 +      lookup[k] = (GfxColorComp *)gmallocn(maxPixelForAlloc + 1,
134                                            sizeof(GfxColorComp));
135        for (i = 0; i <= maxPixel; ++i) {
136         lookup[k][i] = dblToCol(decodeLow[k] +
137 Index: GlobalParams.cc
138 ===================================================================
139 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/GlobalParams.cc,v
140 retrieving revision 1.4
141 retrieving revision 1.7
142 diff -u -r1.4 -r1.7
143 --- GlobalParams.cc     3 Dec 2005 10:11:33 -0000       1.4
144 +++ GlobalParams.cc     18 Dec 2005 08:31:22 -0000      1.7
145 @@ -498,6 +498,29 @@
146    char buf[512];
147    FILE *f2;
148  
149 +  /* extract path */
150 +  if(fileName) {
151 +    char* cfgFileName = fileName->getCString();
152 +    char* pos1 = strrchr(cfgFileName, '/');
153 +    char* pos2 = strrchr(cfgFileName, '\\');
154 +    char* p = pos1>pos2?pos1:pos2;
155 +    int pos = p ? p-cfgFileName : -1;
156 +    GString*path = new GString(new GString(cfgFileName), 0, (pos < 0 ? strlen(cfgFileName): pos));
157 +    if(pos1>=0)
158 +       path->append('/');
159 +    else if(pos2>=0)
160 +       path->append('\\');
161 +    else
162 +#ifdef WIN32
163 +       path->append('\\');
164 +#else
165 +       path->append('/');
166 +#endif
167 +    this->path = path;
168 +  } else {
169 +    this->path = new GString();
170 +  }
171 +  
172    line = 1;
173    while (getLine(buf, sizeof(buf) - 1, f)) {
174  
175 @@ -659,6 +682,32 @@
176    }
177  }
178  
179 +static GString* qualify_filename(GString*path, GString*filename)
180 +{
181 +  GString*fullpath = 0;
182 +  char*prefix = "/usr/local/share/xpdf/";
183 +
184 +  if (filename->getChar(0) != '\\' && filename->getChar(0) != '/') {
185 +    /* relative path */
186 +    fullpath = path->copy();
187 +    fullpath->append(filename);
188 +  } else if (!strncmp(filename->getCString(), prefix, strlen(prefix))) {
189 +    /* xpdf default path */
190 +    char*s = strchr(filename->getCString()+strlen(prefix), '/');
191 +    if(s) {
192 +       fullpath = path->copy();
193 +       fullpath->append(s+1);
194 +    } else {
195 +       fullpath = filename->copy();
196 +    }
197 +  } else {
198 +    /* absolute path */
199 +    fullpath = filename->copy();
200 +  }
201 +  //printf("%s -%s-> %s\n", filename->getCString(), path->getCString(), fullpath->getCString());
202 +  return fullpath;
203 +}
204 +
205  void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName,
206                                          int line) {
207    GString *name;
208 @@ -673,7 +722,7 @@
209           fileName->getCString(), line);
210      return;
211    }
212 -  name = (GString *)tokens->get(1);
213 +  name = qualify_filename(this->path, (GString *)tokens->get(1));
214    if (!(f = fopen(name->getCString(), "r"))) {
215      error(-1, "Couldn't open 'nameToUnicode' file '%s'",
216           name->getCString());
217 @@ -705,10 +754,12 @@
218    }
219    collection = (GString *)tokens->get(1);
220    name = (GString *)tokens->get(2);
221 +
222    if ((old = (GString *)cidToUnicodes->remove(collection))) {
223      delete old;
224    }
225 -  cidToUnicodes->add(collection->copy(), name->copy());
226 +
227 +  cidToUnicodes->add(collection->copy(), qualify_filename(this->path, name));
228  }
229  
230  void GlobalParams::parseUnicodeToUnicode(GList *tokens, GString *fileName,
231 @@ -725,7 +776,8 @@
232    if ((old = (GString *)unicodeToUnicodes->remove(font))) {
233      delete old;
234    }
235 -  unicodeToUnicodes->add(font->copy(), file->copy());
236 +
237 +  unicodeToUnicodes->add(font->copy(), qualify_filename(this->path, file));
238  }
239  
240  void GlobalParams::parseUnicodeMap(GList *tokens, GString *fileName,
241 @@ -742,7 +794,8 @@
242    if ((old = (GString *)unicodeMaps->remove(encodingName))) {
243      delete old;
244    }
245 -  unicodeMaps->add(encodingName->copy(), name->copy());
246 +
247 +  unicodeMaps->add(encodingName->copy(), qualify_filename(this->path, name));
248  }
249  
250  void GlobalParams::parseCMapDir(GList *tokens, GString *fileName, int line) {
251 @@ -760,23 +813,30 @@
252      list = new GList();
253      cMapDirs->add(collection->copy(), list);
254    }
255 -  list->append(dir->copy());
256 +
257 +  list->append(qualify_filename(this->path, dir));
258  }
259  
260  void GlobalParams::parseToUnicodeDir(GList *tokens, GString *fileName,
261                                      int line) {
262 +  GString *dir;
263 +
264    if (tokens->getLength() != 2) {
265      error(-1, "Bad 'toUnicodeDir' config file command (%s:%d)",
266           fileName->getCString(), line);
267      return;
268    }
269 -  toUnicodeDirs->append(((GString *)tokens->get(1))->copy());
270 +
271 +  dir = (GString *)tokens->get(1);
272 +
273 +  toUnicodeDirs->append(qualify_filename(this->path, dir));
274  }
275  
276  void GlobalParams::parseDisplayFont(GList *tokens, GHash *fontHash,
277                                     DisplayFontParamKind kind,
278                                     GString *fileName, int line) {
279    DisplayFontParam *param, *old;
280 +  GString *file;
281  
282    if (tokens->getLength() < 2) {
283      goto err1;
284 @@ -788,13 +848,15 @@
285      if (tokens->getLength() != 3) {
286        goto err2;
287      }
288 -    param->t1.fileName = ((GString *)tokens->get(2))->copy();
289 +    file = (GString *)tokens->get(2);
290 +    param->t1.fileName = qualify_filename(this->path, file);
291      break;
292    case displayFontTT:
293      if (tokens->getLength() != 3) {
294        goto err2;
295      }
296 -    param->tt.fileName = ((GString *)tokens->get(2))->copy();
297 +    file = (GString *)tokens->get(2);
298 +    param->tt.fileName = qualify_filename(this->path, file);
299      break;
300    }
301  
302 Index: Lexer.cc
303 ===================================================================
304 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/Lexer.cc,v
305 retrieving revision 1.4
306 retrieving revision 1.5
307 diff -u -r1.4 -r1.5
308 --- Lexer.cc    3 Dec 2005 10:11:33 -0000       1.4
309 +++ Lexer.cc    14 Mar 2006 12:43:23 -0000      1.5
310 @@ -74,6 +74,7 @@
311      curStr.streamReset();
312    }
313  }
314 +static int illegalChars = 0;
315  
316  Lexer::~Lexer() {
317    if (!curStr.isNone()) {
318 @@ -83,6 +84,9 @@
319    if (freeArray) {
320      delete streams;
321    }
322 +  if(illegalChars)
323 +      error(0, "Illegal characters in hex string (%d)", illegalChars);
324 +  illegalChars = 0;
325  }
326  
327  int Lexer::getChar() {
328 @@ -330,7 +334,8 @@
329         } else if (c2 >= 'a' && c2 <= 'f') {
330           c += c2 - 'a' + 10;
331         } else {
332 -         error(getPos(), "Illegal digit in hex char in name");
333 +         illegalChars++;
334 +         //error(getPos(), "Illegal digit in hex char in name");
335         }
336        }
337       notEscChar:
338 @@ -384,8 +389,10 @@
339             c2 += c - 'A' + 10;
340           else if (c >= 'a' && c <= 'f')
341             c2 += c - 'a' + 10;
342 -         else
343 -           error(getPos(), "Illegal character <%02x> in hex string", c);
344 +         else {
345 +           illegalChars++;
346 +           //error(getPos(), "Illegal character <%02x> in hex string", c);
347 +         }
348           if (++m == 2) {
349             if (n == tokBufSize) {
350               if (!s)
351 @@ -421,7 +428,8 @@
352        tokBuf[2] = '\0';
353        obj->initCmd(tokBuf);
354      } else {
355 -      error(getPos(), "Illegal character '>'");
356 +      illegalChars++;
357 +      //error(getPos(), "Illegal character '>'");
358        obj->initError();
359      }
360      break;
361 @@ -430,7 +438,8 @@
362    case ')':
363    case '{':
364    case '}':
365 -    error(getPos(), "Illegal character '%c'", c);
366 +    //error(getPos(), "Illegal character '%c'", c);
367 +    illegalChars++;
368      obj->initError();
369      break;
370  
371 @@ -459,7 +468,6 @@
372      }
373      break;
374    }
375 -
376    return obj;
377  }
378  
379 Index: Link.cc
380 ===================================================================
381 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/Link.cc,v
382 retrieving revision 1.5
383 retrieving revision 1.6
384 diff -u -r1.5 -r1.6
385 --- Link.cc     3 Dec 2005 10:11:33 -0000       1.5
386 +++ Link.cc     26 Mar 2006 08:26:59 -0000      1.6
387 @@ -430,10 +430,9 @@
388        delete dest;
389        dest = NULL;
390      }
391 -
392    // error
393    } else {
394 -    error(-1, "Illegal annotation destination");
395 +    error(-1, "Illegal annotation destination %d", destObj->getType());
396    }
397  }
398  
399 @@ -468,10 +467,9 @@
400        delete dest;
401        dest = NULL;
402      }
403 -
404    // error
405    } else {
406 -    error(-1, "Illegal annotation destination");
407 +    error(-1, "Illegal annotation destination %d", destObj->getType());
408    }
409  }
410  
411 Index: OutputDev.h
412 ===================================================================
413 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/OutputDev.h,v
414 retrieving revision 1.7
415 retrieving revision 1.9
416 diff -u -r1.7 -r1.9
417 --- OutputDev.h 3 Dec 2005 10:11:33 -0000       1.7
418 +++ OutputDev.h 3 Dec 2005 10:31:47 -0000       1.9
419 @@ -74,7 +74,7 @@
420    virtual void setDefaultCTM(double *ctm);
421  
422    // Start a page.
423 -  virtual void startPage(int pageNum, GfxState *state) {}
424 +  virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {}
425  
426    // End a page.
427    virtual void endPage() {}
428 Index: Stream.cc
429 ===================================================================
430 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/Stream.cc,v
431 retrieving revision 1.7
432 retrieving revision 1.8
433 diff -u -r1.7 -r1.8
434 --- Stream.cc   3 Dec 2005 10:11:33 -0000       1.7
435 +++ Stream.cc   3 Dec 2005 10:30:41 -0000       1.8
436 @@ -17,6 +17,8 @@
437  #include <stddef.h>
438  #ifndef WIN32
439  #include <unistd.h>
440 +#else
441 +extern "C" int unlink(char *filename);
442  #endif
443  #include <string.h>
444  #include <ctype.h>
445 Index: config.h
446 --- config.h    2007-09-09 12:11:20.000000000 +0200
447 +++ config.h    2007-09-09 12:11:40.000000000 +0200
448 @@ -53,9 +53,9 @@
449  
450  // user config file name, relative to the user's home directory
451  #if defined(VMS) || defined(WIN32)
452 -#define xpdfUserConfigFile "xpdfrc"
453 +#define xpdfUserConfigFile "pdf2swf.conf"
454  #else
455 -#define xpdfUserConfigFile ".xpdfrc"
456 +#define xpdfUserConfigFile ".pdf2swf.conf"
457  #endif
458  
459  // system config file name (set via the configure script)
460 @@ -64,7 +64,7 @@
461  #else
462  // under Windows, we get the directory with the executable and then
463  // append this file name
464 -#define xpdfSysConfigFile "xpdfrc"
465 +#define xpdfSysConfigFile "pdf2swf.conf"
466  #endif
467  
468  //------------------------------------------------------------------------
469 Index: gfile.cc
470 ===================================================================
471 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/gfile.cc,v
472 retrieving revision 1.12
473 retrieving revision 1.13
474 diff -u -r1.12 -r1.13
475 --- gfile.cc    3 Dec 2005 10:11:33 -0000       1.12
476 +++ gfile.cc    3 Dec 2005 10:30:41 -0000       1.13
477 @@ -437,6 +437,52 @@
478  #endif
479  }
480  
481 +static char* getTempDir()
482 +{
483 +#ifdef WIN32
484 +    char*dir = getenv("TMP");
485 +    if(!dir) dir = getenv("TEMP");
486 +    if(!dir) dir = getenv("tmp");
487 +    if(!dir) dir = getenv("temp");
488 +    if(!dir) dir = "C:\\";
489 +#else
490 +    char* dir = "/tmp/";
491 +#endif
492 +    return dir;
493 +}
494 +
495 +char* mktmpname(char*ptr) {
496 +    static char tmpbuf[128];
497 +    char*dir = getTempDir();
498 +    int l = strlen(dir);
499 +    char*sep = "";
500 +    if(!ptr)
501 +       ptr = tmpbuf;
502 +    if(l && dir[l-1]!='/' && dir[l-1]!='\\') {
503 +#ifdef WIN32
504 +       sep = "\\";
505 +#else
506 +       sep = "/";
507 +#endif
508 +    }
509 +
510 + //   used to be mktemp. This does remove the warnings, but
511 + //   It's not exactly an improvement.
512 +#ifdef HAVE_LRAND48
513 +    sprintf(ptr, "%s%s%08x%08x",dir,sep,lrand48(),lrand48());
514 +#else
515 +#   ifdef HAVE_RAND
516 +       sprintf(ptr, "%s%s%08x%08x",dir,sep,rand(),rand());
517 +#   else
518 +       static int count = 1;
519 +       sprintf(ptr, "%s%s%08x%04x%04x",dir,sep,time(0),(unsigned int)tmpbuf^((unsigned int)tmpbuf)>>16,count);
520 +       count ++;
521 +#   endif
522 +#endif
523 +     return ptr;
524 +}
525 +
526 +
527  GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
528  #if defined(WIN32)
529    //---------- Win32 ----------
530 @@ -463,7 +509,7 @@
531    // with this file name after the tmpnam call and before the fopen
532    // call.  I will happily accept fixes to this function for non-Unix
533    // OSs.
534 -  if (!(s = tmpnam(NULL))) {
535 +  if (!(s = mktmpname(NULL))) {
536      return gFalse;
537    }
538    *name = new GString(s);
539 @@ -490,7 +536,7 @@
540      (*name)->append("/XXXXXX")->append(ext);
541      fd = mkstemps((*name)->getCString(), strlen(ext));
542  #else
543 -    if (!(s = tmpnam(NULL))) {
544 +    if (!(s = mktmpname(NULL))) {
545        return gFalse;
546      }
547      *name = new GString(s);
548 @@ -507,7 +553,7 @@
549      (*name)->append("/XXXXXX");
550      fd = mkstemp((*name)->getCString());
551  #else // HAVE_MKSTEMP
552 -    if (!(s = tmpnam(NULL))) {
553 +    if (!(s = mktmpname(NULL))) {
554        return gFalse;
555      }
556      *name = new GString(s);
557 Index: gfile.h
558 ===================================================================
559 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/gfile.h,v
560 retrieving revision 1.9
561 retrieving revision 1.10
562 diff -u -r1.9 -r1.10
563 --- gfile.h     3 Dec 2005 10:11:33 -0000       1.9
564 +++ gfile.h     3 Dec 2005 10:30:41 -0000       1.10
565 @@ -58,6 +58,9 @@
566  // Get current directory.
567  extern GString *getCurrentDir();
568  
569 +/* create a temporary filename */
570 +char* mktmpname(char*ptr);
571 +
572  // Append a file name to a path string.  <path> may be an empty
573  // string, denoting the current directory).  Returns <path>.
574  extern GString *appendToPath(GString *path, char *fileName);
575 Index: GlobalParams.h
576 ===================================================================
577 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/GlobalParams.h,v
578 retrieving revision 1.5
579 retrieving revision 1.6
580 diff -u -r1.5 -r1.6
581 --- GlobalParams.h      2006-10-10 19:54:29.000000000 +0200
582 +++ GlobalParams.h      2006-11-12 11:19:40.000000000 +0100
583 @@ -213,8 +213,8 @@
584    FILE *getUnicodeMapFile(GString *encodingName);
585    FILE *findCMapFile(GString *collection, GString *cMapName);
586    FILE *findToUnicodeFile(GString *name);
587 -  DisplayFontParam *getDisplayFont(GString *fontName);
588 -  DisplayFontParam *getDisplayCIDFont(GString *fontName, GString *collection);
589 +  virtual DisplayFontParam *getDisplayFont(GString *fontName);
590 +  virtual DisplayFontParam *getDisplayCIDFont(GString *fontName, GString *collection);
591    GString *getPSFile();
592    int getPSPaperWidth();
593    int getPSPaperHeight();
594 @@ -218,1 +218,1 @@
595 -  void parseFile(GString *fileName, FILE *f);
596 +public: void parseFile(GString *fileName, FILE *f); private:
597 @@ -246,6 +246,10 @@
598    GBool loadPlugin(char *type, char *name);
599  #endif
600  
601 +  //----- config file base path
602 +
603 +  GString*path;
604 +
605    //----- static tables
606  
607    NameToCharCode *             // mapping from char name to
608 --- SplashOutputDev.h   2006-11-12 12:07:22.000000000 +0100
609 +++ SplashOutputDev.h   2006-11-12 12:08:48.000000000 +0100
610 @@ -70,7 +70,7 @@
611    //----- initialization and control
612  
613    // Start a page.
614 -  virtual void startPage(int pageNum, GfxState *state);
615 +  virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
616  
617    // End a page.
618    virtual void endPage();
619 --- SplashOutputDev.cc  2006-11-12 12:07:06.000000000 +0100
620 +++ SplashOutputDev.cc  2006-11-12 12:09:36.000000000 +0100
621 @@ -696,7 +696,7 @@
622    nT3Fonts = 0;
623  }
624  
625 -void SplashOutputDev::startPage(int pageNum, GfxState *state) {
626 +void SplashOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {
627    int w, h;
628    double *ctm;
629    SplashCoord mat[6];
630 --- TextOutputDev.h     2006-11-12 12:23:01.000000000 +0100
631 +++ TextOutputDev.h     2006-11-12 12:25:31.000000000 +0100
632 @@ -578,7 +578,7 @@
633    //----- initialization and control
634  
635    // Start a page.
636 -  virtual void startPage(int pageNum, GfxState *state);
637 +  virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
638  
639    // End a page.
640    virtual void endPage();
641 --- TextOutputDev.cc    2006-11-12 12:22:53.000000000 +0100
642 +++ TextOutputDev.cc    2006-11-12 12:25:03.000000000 +0100
643 @@ -3805,7 +3805,7 @@
644    }
645  }
646  
647 -void TextOutputDev::startPage(int pageNum, GfxState *state) {
648 +void TextOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {
649    text->startPage(state);
650  }
651  
652 --- CoreOutputDev.cc    2006-11-12 12:21:59.000000000 +0100
653 +++ CoreOutputDev.cc    2006-11-12 12:23:29.000000000 +0100
654 @@ -57,5 +57,5 @@
655  
656  void CoreOutputDev::clear() {
657    startDoc(NULL);
658 -  startPage(0, NULL);
659 +  startPage(0, NULL, 0,0,0,0);
660  }
661 --- SplashFTFontEngine.cc       2006-11-19 22:30:44.000000000 +0100
662 +++ SplashFTFontEngine.cc       2006-11-19 22:30:56.000000000 +0100
663 @@ -13,9 +13,7 @@
664  #endif
665  
666  #include <stdio.h>
667 -#ifndef WIN32
668  #  include <unistd.h>
669 -#endif
670  #include "gmem.h"
671  #include "GString.h"
672  #include "gfile.h"
673 --- SplashOutputDev.cc  2007-09-09 12:29:45.000000000 +0200
674 +++ SplashOutputDev.cc  2007-09-09 12:30:02.000000000 +0200
675 @@ -13,6 +13,7 @@
676  #endif
677  
678  #include <string.h>
679 +#include <unistd.h>
680  #include <math.h>
681  #include "gfile.h"
682  #include "GlobalParams.h"
683 --- SplashFontFile.cc   2007-09-09 12:33:00.000000000 +0200
684 +++ SplashFontFile.cc   2007-09-09 12:33:07.000000000 +0200
685 @@ -11,9 +11,7 @@
686  #endif
687  
688  #include <stdio.h>
689 -#ifndef WIN32
690 -#  include <unistd.h>
691 -#endif
692 +#include <unistd.h>
693  #include "GString.h"
694  #include "SplashFontFile.h"
695  #include "SplashFontFileID.h"
696 --- SplashFont.h        2007-09-09 14:23:47.000000000 +0200
697 +++ SplashFont.h        2007-09-09 14:24:28.000000000 +0200
698 @@ -73,6 +73,9 @@
699    virtual GBool makeGlyph(int c, int xFrac, int yFrac,
700                           SplashGlyphBitmap *bitmap) = 0;
701  
702 +  // return the number of characters in this font
703 +  virtual int getNumChars() = 0;
704 +
705    // Return the path for a glyph.
706    virtual SplashPath *getGlyphPath(int c) = 0;
707  
708 --- SplashFTFont.h      2007-09-09 14:23:47.000000000 +0200
709 +++ SplashFTFont.h      2007-09-09 14:25:19.000000000 +0200
710 @@ -42,6 +42,9 @@
711    virtual GBool makeGlyph(int c, int xFrac, int yFrac,
712                           SplashGlyphBitmap *bitmap);
713  
714 +  // return the number of characters in this font
715 +  virtual int getNumChars();
716 +
717    // Return the path for a glyph.
718    virtual SplashPath *getGlyphPath(int c);
719  
720 --- SplashFTFont.cc.h   2007-09-09 14:23:50.000000000 +0200
721 +++ SplashFTFont.cc     2007-09-09 14:27:35.000000000 +0200
722 @@ -228,6 +228,12 @@
723    GBool needClose;
724  };
725  
726 +int SplashFTFont::getNumChars()
727 +{
728 +  SplashFTFontFile* ff = (SplashFTFontFile *)fontFile;
729 +  return ff->face->num_glyphs;
730 +}
731 +
732  SplashPath *SplashFTFont::getGlyphPath(int c) {
733    static FT_Outline_Funcs outlineFuncs = {
734  #if FREETYPE_MINOR <= 1
735 --- orig/GfxFont.h      2007-07-28 00:11:06.000000000 +0200
736 +++ GfxFont.h   2007-09-09 18:31:31.000000000 +0200
737 @@ -164,6 +164,7 @@
738    virtual int getNextChar(char *s, int len, CharCode *code,
739                           Unicode *u, int uSize, int *uLen,
740                           double *dx, double *dy, double *ox, double *oy) = 0;
741 +  virtual CharCodeToUnicode* getCTU() = 0;
742  
743  protected:
744  
745 @@ -204,6 +205,7 @@
746    virtual int getNextChar(char *s, int len, CharCode *code,
747                           Unicode *u, int uSize, int *uLen,
748                           double *dx, double *dy, double *ox, double *oy);
749 +  virtual CharCodeToUnicode* getCTU();
750  
751    // Return the encoding.
752    char **getEncoding() { return enc; }
753 @@ -266,6 +268,7 @@
754    virtual int getNextChar(char *s, int len, CharCode *code,
755                           Unicode *u, int uSize, int *uLen,
756                           double *dx, double *dy, double *ox, double *oy);
757 +  virtual CharCodeToUnicode* getCTU();
758  
759    // Return the writing mode (0=horizontal, 1=vertical).
760    virtual int getWMode();
761 --- orig/GfxFont.cc     2007-07-28 00:11:06.000000000 +0200
762 +++ GfxFont.cc  2007-09-09 18:33:37.000000000 +0200
763 @@ -925,6 +925,10 @@
764    return 1;
765  }
766  
767 +CharCodeToUnicode* Gfx8BitFont::getCTU() {
768 +    return ctu;
769 +}
770 +
771  CharCodeToUnicode *Gfx8BitFont::getToUnicode() {
772    ctu->incRefCnt();
773    return ctu;
774 @@ -1417,6 +1421,10 @@
775    }
776  }
777  
778 +CharCodeToUnicode* GfxCIDFont::getCTU() {
779 +    return ctu;
780 +}
781 +
782  int GfxCIDFont::getNextChar(char *s, int len, CharCode *code,
783                             Unicode *u, int uSize, int *uLen,
784                             double *dx, double *dy, double *ox, double *oy) {
785 --- OutputDev.h Sat Jul 28 00:11:08 2007
786 +++ OutputDev.h Sun Sep  9 13:50:40 2007
787 @@ -17,6 +17,7 @@
788  
789  #include "gtypes.h"
790  #include "CharTypes.h"
791 +#include "Object.h"
792  
793  class GString;
794  class Gfx;
795 --- SplashOutputDev.h   2007-10-20 13:17:02.000000000 +0200
796 +++ SplashOutputDev.h   2007-10-20 13:17:23.000000000 +0200
797 @@ -206,6 +206,7 @@
798    virtual void setVectorAntialias(GBool vaa);
799  #endif
800  
801 +  void doUpdateFont(GfxState *state);
802  private:
803  
804    void setupScreenParams(double hDPI, double vDPI);
805 @@ -215,7 +216,6 @@
806    SplashPattern *getColor(GfxGray gray, GfxRGB *rgb);
807  #endif
808    SplashPath *convertPath(GfxState *state, GfxPath *path);
809 -  void doUpdateFont(GfxState *state);
810    void drawType3Glyph(T3FontCache *t3Font,
811                       T3FontCacheTag *tag, Guchar *data);
812    static GBool imageMaskSrc(void *data, SplashColorPtr line);
813 --- xpdf/GlobalParams.h 2007-10-20 13:18:03.000000000 +0200
814 +++ xpdf/GlobalParams.h 2007-10-20 13:25:52.000000000 +0200
815 @@ -196,7 +196,7 @@
816    // file.
817    GlobalParams(char *cfgFileName);
818  
819 -  ~GlobalParams();
820 +  virtual ~GlobalParams();
821  
822    void setBaseDir(char *dir);
823    void setupBaseFonts(char *dir);
824 --- xpdf/SplashOutputDev.h.orig 2007-10-21 17:43:29.000000000 +0200
825 +++ xpdf/SplashOutputDev.h      2007-11-19 10:07:27.000000000 +0100
826 @@ -197,6 +197,8 @@
827  #endif
828  
829    void doUpdateFont(GfxState *state);
830 +  
831 +  SplashPath *convertPath(GfxState *state, GfxPath *path);
832  private:
833  
834    void setupScreenParams(double hDPI, double vDPI);
835 @@ -205,7 +207,6 @@
836  #else
837    SplashPattern *getColor(GfxGray gray, GfxRGB *rgb);
838  #endif
839 -  SplashPath *convertPath(GfxState *state, GfxPath *path);
840    void drawType3Glyph(T3FontCache *t3Font,
841                       T3FontCacheTag *tag, Guchar *data);
842    static GBool imageMaskSrc(void *data, SplashColorPtr line);