unpack zips in src to better compression
This commit is contained in:
11
sources/z-tools/trunk/zview/howto_build/howto.txt
Normal file
11
sources/z-tools/trunk/zview/howto_build/howto.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
Building zView is a little bit complicated but not that much.
|
||||
|
||||
1. Download & compile & install libfreetype2 (the most recent version is
|
||||
2.4.6 in time of writing this, it's proven to work).
|
||||
2. Download & compile & install windom 1.21.3 after applying the patch.
|
||||
3. Rename libwindom.a -> libwindom1.a, same for the header file (windom.h ->
|
||||
windom1.h)
|
||||
4. Checkout & compile & install ldg (from the official sf.net site). You
|
||||
must not use the latest stable version (2.33).
|
||||
5. Edit the path to libfreetype2 in the toplevel Makefile.
|
||||
6. make
|
||||
@@ -0,0 +1,38 @@
|
||||
diff -ur tiff-3.8.2/libtiff/Makefile.am tiff-3.8.2-new/libtiff/Makefile.am
|
||||
--- tiff-3.8.2/libtiff/Makefile.am 2006-03-23 15:31:53.000000000 +0100
|
||||
+++ tiff-3.8.2-new/libtiff/Makefile.am 2011-10-24 21:19:02.146076731 +0200
|
||||
@@ -108,7 +108,7 @@
|
||||
libtiff_la_SOURCES = $(SRCS)
|
||||
libtiff_la_LDFLAGS = \
|
||||
-no-undefined \
|
||||
- -version-number $(LIBTIFF_VERSION_INFO)
|
||||
+ -version-info $(LIBTIFF_VERSION_INFO)
|
||||
if HAVE_RPATH
|
||||
libtiff_la_LDFLAGS += $(LIBDIR)
|
||||
endif
|
||||
@@ -117,7 +117,7 @@
|
||||
libtiffxx_la_SOURCES = $(SRCSXX)
|
||||
libtiffxx_la_LDFLAGS = \
|
||||
-no-undefined \
|
||||
- -version-number $(LIBTIFF_VERSION_INFO)
|
||||
+ -version-info $(LIBTIFF_VERSION_INFO)
|
||||
if HAVE_RPATH
|
||||
libtiffxx_la_LDFLAGS += $(LIBDIR)
|
||||
endif
|
||||
diff -ur tiff-3.8.2/libtiff/Makefile.in tiff-3.8.2-new/libtiff/Makefile.in
|
||||
--- tiff-3.8.2/libtiff/Makefile.in 2006-03-23 15:44:45.000000000 +0100
|
||||
+++ tiff-3.8.2-new/libtiff/Makefile.in 2011-10-24 21:19:12.932758298 +0200
|
||||
@@ -355,11 +355,11 @@
|
||||
noinst_HEADERS = $(EXTRA_HDRS)
|
||||
lib_LTLIBRARIES = libtiff.la $(am__append_2)
|
||||
libtiff_la_SOURCES = $(SRCS)
|
||||
-libtiff_la_LDFLAGS = -no-undefined -version-number \
|
||||
+libtiff_la_LDFLAGS = -no-undefined -version-info \
|
||||
$(LIBTIFF_VERSION_INFO) $(am__append_3)
|
||||
libtiff_la_LIBADD = $(LIBPORT)
|
||||
libtiffxx_la_SOURCES = $(SRCSXX)
|
||||
-libtiffxx_la_LDFLAGS = -no-undefined -version-number \
|
||||
+libtiffxx_la_LDFLAGS = -no-undefined -version-info \
|
||||
$(LIBTIFF_VERSION_INFO) $(am__append_4)
|
||||
libtiffxx_la_LIBADD = $(LIBTIFF) $(LIBPORT)
|
||||
libtiffxx_la_DEPENDENCIES = libtiff.la
|
||||
134
sources/z-tools/trunk/zview/howto_build/windom-1.21.3.patch
Normal file
134
sources/z-tools/trunk/zview/howto_build/windom-1.21.3.patch
Normal file
@@ -0,0 +1,134 @@
|
||||
diff -ruw windom-1.21.3/include/windom.h windom-1.21.3-new/include/windom.h
|
||||
--- windom-1.21.3/include/windom.h 2004-11-24 22:08:29.000000000 +0100
|
||||
+++ windom-1.21.3-new/include/windom.h 2011-10-17 17:13:19.440919410 +0200
|
||||
@@ -522,11 +522,7 @@
|
||||
int ApplGet ( int mode, ...);
|
||||
int ApplSet ( int mode, ...);
|
||||
int ApplName ( char *name, int handle);
|
||||
-#ifdef __MSHORT__
|
||||
int ApplWrite ( int to, int msg, ...);
|
||||
-#else
|
||||
-int ApplWrite ( int to, int msg, int b3, int b4, int b5, int b6, int b7);
|
||||
-#endif
|
||||
int ApplControl ( int ap_cid, int ap_cwhat);
|
||||
|
||||
/* AV library */
|
||||
diff -ruw windom-1.21.3/src/appl_set.c windom-1.21.3-new/src/appl_set.c
|
||||
--- windom-1.21.3/src/appl_set.c 2004-11-24 22:08:29.000000000 +0100
|
||||
+++ windom-1.21.3-new/src/appl_set.c 2011-10-17 17:13:19.440919410 +0200
|
||||
@@ -44,10 +44,10 @@
|
||||
if( !CONF(app)) return 2;
|
||||
|
||||
va_start( list, mode);
|
||||
- v1 = va_arg( list, short);
|
||||
- v2 = va_arg( list, short);
|
||||
- v3 = va_arg( list, short);
|
||||
- v4 = va_arg( list, short);
|
||||
+ v1 = va_arg( list, int);
|
||||
+ v2 = va_arg( list, int);
|
||||
+ v3 = va_arg( list, int);
|
||||
+ v4 = va_arg( list, int);
|
||||
va_end( list);
|
||||
|
||||
switch( mode) {
|
||||
diff -ruw windom-1.21.3/src/appl_write.c windom-1.21.3-new/src/appl_write.c
|
||||
--- windom-1.21.3/src/appl_write.c 2004-11-24 22:08:29.000000000 +0100
|
||||
+++ windom-1.21.3-new/src/appl_write.c 2011-10-17 17:13:19.444252608 +0200
|
||||
@@ -34,29 +34,6 @@
|
||||
|
||||
/* A more pratical call to appl_write() */
|
||||
|
||||
-#ifndef __MSHORT__
|
||||
-
|
||||
-/* en 32bits, on attend des 'int' plutot que '...' (va_args) en parametre */
|
||||
-/* car c'est le seul moyen d'<27>viter l'utilisation du code genre */
|
||||
-/* ApplWrite( to, msg, "tralala"); */
|
||||
-/* qui fonctionne uniquement en 16 bits si on utilise va_args */
|
||||
-
|
||||
-int ApplWrite( int to, int msg, int b3, int b4, int b5, int b6, int b7) {
|
||||
- INT16 buf[8];
|
||||
-
|
||||
- buf[0] = msg;
|
||||
- buf[1] = app.id;
|
||||
- buf[2] = 0;
|
||||
- buf[3] = b3;
|
||||
- buf[4] = b4;
|
||||
- buf[5] = b5;
|
||||
- buf[6] = b6;
|
||||
- buf[7] = b7;
|
||||
- return appl_write( to, 16, buf);
|
||||
-}
|
||||
-
|
||||
-#else
|
||||
-
|
||||
int ApplWrite( int to, int msg, ...) {
|
||||
va_list args;
|
||||
short buf[8];
|
||||
@@ -65,13 +42,11 @@
|
||||
buf[1] = app.id;
|
||||
buf[2] = 0;
|
||||
va_start( args, msg);
|
||||
- buf[3] = va_arg( args, short);
|
||||
- buf[4] = va_arg( args, short);
|
||||
- buf[5] = va_arg( args, short);
|
||||
- buf[6] = va_arg( args, short);
|
||||
- buf[7] = va_arg( args, short);
|
||||
+ buf[3] = va_arg( args, int);
|
||||
+ buf[4] = va_arg( args, int);
|
||||
+ buf[5] = va_arg( args, int);
|
||||
+ buf[6] = va_arg( args, int);
|
||||
+ buf[7] = va_arg( args, int);
|
||||
va_end( args);
|
||||
return appl_write( to, 16, buf);
|
||||
}
|
||||
-#endif
|
||||
-
|
||||
diff -ruw windom-1.21.3/src/av_init.c windom-1.21.3-new/src/av_init.c
|
||||
--- windom-1.21.3/src/av_init.c 2004-11-24 22:08:29.000000000 +0100
|
||||
+++ windom-1.21.3-new/src/av_init.c 2011-10-17 17:14:40.931886052 +0200
|
||||
@@ -73,7 +73,8 @@
|
||||
static int av_ping( int status, long idle) {
|
||||
INT16 msg[8];
|
||||
|
||||
- ApplWrite( app.avid, AV_PROTOKOLL, status, 0, 0, ADR(__av_name));
|
||||
+ strcpy( app.pipe, __av_name);
|
||||
+ ApplWrite( app.avid, AV_PROTOKOLL, status, 0, 0, ADR(app.pipe));
|
||||
if( AvWaitfor( VA_PROTOSTATUS, msg, idle)) {
|
||||
__av_status[0] = msg[3];
|
||||
__av_status[1] = msg[4];
|
||||
diff -ruw windom-1.21.3/src/objc_dup.c windom-1.21.3-new/src/objc_dup.c
|
||||
--- windom-1.21.3/src/objc_dup.c 2004-11-24 22:08:30.000000000 +0100
|
||||
+++ windom-1.21.3-new/src/objc_dup.c 2011-10-17 17:13:19.444252608 +0200
|
||||
@@ -133,7 +133,7 @@
|
||||
case G_TITLE:
|
||||
mem_adr = __malloc_obspec(&cpy[i],strlen((char*)wparm->wp_spec)+1);
|
||||
strcpy(mem_adr,(char*)wparm->wp_spec);
|
||||
- (char*)wparm->wp_spec = mem_adr;
|
||||
+ wparm->wp_spec = mem_adr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
diff -ruw windom-1.21.3/src/objc_string.c windom-1.21.3-new/src/objc_string.c
|
||||
--- windom-1.21.3/src/objc_string.c 2004-11-24 22:08:30.000000000 +0100
|
||||
+++ windom-1.21.3-new/src/objc_string.c 2011-10-17 17:13:19.444252608 +0200
|
||||
@@ -78,7 +78,7 @@
|
||||
case XFREESTR:
|
||||
user = tree[idx].ob_spec.userblk;
|
||||
if( put)
|
||||
- (char*)((W_PARM*)user->ub_parm)->wp_spec = put;
|
||||
+ ((W_PARM*)user->ub_parm)->wp_spec = put;
|
||||
return ( (char*)((W_PARM*)user->ub_parm)->wp_spec);
|
||||
|
||||
#ifdef MODIF_XEDIT
|
||||
diff -ruw windom-1.21.3/src/popup.c windom-1.21.3-new/src/popup.c
|
||||
--- windom-1.21.3/src/popup.c 2004-11-24 22:08:30.000000000 +0100
|
||||
+++ windom-1.21.3-new/src/popup.c 2011-10-17 17:13:19.444252608 +0200
|
||||
@@ -87,7 +87,7 @@
|
||||
|
||||
static void uo_init_type( OBJECT *tree, int index, void *func,
|
||||
int extype, XUSERBLK * uo) {
|
||||
- (W_PARM *)(uo -> user . ub_parm) = & ( uo -> w_parm );
|
||||
+ uo -> user . ub_parm = & ( uo -> w_parm );
|
||||
uo -> user . ub_code = func;
|
||||
((W_PARM*)uo -> user . ub_parm) -> wp_type = tree[index].ob_type;
|
||||
((W_PARM*)uo -> user . ub_parm) -> wp_spec = tree[index].ob_spec.index;
|
||||
559
sources/z-tools/trunk/zview/howto_build/xpdf-3.03-zview.patch
Normal file
559
sources/z-tools/trunk/zview/howto_build/xpdf-3.03-zview.patch
Normal file
@@ -0,0 +1,559 @@
|
||||
--- /dev/null 2011-11-05 17:04:04.509133295 +0100
|
||||
+++ new/pdflib.cc 2011-11-05 21:15:20.575216608 +0100
|
||||
@@ -0,0 +1,487 @@
|
||||
+#include "../general.h"
|
||||
+#include "../prefs.h"
|
||||
+#include "../winimg.h"
|
||||
+#include "aconf.h"
|
||||
+#include "../custom_font.h"
|
||||
+#include "goo/gmem.h"
|
||||
+#include "goo/GString.h"
|
||||
+#include "goo/GList.h"
|
||||
+#include "xpdf/GlobalParams.h"
|
||||
+#include "xpdf/Object.h"
|
||||
+#include "xpdf/PDFDoc.h"
|
||||
+#include "splash/SplashBitmap.h"
|
||||
+#include "splash/Splash.h"
|
||||
+#include "xpdf/SplashOutputDev.h"
|
||||
+#include "xpdf/CharTypes.h"
|
||||
+#include "xpdf/UnicodeMap.h"
|
||||
+#include "xpdf/Outline.h"
|
||||
+#include "xpdf/Link.h"
|
||||
+
|
||||
+extern "C" {
|
||||
+
|
||||
+
|
||||
+static char latin_to_atari[] = { /*0x00A0*/'*','<27>','<27>','<27>','*','<27>',17,'<27>','<27>','<27>','<27>','<27>','<27>','-','<27>',
|
||||
+'<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','*','\'','<27>','<27>','<27>','<27>','*','<27>','<27>','A','A','<27>','<27>','<27>','<27>',
|
||||
+'<27>','E','<27>','E','E','I','I','I','I','D','<27>','O','O','O','<27>','<27>','x','<27>','U','U','U','<27>','Y','*',
|
||||
+'<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>','<27>',
|
||||
+'<27>','<27>','<27>','<27>','<27>','y','*','<27>'};
|
||||
+
|
||||
+char pdf_title[256];
|
||||
+
|
||||
+
|
||||
+void delete_bookmark_child( Bookmark *book)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ /* if nothing to do, end the function */
|
||||
+ if( book->child == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ /* make a loop to see if the childs mini entries have child, if it's true, delete it */
|
||||
+ for ( i = 0; i < book->nbr_child ; i++)
|
||||
+ {
|
||||
+ if ( book->child[i].nbr_child)
|
||||
+ delete_bookmark_child( &book->child[i]);
|
||||
+ }
|
||||
+
|
||||
+ /* Free the memory and put the counter to zero */
|
||||
+ gfree( book->child);
|
||||
+ book->child = NULL;
|
||||
+ book->nbr_child = 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int setupOutlineItems( WINDOW * win, PDFDoc *doc, GList *items, UnicodeMap *uMap, Bookmark *book, Bookmark *parent)
|
||||
+{
|
||||
+ OutlineItem *item;
|
||||
+ GList *kids;
|
||||
+ LinkAction *link_action;
|
||||
+ char buf[8], *test;
|
||||
+ int i, j, n, count, lenght;
|
||||
+
|
||||
+ for (i = 0; i < items->getLength(); ++i)
|
||||
+ {
|
||||
+ item = (OutlineItem *)items->get(i);
|
||||
+
|
||||
+ book[i].parent = parent;
|
||||
+ book[i].child = NULL;
|
||||
+ book[i].nbr_child = 0;
|
||||
+ book[i].state = UNKNOWN;
|
||||
+ book[i].valid = FALSE;
|
||||
+
|
||||
+ link_action = item->getAction();
|
||||
+
|
||||
+ if( link_action && link_action->getKind () == actionGoTo)
|
||||
+ {
|
||||
+ LinkGoTo *link = dynamic_cast <LinkGoTo *> (link_action);
|
||||
+ LinkDest *link_dest = link->getDest();
|
||||
+ GString *named_dest = link->getNamedDest ();
|
||||
+
|
||||
+ if (link_dest != NULL)
|
||||
+ {
|
||||
+ if (link_dest->isPageRef ())
|
||||
+ {
|
||||
+ Ref page_ref = link_dest->getPageRef ();
|
||||
+ book[i].linked_page = doc->findPage( page_ref.num, page_ref.gen) - 1;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ book[i].linked_page = link_dest->getPageNum() - 1;
|
||||
+ }
|
||||
+
|
||||
+ book[i].valid = TRUE;
|
||||
+ }
|
||||
+ else if( named_dest != NULL)
|
||||
+ {
|
||||
+ link_dest = doc->findDest (named_dest);
|
||||
+
|
||||
+ if (link_dest->isPageRef ())
|
||||
+ {
|
||||
+ Ref page_ref = link_dest->getPageRef ();
|
||||
+ book[i].linked_page = doc->findPage( page_ref.num, page_ref.gen) - 1;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ book[i].linked_page = link_dest->getPageNum () - 1;
|
||||
+ }
|
||||
+
|
||||
+ delete link_dest;
|
||||
+ book[i].valid = TRUE;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if( book[i].valid == FALSE)
|
||||
+ continue;
|
||||
+
|
||||
+ test = book[i].name;
|
||||
+
|
||||
+
|
||||
+ /* Unicode to Latin 1 */
|
||||
+ for (j = 0, lenght = 0; j < item->getTitleLength(); ++j)
|
||||
+ {
|
||||
+ n = uMap->mapUnicode(item->getTitle()[j], buf, sizeof(buf));
|
||||
+
|
||||
+ for( count = 0; n > count && lenght < 254; count++)
|
||||
+ test[lenght++] = buf[count++];
|
||||
+ }
|
||||
+
|
||||
+ test[lenght] = '\0';
|
||||
+
|
||||
+ /* Latin 1 to Atari */
|
||||
+ for ( lenght = 0; test[lenght] != '\0'; ++lenght)
|
||||
+ {
|
||||
+ if( ( uint8)test[lenght] > 0x9F)
|
||||
+ {
|
||||
+ uint8 c = ( uint8)test[lenght] - 0xA0;
|
||||
+ test[lenght] = latin_to_atari[c];
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ book[i].txt_width = get_text_width( book[i].name);
|
||||
+
|
||||
+ item->open();
|
||||
+
|
||||
+ if( item->hasKids() && ( kids = item->getKids()) && kids->getLength() > 0)
|
||||
+ {
|
||||
+ book[i].nbr_child = kids->getLength();
|
||||
+ book[i].child = ( Bookmark*)gmalloc( sizeof( Bookmark) * kids->getLength());
|
||||
+ book[i].state = item->isOpen();
|
||||
+
|
||||
+ if( !setupOutlineItems(win, doc, kids, uMap, book[i].child, book))
|
||||
+ {
|
||||
+ gfree( book[i].child);
|
||||
+ book[i].child = NULL;
|
||||
+ book[i].nbr_child = 0;
|
||||
+ return( 0);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return( 1);
|
||||
+}
|
||||
+
|
||||
+void pdf_build_bookmark( WINDATA *windata, WINDOW *win)
|
||||
+{
|
||||
+ IMAGE *img = &windata->img;
|
||||
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
|
||||
+ Outline *outline;
|
||||
+ GList *items;
|
||||
+ int i;
|
||||
+
|
||||
+ outline = doc->getOutline();
|
||||
+
|
||||
+ if( outline == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ items = outline->getItems();
|
||||
+
|
||||
+ if( items == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ if ( items->getLength() > 0)
|
||||
+ {
|
||||
+ windata->root = ( Bookmark*)gmalloc( sizeof( Bookmark) * items->getLength());
|
||||
+
|
||||
+ if( windata->root == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ GString *enc = new GString("Latin1");
|
||||
+ UnicodeMap *uMap = globalParams->getUnicodeMap(enc);
|
||||
+ delete enc;
|
||||
+
|
||||
+ windata->nbr_bookmark = items->getLength();
|
||||
+
|
||||
+ if( !setupOutlineItems( win, doc, items, uMap, windata->root, NULL))
|
||||
+ {
|
||||
+ for ( i = 0; i < windata->nbr_bookmark; i++)
|
||||
+ {
|
||||
+ if ( windata->root[i].nbr_child)
|
||||
+ delete_bookmark_child( &windata->root[i]);
|
||||
+ }
|
||||
+
|
||||
+ gfree( windata->root);
|
||||
+ windata->root = NULL;
|
||||
+ windata->nbr_bookmark = 0;
|
||||
+ }
|
||||
+
|
||||
+ uMap->decRefCnt();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+boolean lib_pdf_load( const char *name, IMAGE *img)
|
||||
+{
|
||||
+ PDFDoc *doc = NULL;
|
||||
+ SplashColor paperColor;
|
||||
+ SplashOutputDev *splashOut = NULL;
|
||||
+
|
||||
+ char* aaString = const_cast<char*>( pdf_aa ? "yes" : "no");
|
||||
+ globalParams->setAntialias( aaString);
|
||||
+
|
||||
+ GString nameString( name);
|
||||
+ doc = new PDFDoc( &nameString);
|
||||
+
|
||||
+ if (!doc->isOk())
|
||||
+ {
|
||||
+ delete doc;
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ paperColor[0] = paperColor[1] = paperColor[2] = 0xff;
|
||||
+ splashOut = new SplashOutputDev( splashModeRGB8, 1, gFalse, paperColor);
|
||||
+ splashOut->startDoc(doc->getXRef());
|
||||
+
|
||||
+ img->bits = 24;
|
||||
+ img->colors = ( 1L << ( uint32)img->bits) - 1;
|
||||
+ img->page = ( uint16)doc->getNumPages();
|
||||
+ img->comments = NULL;
|
||||
+ img->_priv_ptr = ( void*)doc;
|
||||
+ img->_priv_ptr_more = ( void*)splashOut;
|
||||
+
|
||||
+ strcpy( ( char*)img->info, "PDF");
|
||||
+ strcpy( ( char*)img->compression, "None");
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
+void pdf_get_page_size( IMAGE *img, int page, uint16 *width, uint16 *height)
|
||||
+{
|
||||
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
|
||||
+ int rotation = doc->getPageRotate( page);
|
||||
+
|
||||
+ if( ( rotation == 90) || ( rotation == 270))
|
||||
+ {
|
||||
+ *width = (uint16)doc->getPageCropHeight( page);
|
||||
+ *height = (uint16)doc->getPageCropWidth( page);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ *width = (uint16)doc->getPageCropWidth( page);
|
||||
+ *height = (uint16)doc->getPageCropHeight( page);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void pdf_decode_page( IMAGE *img, int page, double scale)
|
||||
+{
|
||||
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
|
||||
+ SplashOutputDev *splashOut = ( SplashOutputDev*)img->_priv_ptr_more;
|
||||
+ int rotation = doc->getPageRotate( page);
|
||||
+
|
||||
+ if( ( rotation == 90) || ( rotation == 270))
|
||||
+ {
|
||||
+ img->img_w = (uint16)MAX(( doc->getPageCropHeight( page) * scale + 0.5), 1);
|
||||
+ img->img_h = (uint16)MAX(( doc->getPageCropWidth( page) * scale + 0.5), 1);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ img->img_w = (uint16)MAX(( doc->getPageCropWidth( page) * scale + 0.5), 1);
|
||||
+ img->img_h = (uint16)MAX(( doc->getPageCropHeight( page) * scale + 0.5), 1);
|
||||
+ }
|
||||
+
|
||||
+ doc->displayPage( splashOut, page, 72.0 * scale, 72.0 * scale, 0, gFalse, gTrue, gFalse);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+uint32 *pdf_get_page_addr( IMAGE *img)
|
||||
+{
|
||||
+ SplashOutputDev *splashOut = ( SplashOutputDev*)img->_priv_ptr_more;
|
||||
+ SplashColorPtr data = splashOut->getBitmap()->getDataPtr();
|
||||
+
|
||||
+ return ( uint32*)( data); // ( data.rgb8);
|
||||
+}
|
||||
+
|
||||
+static char *InfoString(Dict *infoDict, char *key, UnicodeMap *uMap)
|
||||
+{
|
||||
+ Object obj;
|
||||
+ GString *s1;
|
||||
+ GBool isUnicode;
|
||||
+ Unicode u;
|
||||
+ char buf[8];
|
||||
+ static char text[256];
|
||||
+ int i, n, lenght = 0, count;
|
||||
+
|
||||
+ if (infoDict->lookup(key, &obj)->isString())
|
||||
+ {
|
||||
+ s1 = obj.getString();
|
||||
+
|
||||
+ if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff)
|
||||
+ {
|
||||
+ isUnicode = gTrue;
|
||||
+ i = 2;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ isUnicode = gFalse;
|
||||
+ i = 0;
|
||||
+ }
|
||||
+
|
||||
+ while ( i < obj.getString()->getLength())
|
||||
+ {
|
||||
+ if (isUnicode)
|
||||
+ {
|
||||
+ u = ((s1->getChar(i) & 0xff) << 8) | (s1->getChar(i+1) & 0xff);
|
||||
+ i += 2;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ u = s1->getChar(i) & 0xff;
|
||||
+ ++i;
|
||||
+ }
|
||||
+
|
||||
+ n = uMap->mapUnicode(u, buf, sizeof(buf));
|
||||
+
|
||||
+ count = 0;
|
||||
+
|
||||
+ if(( n + lenght) > 234)
|
||||
+ {
|
||||
+ text[lenght] = '\0';
|
||||
+ obj.free();
|
||||
+ return ( char*)&text;
|
||||
+ }
|
||||
+
|
||||
+ while( n > count)
|
||||
+ text[lenght++] = buf[count++];
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ text[lenght] = '\0';
|
||||
+ obj.free();
|
||||
+
|
||||
+ return ( char*)&text;
|
||||
+}
|
||||
+
|
||||
+static char *InfoDate(Dict *infoDict, char *key)
|
||||
+{
|
||||
+ Object obj;
|
||||
+ char *s;
|
||||
+ int year, mon, day, hour, min, sec;
|
||||
+ struct tm tmStruct;
|
||||
+ static char buf[256];
|
||||
+
|
||||
+ if (infoDict->lookup(key, &obj)->isString())
|
||||
+ {
|
||||
+ s = obj.getString()->getCString();
|
||||
+
|
||||
+ if (s[0] == 'D' && s[1] == ':')
|
||||
+ {
|
||||
+ s += 2;
|
||||
+ }
|
||||
+
|
||||
+ if (sscanf(s, "%4d%2d%2d%2d%2d%2d", &year, &mon, &day, &hour, &min, &sec) == 6)
|
||||
+ {
|
||||
+ tmStruct.tm_year = year - 1900;
|
||||
+ tmStruct.tm_mon = mon - 1;
|
||||
+ tmStruct.tm_mday = day;
|
||||
+ tmStruct.tm_hour = hour;
|
||||
+ tmStruct.tm_min = min;
|
||||
+ tmStruct.tm_sec = sec;
|
||||
+ tmStruct.tm_wday = -1;
|
||||
+ tmStruct.tm_yday = -1;
|
||||
+ tmStruct.tm_isdst = -1;
|
||||
+ // compute the tm_wday and tm_yday fields
|
||||
+ if (mktime(&tmStruct) != (time_t)-1 && strftime(buf, sizeof(buf), "%c", &tmStruct))
|
||||
+ {
|
||||
+ obj.free();
|
||||
+ return ( char*)&buf;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ strcpy( buf, s);
|
||||
+ }
|
||||
+ else buf[0] = '\0';
|
||||
+
|
||||
+ obj.free();
|
||||
+ return ( char*)&buf;
|
||||
+}
|
||||
+
|
||||
+void pdf_get_info( IMAGE *img, txt_data *txtdata)
|
||||
+{
|
||||
+ Object info;
|
||||
+ UnicodeMap *uMap;
|
||||
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
|
||||
+ char *txt;
|
||||
+
|
||||
+ if (!( uMap = globalParams->getTextEncoding()))
|
||||
+ {
|
||||
+ pdf_title[0] = '\0';
|
||||
+ txtdata->txt[0][0] = '\0';
|
||||
+ txtdata->txt[1][0] = '\0';
|
||||
+ txtdata->txt[2][0] = '\0';
|
||||
+ txtdata->txt[3][0] = '\0';
|
||||
+ txtdata->txt[4][0] = '\0';
|
||||
+ txtdata->txt[5][0] = '\0';
|
||||
+ txtdata->txt[6][0] = '\0';
|
||||
+ txtdata->txt[7][0] = '\0';
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ doc->getDocInfo(&info);
|
||||
+
|
||||
+ if (info.isDict())
|
||||
+ {
|
||||
+ txt = InfoString(info.getDict(), "Title", uMap);
|
||||
+ sprintf( ( char*)txtdata->txt[0] , "Title: %s", txt);
|
||||
+ strcpy( pdf_title, txt);
|
||||
+ txt = InfoString(info.getDict(), "Subject", uMap);
|
||||
+ sprintf( ( char*)txtdata->txt[1] , "Subject: %s", txt);
|
||||
+ txt = InfoString(info.getDict(), "Keywords", uMap);
|
||||
+ sprintf( ( char*)txtdata->txt[2] , "Keywords: %s", txt);
|
||||
+ txt = InfoString(info.getDict(), "Author", uMap);
|
||||
+ sprintf( ( char*)txtdata->txt[3] , "Author: %s", txt);
|
||||
+ txt = InfoString(info.getDict(), "Creator", uMap);
|
||||
+ sprintf( ( char*)txtdata->txt[4] , "Creator: %s", txt);
|
||||
+ txt = InfoString(info.getDict(), "Producer", uMap);
|
||||
+ sprintf( ( char*)txtdata->txt[5] , "Producer: %s", txt);
|
||||
+// sprintf( ( char*)txtdata->txt[6] , "PDF version: %.1f", doc->getPDFVersion());
|
||||
+
|
||||
+ txt = InfoDate(info.getDict(), "CreationDate");
|
||||
+ sprintf( ( char*)txtdata->txt[6] , "Creation Date: %s", txt);
|
||||
+ txt = InfoDate(info.getDict(), "ModDate");
|
||||
+ sprintf( ( char*)txtdata->txt[7] , "Modification Date: %s", txt);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ pdf_title[0] = '\0';
|
||||
+ txtdata->txt[0][0] = '\0';
|
||||
+ txtdata->txt[1][0] = '\0';
|
||||
+ txtdata->txt[2][0] = '\0';
|
||||
+ txtdata->txt[3][0] = '\0';
|
||||
+ txtdata->txt[4][0] = '\0';
|
||||
+ txtdata->txt[5][0] = '\0';
|
||||
+ txtdata->txt[6][0] = '\0';
|
||||
+ txtdata->txt[7][0] = '\0';
|
||||
+ }
|
||||
+
|
||||
+ info.free();
|
||||
+ uMap->decRefCnt();
|
||||
+}
|
||||
+
|
||||
+void pdf_quit( IMAGE *img)
|
||||
+{
|
||||
+ PDFDoc *doc = ( PDFDoc*)img->_priv_ptr;
|
||||
+ SplashOutputDev *splashOut = ( SplashOutputDev*)img->_priv_ptr_more;
|
||||
+
|
||||
+ delete splashOut;
|
||||
+ delete doc;
|
||||
+}
|
||||
+
|
||||
+char *get_pdf_title( void)
|
||||
+{
|
||||
+ return ( char*)&pdf_title;
|
||||
+}
|
||||
+
|
||||
+boolean pdf_init( char *path)
|
||||
+{
|
||||
+ globalParams = new GlobalParams( NULL);
|
||||
+ globalParams->setupBaseFonts( path);
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
+void pdf_exit( void)
|
||||
+{
|
||||
+ delete globalParams;
|
||||
+}
|
||||
+
|
||||
+}
|
||||
diff -ruwN _deps/xpdf-3.03/pdflib.h xpdf-3.03/pdflib.h
|
||||
--- _deps/xpdf-3.03/pdflib.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ xpdf-3.03/pdflib.h 2011-10-16 22:33:31.870338392 +0200
|
||||
@@ -0,0 +1,13 @@
|
||||
+boolean lib_pdf_load( const char *name, IMAGE *img);
|
||||
+void pdf_get_page_size( IMAGE *img, int page, uint16 *width, uint16 *height);
|
||||
+void pdf_decode_page( IMAGE *img, int page, double scale);
|
||||
+uint32 *pdf_get_page_addr( IMAGE *img);
|
||||
+void pdf_quit( IMAGE *img);
|
||||
+boolean pdf_init( char *path);
|
||||
+void pdf_exit( void);
|
||||
+char *get_pdf_title( void) ;
|
||||
+void pdf_build_bookmark( WINDATA *windata, WINDOW *win);
|
||||
+void pdf_get_info( IMAGE *img, txt_data *txtdata);
|
||||
+void delete_bookmark_child( Bookmark *book);
|
||||
+
|
||||
+
|
||||
diff -ruwN _deps/xpdf-3.03/xpdf/GlobalParams.cc xpdf-3.03/xpdf/GlobalParams.cc
|
||||
--- _deps/xpdf-3.03/xpdf/GlobalParams.cc 2011-08-15 23:08:53.000000000 +0200
|
||||
+++ xpdf-3.03/xpdf/GlobalParams.cc 2011-10-16 22:33:46.513693391 +0200
|
||||
@@ -85,20 +85,20 @@
|
||||
const char *t1FileName;
|
||||
const char *ttFileName;
|
||||
} displayFontTab[] = {
|
||||
- {"Courier", "n022003l.pfb", "cour.ttf"},
|
||||
- {"Courier-Bold", "n022004l.pfb", "courbd.ttf"},
|
||||
- {"Courier-BoldOblique", "n022024l.pfb", "courbi.ttf"},
|
||||
- {"Courier-Oblique", "n022023l.pfb", "couri.ttf"},
|
||||
- {"Helvetica", "n019003l.pfb", "arial.ttf"},
|
||||
- {"Helvetica-Bold", "n019004l.pfb", "arialbd.ttf"},
|
||||
- {"Helvetica-BoldOblique", "n019024l.pfb", "arialbi.ttf"},
|
||||
- {"Helvetica-Oblique", "n019023l.pfb", "ariali.ttf"},
|
||||
- {"Symbol", "s050000l.pfb", NULL},
|
||||
- {"Times-Bold", "n021004l.pfb", "timesbd.ttf"},
|
||||
- {"Times-BoldItalic", "n021024l.pfb", "timesbi.ttf"},
|
||||
- {"Times-Italic", "n021023l.pfb", "timesi.ttf"},
|
||||
- {"Times-Roman", "n021003l.pfb", "times.ttf"},
|
||||
- {"ZapfDingbats", "d050000l.pfb", NULL},
|
||||
+ {"Courier", "fonts\\n022003l.pfb", "cour.ttf"},
|
||||
+ {"Courier-Bold", "fonts\\n022004l.pfb", "courbd.ttf"},
|
||||
+ {"Courier-BoldOblique", "fonts\\n022024l.pfb", "courbi.ttf"},
|
||||
+ {"Courier-Oblique", "fonts\\n022023l.pfb", "couri.ttf"},
|
||||
+ {"Helvetica", "fonts\\n019003l.pfb", "arial.ttf"},
|
||||
+ {"Helvetica-Bold", "fonts\\n019004l.pfb", "arialbd.ttf"},
|
||||
+ {"Helvetica-BoldOblique", "fonts\\n019024l.pfb", "arialbi.ttf"},
|
||||
+ {"Helvetica-Oblique", "fonts\\n019023l.pfb", "ariali.ttf"},
|
||||
+ {"Symbol", "fonts\\s050000l.pfb", NULL},
|
||||
+ {"Times-Bold", "fonts\\n021004l.pfb", "timesbd.ttf"},
|
||||
+ {"Times-BoldItalic", "fonts\\n021024l.pfb", "timesbi.ttf"},
|
||||
+ {"Times-Italic", "fonts\\n021023l.pfb", "timesi.ttf"},
|
||||
+ {"Times-Roman", "fonts\\n021003l.pfb", "times.ttf"},
|
||||
+ {"ZapfDingbats", "fonts\\d050000l.pfb", NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
@@ -110,11 +110,13 @@
|
||||
};
|
||||
#else
|
||||
static const char *displayFontDirs[] = {
|
||||
+ /*
|
||||
"/usr/share/ghostscript/fonts",
|
||||
"/usr/local/share/ghostscript/fonts",
|
||||
"/usr/share/fonts/default/Type1",
|
||||
"/usr/share/fonts/default/ghostscript",
|
||||
"/usr/share/fonts/type1/gsfonts",
|
||||
+ */
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
Reference in New Issue
Block a user