pdf2json 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +9 -0
- data/bin/.gitkeep +0 -0
- data/ext/extconf.rb +30 -0
- data/lib/pdf2json.rb +8 -0
- data/pdf2json-0.52-source/AUTHORS +24 -0
- data/pdf2json-0.52-source/CHANGES +11 -0
- data/pdf2json-0.52-source/Makefile +84 -0
- data/pdf2json-0.52-source/Makefile.in +84 -0
- data/pdf2json-0.52-source/aclocal.m4 +274 -0
- data/pdf2json-0.52-source/aconf-win32.h +86 -0
- data/pdf2json-0.52-source/aconf.h +42 -0
- data/pdf2json-0.52-source/aconf.h.in +41 -0
- data/pdf2json-0.52-source/autom4te.cache/output.0 +6908 -0
- data/pdf2json-0.52-source/autom4te.cache/requests +76 -0
- data/pdf2json-0.52-source/autom4te.cache/traces.0 +466 -0
- data/pdf2json-0.52-source/config.log +1259 -0
- data/pdf2json-0.52-source/config.status +1050 -0
- data/pdf2json-0.52-source/configure +6908 -0
- data/pdf2json-0.52-source/configure.ac +93 -0
- data/pdf2json-0.52-source/doc/pdffonts.1 +130 -0
- data/pdf2json-0.52-source/doc/pdffonts.cat +107 -0
- data/pdf2json-0.52-source/doc/pdffonts.hlp +117 -0
- data/pdf2json-0.52-source/doc/pdfimages.1 +102 -0
- data/pdf2json-0.52-source/doc/pdfimages.cat +92 -0
- data/pdf2json-0.52-source/doc/pdfimages.hlp +101 -0
- data/pdf2json-0.52-source/doc/pdfinfo.1 +158 -0
- data/pdf2json-0.52-source/doc/pdfinfo.cat +119 -0
- data/pdf2json-0.52-source/doc/pdfinfo.hlp +129 -0
- data/pdf2json-0.52-source/doc/pdftoppm.1 +115 -0
- data/pdf2json-0.52-source/doc/pdftoppm.cat +105 -0
- data/pdf2json-0.52-source/doc/pdftoppm.hlp +114 -0
- data/pdf2json-0.52-source/doc/pdftops.1 +229 -0
- data/pdf2json-0.52-source/doc/pdftops.cat +221 -0
- data/pdf2json-0.52-source/doc/pdftops.hlp +231 -0
- data/pdf2json-0.52-source/doc/pdftotext.1 +137 -0
- data/pdf2json-0.52-source/doc/pdftotext.cat +120 -0
- data/pdf2json-0.52-source/doc/pdftotext.hlp +133 -0
- data/pdf2json-0.52-source/doc/sample-xpdfrc +91 -0
- data/pdf2json-0.52-source/doc/xpdf.1 +513 -0
- data/pdf2json-0.52-source/doc/xpdf.cat +476 -0
- data/pdf2json-0.52-source/doc/xpdf.hlp +489 -0
- data/pdf2json-0.52-source/doc/xpdfrc.5 +480 -0
- data/pdf2json-0.52-source/doc/xpdfrc.cat +474 -0
- data/pdf2json-0.52-source/doc/xpdfrc.hlp +479 -0
- data/pdf2json-0.52-source/fofi/.DS_Store +0 -0
- data/pdf2json-0.52-source/fofi/FoFiBase.cc +156 -0
- data/pdf2json-0.52-source/fofi/FoFiBase.h +57 -0
- data/pdf2json-0.52-source/fofi/FoFiBase.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiEncodings.cc +994 -0
- data/pdf2json-0.52-source/fofi/FoFiEncodings.h +36 -0
- data/pdf2json-0.52-source/fofi/FoFiEncodings.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiTrueType.cc +2027 -0
- data/pdf2json-0.52-source/fofi/FoFiTrueType.h +174 -0
- data/pdf2json-0.52-source/fofi/FoFiTrueType.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiType1.cc +252 -0
- data/pdf2json-0.52-source/fofi/FoFiType1.h +59 -0
- data/pdf2json-0.52-source/fofi/FoFiType1.o +0 -0
- data/pdf2json-0.52-source/fofi/FoFiType1C.cc +2603 -0
- data/pdf2json-0.52-source/fofi/FoFiType1C.h +233 -0
- data/pdf2json-0.52-source/fofi/FoFiType1C.o +0 -0
- data/pdf2json-0.52-source/fofi/Makefile +70 -0
- data/pdf2json-0.52-source/fofi/Makefile.dep +0 -0
- data/pdf2json-0.52-source/fofi/Makefile.in +70 -0
- data/pdf2json-0.52-source/fofi/libfofi.a +0 -0
- data/pdf2json-0.52-source/fofi/vms_make.com +0 -0
- data/pdf2json-0.52-source/freetype.win32/.DS_Store +0 -0
- data/pdf2json-0.52-source/freetype.win32/include/.DS_Store +0 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftconfig.h +528 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftheader.h +780 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftmodule.h +32 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftoption.h +733 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/config/ftstdlib.h +173 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/freetype.h +3919 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftadvanc.h +179 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftbbox.h +94 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftbdf.h +209 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftbitmap.h +227 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftcache.h +1128 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftchapters.h +103 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftcid.h +166 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fterrdef.h +244 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fterrors.h +206 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftgasp.h +120 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftglyph.h +613 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftgxval.h +358 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftgzip.h +102 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftimage.h +1313 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftincrem.h +353 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftlcdfil.h +213 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftlist.h +277 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftlzw.h +99 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmac.h +274 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmm.h +378 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmodapi.h +483 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftmoderr.h +155 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftotval.h +203 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftoutln.h +537 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftpfr.h +172 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftrender.h +230 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsizes.h +159 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsnames.h +200 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftstroke.h +716 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsynth.h +80 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftsystem.h +347 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fttrigon.h +350 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/fttypes.h +588 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftwinfnt.h +274 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ftxf86.h +83 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/autohint.h +231 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftcalc.h +179 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftdebug.h +250 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftdriver.h +422 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftgloadr.h +168 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftmemory.h +380 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftobjs.h +1428 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftpic.h +67 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftrfork.h +196 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftserv.h +620 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftstream.h +539 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/fttrace.h +139 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/ftvalid.h +150 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/internal.h +51 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/pcftypes.h +56 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/psaux.h +873 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/pshints.h +712 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svbdf.h +77 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svcid.h +83 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svgldict.h +82 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svgxval.h +72 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svkern.h +51 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svmm.h +104 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svotval.h +55 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpfr.h +66 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpostnm.h +79 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpscmap.h +164 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svpsinfo.h +92 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svsfnt.h +102 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svttcmap.h +106 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svtteng.h +53 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svttglyf.h +67 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svwinfnt.h +50 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/services/svxf86nm.h +55 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/sfnt.h +897 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/t1types.h +270 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/internal/tttypes.h +1543 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/t1tables.h +504 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ttnameid.h +1247 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/tttables.h +759 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/tttags.h +107 -0
- data/pdf2json-0.52-source/freetype.win32/include/freetype/ttunpat.h +59 -0
- data/pdf2json-0.52-source/freetype.win32/include/ft2build.h +39 -0
- data/pdf2json-0.52-source/freetype.win32/lib/freetype_a.lib +0 -0
- data/pdf2json-0.52-source/goo/.DS_Store +0 -0
- data/pdf2json-0.52-source/goo/FixedPoint.cc +118 -0
- data/pdf2json-0.52-source/goo/FixedPoint.h +155 -0
- data/pdf2json-0.52-source/goo/FixedPoint.o +0 -0
- data/pdf2json-0.52-source/goo/GHash.cc +380 -0
- data/pdf2json-0.52-source/goo/GHash.h +78 -0
- data/pdf2json-0.52-source/goo/GHash.o +0 -0
- data/pdf2json-0.52-source/goo/GList.cc +97 -0
- data/pdf2json-0.52-source/goo/GList.h +96 -0
- data/pdf2json-0.52-source/goo/GList.o +0 -0
- data/pdf2json-0.52-source/goo/GMutex.h +49 -0
- data/pdf2json-0.52-source/goo/GString.cc +724 -0
- data/pdf2json-0.52-source/goo/GString.cc.fixed +718 -0
- data/pdf2json-0.52-source/goo/GString.h +136 -0
- data/pdf2json-0.52-source/goo/GString.o +0 -0
- data/pdf2json-0.52-source/goo/ImgWriter.o +0 -0
- data/pdf2json-0.52-source/goo/JpegWriter.o +0 -0
- data/pdf2json-0.52-source/goo/Makefile +72 -0
- data/pdf2json-0.52-source/goo/Makefile.dep +0 -0
- data/pdf2json-0.52-source/goo/Makefile.in +72 -0
- data/pdf2json-0.52-source/goo/PNGWriter.o +0 -0
- data/pdf2json-0.52-source/goo/gfile.cc +731 -0
- data/pdf2json-0.52-source/goo/gfile.h +138 -0
- data/pdf2json-0.52-source/goo/gfile.o +0 -0
- data/pdf2json-0.52-source/goo/gmem.cc +264 -0
- data/pdf2json-0.52-source/goo/gmem.h +79 -0
- data/pdf2json-0.52-source/goo/gmem.o +0 -0
- data/pdf2json-0.52-source/goo/gmempp.cc +32 -0
- data/pdf2json-0.52-source/goo/gmempp.o +0 -0
- data/pdf2json-0.52-source/goo/gtypes.h +29 -0
- data/pdf2json-0.52-source/goo/libGoo.a +0 -0
- data/pdf2json-0.52-source/goo/parseargs.c +190 -0
- data/pdf2json-0.52-source/goo/parseargs.h +71 -0
- data/pdf2json-0.52-source/goo/parseargs.o +0 -0
- data/pdf2json-0.52-source/goo/vms_directory.c +214 -0
- data/pdf2json-0.52-source/goo/vms_dirent.h +67 -0
- data/pdf2json-0.52-source/goo/vms_make.com +82 -0
- data/pdf2json-0.52-source/goo/vms_sys_dirent.h +54 -0
- data/pdf2json-0.52-source/goo/vms_unix_time.h +102 -0
- data/pdf2json-0.52-source/goo/vms_unix_times.c +42 -0
- data/pdf2json-0.52-source/goo/vms_unlink.c +22 -0
- data/pdf2json-0.52-source/ms_make.bat +199 -0
- data/pdf2json-0.52-source/splash/.DS_Store +0 -0
- data/pdf2json-0.52-source/splash/Makefile +103 -0
- data/pdf2json-0.52-source/splash/Makefile.dep +0 -0
- data/pdf2json-0.52-source/splash/Makefile.in +103 -0
- data/pdf2json-0.52-source/splash/Splash.cc +3310 -0
- data/pdf2json-0.52-source/splash/Splash.h +293 -0
- data/pdf2json-0.52-source/splash/Splash.o +0 -0
- data/pdf2json-0.52-source/splash/SplashBitmap.cc +188 -0
- data/pdf2json-0.52-source/splash/SplashBitmap.h +64 -0
- data/pdf2json-0.52-source/splash/SplashBitmap.o +0 -0
- data/pdf2json-0.52-source/splash/SplashClip.cc +382 -0
- data/pdf2json-0.52-source/splash/SplashClip.h +107 -0
- data/pdf2json-0.52-source/splash/SplashClip.o +0 -0
- data/pdf2json-0.52-source/splash/SplashErrorCodes.h +32 -0
- data/pdf2json-0.52-source/splash/SplashFTFont.cc +357 -0
- data/pdf2json-0.52-source/splash/SplashFTFont.h +58 -0
- data/pdf2json-0.52-source/splash/SplashFTFont.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFTFontEngine.cc +179 -0
- data/pdf2json-0.52-source/splash/SplashFTFontEngine.h +65 -0
- data/pdf2json-0.52-source/splash/SplashFTFontEngine.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFTFontFile.cc +114 -0
- data/pdf2json-0.52-source/splash/SplashFTFontFile.h +73 -0
- data/pdf2json-0.52-source/splash/SplashFTFontFile.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFont.cc +176 -0
- data/pdf2json-0.52-source/splash/SplashFont.h +104 -0
- data/pdf2json-0.52-source/splash/SplashFont.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFontEngine.cc +317 -0
- data/pdf2json-0.52-source/splash/SplashFontEngine.h +91 -0
- data/pdf2json-0.52-source/splash/SplashFontEngine.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFontFile.cc +55 -0
- data/pdf2json-0.52-source/splash/SplashFontFile.h +60 -0
- data/pdf2json-0.52-source/splash/SplashFontFile.o +0 -0
- data/pdf2json-0.52-source/splash/SplashFontFileID.cc +23 -0
- data/pdf2json-0.52-source/splash/SplashFontFileID.h +30 -0
- data/pdf2json-0.52-source/splash/SplashFontFileID.o +0 -0
- data/pdf2json-0.52-source/splash/SplashGlyphBitmap.h +26 -0
- data/pdf2json-0.52-source/splash/SplashMath.h +89 -0
- data/pdf2json-0.52-source/splash/SplashPath.cc +184 -0
- data/pdf2json-0.52-source/splash/SplashPath.h +121 -0
- data/pdf2json-0.52-source/splash/SplashPath.o +0 -0
- data/pdf2json-0.52-source/splash/SplashPattern.cc +40 -0
- data/pdf2json-0.52-source/splash/SplashPattern.h +65 -0
- data/pdf2json-0.52-source/splash/SplashPattern.o +0 -0
- data/pdf2json-0.52-source/splash/SplashScreen.cc +383 -0
- data/pdf2json-0.52-source/splash/SplashScreen.h +56 -0
- data/pdf2json-0.52-source/splash/SplashScreen.o +0 -0
- data/pdf2json-0.52-source/splash/SplashState.cc +165 -0
- data/pdf2json-0.52-source/splash/SplashState.h +103 -0
- data/pdf2json-0.52-source/splash/SplashState.o +0 -0
- data/pdf2json-0.52-source/splash/SplashT1Font.cc +287 -0
- data/pdf2json-0.52-source/splash/SplashT1Font.h +57 -0
- data/pdf2json-0.52-source/splash/SplashT1Font.o +0 -0
- data/pdf2json-0.52-source/splash/SplashT1FontEngine.cc +124 -0
- data/pdf2json-0.52-source/splash/SplashT1FontEngine.h +53 -0
- data/pdf2json-0.52-source/splash/SplashT1FontEngine.o +0 -0
- data/pdf2json-0.52-source/splash/SplashT1FontFile.cc +97 -0
- data/pdf2json-0.52-source/splash/SplashT1FontFile.h +58 -0
- data/pdf2json-0.52-source/splash/SplashT1FontFile.o +0 -0
- data/pdf2json-0.52-source/splash/SplashTypes.h +132 -0
- data/pdf2json-0.52-source/splash/SplashXPath.cc +438 -0
- data/pdf2json-0.52-source/splash/SplashXPath.h +100 -0
- data/pdf2json-0.52-source/splash/SplashXPath.o +0 -0
- data/pdf2json-0.52-source/splash/SplashXPathScanner.cc +428 -0
- data/pdf2json-0.52-source/splash/SplashXPathScanner.h +87 -0
- data/pdf2json-0.52-source/splash/SplashXPathScanner.o +0 -0
- data/pdf2json-0.52-source/splash/libsplash.a +0 -0
- data/pdf2json-0.52-source/splash/vms_make.com +0 -0
- data/pdf2json-0.52-source/src/.DS_Store +0 -0
- data/pdf2json-0.52-source/src/GVector.h +101 -0
- data/pdf2json-0.52-source/src/ImgOutputDev.cc +1243 -0
- data/pdf2json-0.52-source/src/ImgOutputDev.h +307 -0
- data/pdf2json-0.52-source/src/ImgOutputDev.o +0 -0
- data/pdf2json-0.52-source/src/Makefile +68 -0
- data/pdf2json-0.52-source/src/Makefile.in +68 -0
- data/pdf2json-0.52-source/src/XmlFonts.cc +367 -0
- data/pdf2json-0.52-source/src/XmlFonts.h +91 -0
- data/pdf2json-0.52-source/src/XmlFonts.o +0 -0
- data/pdf2json-0.52-source/src/XmlLinks.cc +101 -0
- data/pdf2json-0.52-source/src/XmlLinks.h +54 -0
- data/pdf2json-0.52-source/src/XmlLinks.o +0 -0
- data/pdf2json-0.52-source/src/pdf2json +0 -0
- data/pdf2json-0.52-source/src/pdf2json.cc +343 -0
- data/pdf2json-0.52-source/src/pdf2json.o +0 -0
- data/pdf2json-0.52-source/src/pdf2xml.dtd +22 -0
- data/pdf2json-0.52-source/src/pdf2xmljson.dtd +9 -0
- data/pdf2json-0.52-source/xpdf/.DS_Store +0 -0
- data/pdf2json-0.52-source/xpdf/Annot.cc +1556 -0
- data/pdf2json-0.52-source/xpdf/Annot.h +142 -0
- data/pdf2json-0.52-source/xpdf/Annot.o +0 -0
- data/pdf2json-0.52-source/xpdf/Array.cc +73 -0
- data/pdf2json-0.52-source/xpdf/Array.h +58 -0
- data/pdf2json-0.52-source/xpdf/Array.o +0 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFont.cc +65 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFont.h +57 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFont.o +0 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFontTables.cc +4284 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFontTables.h +23 -0
- data/pdf2json-0.52-source/xpdf/BuiltinFontTables.o +0 -0
- data/pdf2json-0.52-source/xpdf/CMap.cc +408 -0
- data/pdf2json-0.52-source/xpdf/CMap.h +102 -0
- data/pdf2json-0.52-source/xpdf/CMap.o +0 -0
- data/pdf2json-0.52-source/xpdf/Catalog.cc +374 -0
- data/pdf2json-0.52-source/xpdf/Catalog.h +97 -0
- data/pdf2json-0.52-source/xpdf/Catalog.o +0 -0
- data/pdf2json-0.52-source/xpdf/CharCodeToUnicode.cc +540 -0
- data/pdf2json-0.52-source/xpdf/CharCodeToUnicode.h +117 -0
- data/pdf2json-0.52-source/xpdf/CharCodeToUnicode.o +0 -0
- data/pdf2json-0.52-source/xpdf/CharTypes.h +24 -0
- data/pdf2json-0.52-source/xpdf/CompactFontTables.h +464 -0
- data/pdf2json-0.52-source/xpdf/CoreOutputDev.cc +61 -0
- data/pdf2json-0.52-source/xpdf/CoreOutputDev.h +61 -0
- data/pdf2json-0.52-source/xpdf/Decrypt.cc +776 -0
- data/pdf2json-0.52-source/xpdf/Decrypt.h +95 -0
- data/pdf2json-0.52-source/xpdf/Decrypt.o +0 -0
- data/pdf2json-0.52-source/xpdf/Dict.cc +95 -0
- data/pdf2json-0.52-source/xpdf/Dict.h +77 -0
- data/pdf2json-0.52-source/xpdf/Dict.o +0 -0
- data/pdf2json-0.52-source/xpdf/Error.cc +38 -0
- data/pdf2json-0.52-source/xpdf/Error.h +23 -0
- data/pdf2json-0.52-source/xpdf/Error.o +0 -0
- data/pdf2json-0.52-source/xpdf/ErrorCodes.h +36 -0
- data/pdf2json-0.52-source/xpdf/FontEncodingTables.cc +1824 -0
- data/pdf2json-0.52-source/xpdf/FontEncodingTables.h +20 -0
- data/pdf2json-0.52-source/xpdf/FontEncodingTables.o +0 -0
- data/pdf2json-0.52-source/xpdf/Function.cc +1573 -0
- data/pdf2json-0.52-source/xpdf/Function.h +229 -0
- data/pdf2json-0.52-source/xpdf/Function.o +0 -0
- data/pdf2json-0.52-source/xpdf/Gfx.cc +4187 -0
- data/pdf2json-0.52-source/xpdf/Gfx.h +312 -0
- data/pdf2json-0.52-source/xpdf/Gfx.o +0 -0
- data/pdf2json-0.52-source/xpdf/GfxFont.cc +1568 -0
- data/pdf2json-0.52-source/xpdf/GfxFont.h +320 -0
- data/pdf2json-0.52-source/xpdf/GfxFont.o +0 -0
- data/pdf2json-0.52-source/xpdf/GfxState.cc +4137 -0
- data/pdf2json-0.52-source/xpdf/GfxState.h +1244 -0
- data/pdf2json-0.52-source/xpdf/GfxState.o +0 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.cc +2924 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.cc.old +2908 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.h +466 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.h.old +463 -0
- data/pdf2json-0.52-source/xpdf/GlobalParams.o +0 -0
- data/pdf2json-0.52-source/xpdf/ImageOutputDev.cc +195 -0
- data/pdf2json-0.52-source/xpdf/ImageOutputDev.h +76 -0
- data/pdf2json-0.52-source/xpdf/ImageOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/JArithmeticDecoder.cc +322 -0
- data/pdf2json-0.52-source/xpdf/JArithmeticDecoder.h +109 -0
- data/pdf2json-0.52-source/xpdf/JArithmeticDecoder.o +0 -0
- data/pdf2json-0.52-source/xpdf/JBIG2Stream.cc +3413 -0
- data/pdf2json-0.52-source/xpdf/JBIG2Stream.h +145 -0
- data/pdf2json-0.52-source/xpdf/JBIG2Stream.o +0 -0
- data/pdf2json-0.52-source/xpdf/JPXStream.cc +3144 -0
- data/pdf2json-0.52-source/xpdf/JPXStream.h +351 -0
- data/pdf2json-0.52-source/xpdf/JPXStream.o +0 -0
- data/pdf2json-0.52-source/xpdf/Lexer.cc +485 -0
- data/pdf2json-0.52-source/xpdf/Lexer.h +80 -0
- data/pdf2json-0.52-source/xpdf/Lexer.o +0 -0
- data/pdf2json-0.52-source/xpdf/Link.cc +806 -0
- data/pdf2json-0.52-source/xpdf/Link.cc.old +784 -0
- data/pdf2json-0.52-source/xpdf/Link.h +415 -0
- data/pdf2json-0.52-source/xpdf/Link.h.old +369 -0
- data/pdf2json-0.52-source/xpdf/Link.o +0 -0
- data/pdf2json-0.52-source/xpdf/Makefile +232 -0
- data/pdf2json-0.52-source/xpdf/Makefile.dep +0 -0
- data/pdf2json-0.52-source/xpdf/Makefile.in +232 -0
- data/pdf2json-0.52-source/xpdf/NameToCharCode.cc +116 -0
- data/pdf2json-0.52-source/xpdf/NameToCharCode.h +42 -0
- data/pdf2json-0.52-source/xpdf/NameToCharCode.o +0 -0
- data/pdf2json-0.52-source/xpdf/NameToUnicodeTable.h +1097 -0
- data/pdf2json-0.52-source/xpdf/Object.cc +231 -0
- data/pdf2json-0.52-source/xpdf/Object.h +303 -0
- data/pdf2json-0.52-source/xpdf/Object.o +0 -0
- data/pdf2json-0.52-source/xpdf/Outline.cc +151 -0
- data/pdf2json-0.52-source/xpdf/Outline.h +76 -0
- data/pdf2json-0.52-source/xpdf/Outline.o +0 -0
- data/pdf2json-0.52-source/xpdf/OutputDev.cc +131 -0
- data/pdf2json-0.52-source/xpdf/OutputDev.h +253 -0
- data/pdf2json-0.52-source/xpdf/OutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/PDFCore.cc +2044 -0
- data/pdf2json-0.52-source/xpdf/PDFCore.h +321 -0
- data/pdf2json-0.52-source/xpdf/PDFDoc.cc +404 -0
- data/pdf2json-0.52-source/xpdf/PDFDoc.h +183 -0
- data/pdf2json-0.52-source/xpdf/PDFDoc.o +0 -0
- data/pdf2json-0.52-source/xpdf/PDFDocEncoding.cc +44 -0
- data/pdf2json-0.52-source/xpdf/PDFDocEncoding.h +16 -0
- data/pdf2json-0.52-source/xpdf/PDFDocEncoding.o +0 -0
- data/pdf2json-0.52-source/xpdf/PSOutputDev.cc +6224 -0
- data/pdf2json-0.52-source/xpdf/PSOutputDev.h +395 -0
- data/pdf2json-0.52-source/xpdf/PSOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/PSTokenizer.cc +135 -0
- data/pdf2json-0.52-source/xpdf/PSTokenizer.h +41 -0
- data/pdf2json-0.52-source/xpdf/PSTokenizer.o +0 -0
- data/pdf2json-0.52-source/xpdf/Page.cc +454 -0
- data/pdf2json-0.52-source/xpdf/Page.h +187 -0
- data/pdf2json-0.52-source/xpdf/Page.o +0 -0
- data/pdf2json-0.52-source/xpdf/Parser.cc +227 -0
- data/pdf2json-0.52-source/xpdf/Parser.h +59 -0
- data/pdf2json-0.52-source/xpdf/Parser.o +0 -0
- data/pdf2json-0.52-source/xpdf/PreScanOutputDev.cc +257 -0
- data/pdf2json-0.52-source/xpdf/PreScanOutputDev.h +130 -0
- data/pdf2json-0.52-source/xpdf/PreScanOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/SecurityHandler.cc +390 -0
- data/pdf2json-0.52-source/xpdf/SecurityHandler.h +160 -0
- data/pdf2json-0.52-source/xpdf/SecurityHandler.o +0 -0
- data/pdf2json-0.52-source/xpdf/SplashOutputDev.cc +2845 -0
- data/pdf2json-0.52-source/xpdf/SplashOutputDev.h +247 -0
- data/pdf2json-0.52-source/xpdf/SplashOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/Stream-CCITT.h +459 -0
- data/pdf2json-0.52-source/xpdf/Stream.cc +4627 -0
- data/pdf2json-0.52-source/xpdf/Stream.h +858 -0
- data/pdf2json-0.52-source/xpdf/Stream.o +0 -0
- data/pdf2json-0.52-source/xpdf/TextOutputDev.cc +4090 -0
- data/pdf2json-0.52-source/xpdf/TextOutputDev.h +661 -0
- data/pdf2json-0.52-source/xpdf/TextOutputDev.o +0 -0
- data/pdf2json-0.52-source/xpdf/UTF8.h +56 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.cc +302 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.cc.old +293 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.h +135 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.h.old +123 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMap.o +0 -0
- data/pdf2json-0.52-source/xpdf/UnicodeMapTables.h +361 -0
- data/pdf2json-0.52-source/xpdf/UnicodeTypeTable.cc +949 -0
- data/pdf2json-0.52-source/xpdf/UnicodeTypeTable.h +20 -0
- data/pdf2json-0.52-source/xpdf/UnicodeTypeTable.o +0 -0
- data/pdf2json-0.52-source/xpdf/XPDFApp.cc +447 -0
- data/pdf2json-0.52-source/xpdf/XPDFApp.h +114 -0
- data/pdf2json-0.52-source/xpdf/XPDFCore.cc +1655 -0
- data/pdf2json-0.52-source/xpdf/XPDFCore.h +251 -0
- data/pdf2json-0.52-source/xpdf/XPDFTree.cc +931 -0
- data/pdf2json-0.52-source/xpdf/XPDFTree.h +45 -0
- data/pdf2json-0.52-source/xpdf/XPDFTreeP.h +87 -0
- data/pdf2json-0.52-source/xpdf/XPDFViewer.cc +3488 -0
- data/pdf2json-0.52-source/xpdf/XPDFViewer.h +352 -0
- data/pdf2json-0.52-source/xpdf/XRef.cc +896 -0
- data/pdf2json-0.52-source/xpdf/XRef.h +133 -0
- data/pdf2json-0.52-source/xpdf/XRef.o +0 -0
- data/pdf2json-0.52-source/xpdf/XpdfPluginAPI.cc +262 -0
- data/pdf2json-0.52-source/xpdf/XpdfPluginAPI.h +341 -0
- data/pdf2json-0.52-source/xpdf/XpdfPluginAPI.o +0 -0
- data/pdf2json-0.52-source/xpdf/about-text.h +48 -0
- data/pdf2json-0.52-source/xpdf/about.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/backArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/backArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/config.h +112 -0
- data/pdf2json-0.52-source/xpdf/dblLeftArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/dblLeftArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/dblRightArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/dblRightArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/find.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/findDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/forwardArrow.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/forwardArrowDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/leftArrow.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/leftArrowDis.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/libXpdf.a +0 -0
- data/pdf2json-0.52-source/xpdf/pdffonts +0 -0
- data/pdf2json-0.52-source/xpdf/pdffonts.cc +298 -0
- data/pdf2json-0.52-source/xpdf/pdffonts.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdfimages +0 -0
- data/pdf2json-0.52-source/xpdf/pdfimages.cc +155 -0
- data/pdf2json-0.52-source/xpdf/pdfimages.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdfinfo +0 -0
- data/pdf2json-0.52-source/xpdf/pdfinfo.cc +387 -0
- data/pdf2json-0.52-source/xpdf/pdfinfo.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdftoppm.cc +203 -0
- data/pdf2json-0.52-source/xpdf/pdftops +0 -0
- data/pdf2json-0.52-source/xpdf/pdftops.cc +344 -0
- data/pdf2json-0.52-source/xpdf/pdftops.o +0 -0
- data/pdf2json-0.52-source/xpdf/pdftotext +0 -0
- data/pdf2json-0.52-source/xpdf/pdftotext.cc +333 -0
- data/pdf2json-0.52-source/xpdf/pdftotext.o +0 -0
- data/pdf2json-0.52-source/xpdf/print.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/printDis.xbm +6 -0
- data/pdf2json-0.52-source/xpdf/rightArrow.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/rightArrowDis.xbm +5 -0
- data/pdf2json-0.52-source/xpdf/vms_make.com +129 -0
- data/pdf2json-0.52-source/xpdf/xpdf.cc +344 -0
- data/pdf2json-0.52-source/xpdf/xpdfIcon.xpm +62 -0
- data/pdf2json.gemspec +29 -0
- metadata +518 -0
@@ -0,0 +1,2908 @@
|
|
1
|
+
//========================================================================
|
2
|
+
//
|
3
|
+
// GlobalParams.cc
|
4
|
+
//
|
5
|
+
// Copyright 2001-2003 Glyph & Cog, LLC
|
6
|
+
//
|
7
|
+
//========================================================================
|
8
|
+
|
9
|
+
#include <aconf.h>
|
10
|
+
|
11
|
+
#ifdef USE_GCC_PRAGMAS
|
12
|
+
#pragma implementation
|
13
|
+
#endif
|
14
|
+
|
15
|
+
#include <string.h>
|
16
|
+
#include <stdio.h>
|
17
|
+
#include <ctype.h>
|
18
|
+
#ifdef ENABLE_PLUGINS
|
19
|
+
# ifndef WIN32
|
20
|
+
# include <dlfcn.h>
|
21
|
+
# endif
|
22
|
+
#endif
|
23
|
+
#ifdef WIN32
|
24
|
+
# include <shlobj.h>
|
25
|
+
#endif
|
26
|
+
#if HAVE_PAPER_H
|
27
|
+
#include <paper.h>
|
28
|
+
#endif
|
29
|
+
#include "gmem.h"
|
30
|
+
#include "GString.h"
|
31
|
+
#include "GList.h"
|
32
|
+
#include "GHash.h"
|
33
|
+
#include "gfile.h"
|
34
|
+
#include "Error.h"
|
35
|
+
#include "NameToCharCode.h"
|
36
|
+
#include "CharCodeToUnicode.h"
|
37
|
+
#include "UnicodeMap.h"
|
38
|
+
#include "CMap.h"
|
39
|
+
#include "BuiltinFontTables.h"
|
40
|
+
#include "FontEncodingTables.h"
|
41
|
+
#ifdef ENABLE_PLUGINS
|
42
|
+
# include "XpdfPluginAPI.h"
|
43
|
+
#endif
|
44
|
+
#include "GlobalParams.h"
|
45
|
+
|
46
|
+
#ifdef WIN32
|
47
|
+
# define strcasecmp stricmp
|
48
|
+
#endif
|
49
|
+
|
50
|
+
#if MULTITHREADED
|
51
|
+
# define lockGlobalParams gLockMutex(&mutex)
|
52
|
+
# define lockUnicodeMapCache gLockMutex(&unicodeMapCacheMutex)
|
53
|
+
# define lockCMapCache gLockMutex(&cMapCacheMutex)
|
54
|
+
# define unlockGlobalParams gUnlockMutex(&mutex)
|
55
|
+
# define unlockUnicodeMapCache gUnlockMutex(&unicodeMapCacheMutex)
|
56
|
+
# define unlockCMapCache gUnlockMutex(&cMapCacheMutex)
|
57
|
+
#else
|
58
|
+
# define lockGlobalParams
|
59
|
+
# define lockUnicodeMapCache
|
60
|
+
# define lockCMapCache
|
61
|
+
# define unlockGlobalParams
|
62
|
+
# define unlockUnicodeMapCache
|
63
|
+
# define unlockCMapCache
|
64
|
+
#endif
|
65
|
+
|
66
|
+
#include "NameToUnicodeTable.h"
|
67
|
+
#include "UnicodeMapTables.h"
|
68
|
+
#include "UTF8.h"
|
69
|
+
|
70
|
+
#ifdef ENABLE_PLUGINS
|
71
|
+
# ifdef WIN32
|
72
|
+
extern XpdfPluginVecTable xpdfPluginVecTable;
|
73
|
+
# endif
|
74
|
+
#endif
|
75
|
+
|
76
|
+
//------------------------------------------------------------------------
|
77
|
+
|
78
|
+
#define cidToUnicodeCacheSize 4
|
79
|
+
#define unicodeToUnicodeCacheSize 4
|
80
|
+
|
81
|
+
//------------------------------------------------------------------------
|
82
|
+
|
83
|
+
static struct {
|
84
|
+
char *name;
|
85
|
+
char *t1FileName;
|
86
|
+
char *ttFileName;
|
87
|
+
} displayFontTab[] = {
|
88
|
+
{"Courier", "n022003l.pfb", "cour.ttf"},
|
89
|
+
{"Courier-Bold", "n022004l.pfb", "courbd.ttf"},
|
90
|
+
{"Courier-BoldOblique", "n022024l.pfb", "courbi.ttf"},
|
91
|
+
{"Courier-Oblique", "n022023l.pfb", "couri.ttf"},
|
92
|
+
{"Helvetica", "n019003l.pfb", "arial.ttf"},
|
93
|
+
{"Helvetica-Bold", "n019004l.pfb", "arialbd.ttf"},
|
94
|
+
{"Helvetica-BoldOblique", "n019024l.pfb", "arialbi.ttf"},
|
95
|
+
{"Helvetica-Oblique", "n019023l.pfb", "ariali.ttf"},
|
96
|
+
{"Symbol", "s050000l.pfb", NULL},
|
97
|
+
{"Times-Bold", "n021004l.pfb", "timesbd.ttf"},
|
98
|
+
{"Times-BoldItalic", "n021024l.pfb", "timesbi.ttf"},
|
99
|
+
{"Times-Italic", "n021023l.pfb", "timesi.ttf"},
|
100
|
+
{"Times-Roman", "n021003l.pfb", "times.ttf"},
|
101
|
+
{"ZapfDingbats", "d050000l.pfb", NULL},
|
102
|
+
{NULL}
|
103
|
+
};
|
104
|
+
|
105
|
+
#ifdef WIN32
|
106
|
+
static char *displayFontDirs[] = {
|
107
|
+
"c:/windows/fonts",
|
108
|
+
"c:/winnt/fonts",
|
109
|
+
NULL
|
110
|
+
};
|
111
|
+
#else
|
112
|
+
static char *displayFontDirs[] = {
|
113
|
+
"/usr/share/ghostscript/fonts",
|
114
|
+
"/usr/local/share/ghostscript/fonts",
|
115
|
+
"/usr/share/fonts/default/Type1",
|
116
|
+
"/usr/share/fonts/default/ghostscript",
|
117
|
+
"/usr/share/fonts/type1/gsfonts",
|
118
|
+
NULL
|
119
|
+
};
|
120
|
+
#endif
|
121
|
+
|
122
|
+
//------------------------------------------------------------------------
|
123
|
+
|
124
|
+
GlobalParams *globalParams = NULL;
|
125
|
+
|
126
|
+
//------------------------------------------------------------------------
|
127
|
+
// DisplayFontParam
|
128
|
+
//------------------------------------------------------------------------
|
129
|
+
|
130
|
+
DisplayFontParam::DisplayFontParam(GString *nameA,
|
131
|
+
DisplayFontParamKind kindA) {
|
132
|
+
name = nameA;
|
133
|
+
kind = kindA;
|
134
|
+
switch (kind) {
|
135
|
+
case displayFontT1:
|
136
|
+
t1.fileName = NULL;
|
137
|
+
break;
|
138
|
+
case displayFontTT:
|
139
|
+
tt.fileName = NULL;
|
140
|
+
break;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
DisplayFontParam::~DisplayFontParam() {
|
145
|
+
delete name;
|
146
|
+
switch (kind) {
|
147
|
+
case displayFontT1:
|
148
|
+
if (t1.fileName) {
|
149
|
+
delete t1.fileName;
|
150
|
+
}
|
151
|
+
break;
|
152
|
+
case displayFontTT:
|
153
|
+
if (tt.fileName) {
|
154
|
+
delete tt.fileName;
|
155
|
+
}
|
156
|
+
break;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
#ifdef WIN32
|
161
|
+
|
162
|
+
//------------------------------------------------------------------------
|
163
|
+
// WinFontInfo
|
164
|
+
//------------------------------------------------------------------------
|
165
|
+
|
166
|
+
class WinFontInfo: public DisplayFontParam {
|
167
|
+
public:
|
168
|
+
|
169
|
+
GBool bold, italic;
|
170
|
+
|
171
|
+
static WinFontInfo *make(GString *nameA, GBool boldA, GBool italicA,
|
172
|
+
HKEY regKey, char *winFontDir);
|
173
|
+
WinFontInfo(GString *nameA, GBool boldA, GBool italicA,
|
174
|
+
GString *fileNameA);
|
175
|
+
virtual ~WinFontInfo();
|
176
|
+
GBool equals(WinFontInfo *fi);
|
177
|
+
};
|
178
|
+
|
179
|
+
WinFontInfo *WinFontInfo::make(GString *nameA, GBool boldA, GBool italicA,
|
180
|
+
HKEY regKey, char *winFontDir) {
|
181
|
+
GString *regName;
|
182
|
+
GString *fileNameA;
|
183
|
+
char buf[MAX_PATH];
|
184
|
+
DWORD n;
|
185
|
+
char c;
|
186
|
+
int i;
|
187
|
+
|
188
|
+
//----- find the font file
|
189
|
+
fileNameA = NULL;
|
190
|
+
regName = nameA->copy();
|
191
|
+
if (boldA) {
|
192
|
+
regName->append(" Bold");
|
193
|
+
}
|
194
|
+
if (italicA) {
|
195
|
+
regName->append(" Italic");
|
196
|
+
}
|
197
|
+
regName->append(" (TrueType)");
|
198
|
+
n = sizeof(buf);
|
199
|
+
if (RegQueryValueEx(regKey, regName->getCString(), NULL, NULL,
|
200
|
+
(LPBYTE)buf, &n) == ERROR_SUCCESS) {
|
201
|
+
fileNameA = new GString(winFontDir);
|
202
|
+
fileNameA->append('\\')->append(buf);
|
203
|
+
}
|
204
|
+
delete regName;
|
205
|
+
if (!fileNameA) {
|
206
|
+
delete nameA;
|
207
|
+
return NULL;
|
208
|
+
}
|
209
|
+
|
210
|
+
//----- normalize the font name
|
211
|
+
i = 0;
|
212
|
+
while (i < nameA->getLength()) {
|
213
|
+
c = nameA->getChar(i);
|
214
|
+
if (c == ' ' || c == ',' || c == '-') {
|
215
|
+
nameA->del(i);
|
216
|
+
} else {
|
217
|
+
++i;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
return new WinFontInfo(nameA, boldA, italicA, fileNameA);
|
222
|
+
}
|
223
|
+
|
224
|
+
WinFontInfo::WinFontInfo(GString *nameA, GBool boldA, GBool italicA,
|
225
|
+
GString *fileNameA):
|
226
|
+
DisplayFontParam(nameA, displayFontTT)
|
227
|
+
{
|
228
|
+
bold = boldA;
|
229
|
+
italic = italicA;
|
230
|
+
tt.fileName = fileNameA;
|
231
|
+
}
|
232
|
+
|
233
|
+
WinFontInfo::~WinFontInfo() {
|
234
|
+
}
|
235
|
+
|
236
|
+
GBool WinFontInfo::equals(WinFontInfo *fi) {
|
237
|
+
return !name->cmp(fi->name) && bold == fi->bold && italic == fi->italic;
|
238
|
+
}
|
239
|
+
|
240
|
+
//------------------------------------------------------------------------
|
241
|
+
// WinFontList
|
242
|
+
//------------------------------------------------------------------------
|
243
|
+
|
244
|
+
class WinFontList {
|
245
|
+
public:
|
246
|
+
|
247
|
+
WinFontList(char *winFontDirA);
|
248
|
+
~WinFontList();
|
249
|
+
WinFontInfo *find(GString *font);
|
250
|
+
|
251
|
+
private:
|
252
|
+
|
253
|
+
void add(WinFontInfo *fi);
|
254
|
+
static int CALLBACK enumFunc1(CONST LOGFONT *font,
|
255
|
+
CONST TEXTMETRIC *metrics,
|
256
|
+
DWORD type, LPARAM data);
|
257
|
+
static int CALLBACK enumFunc2(CONST LOGFONT *font,
|
258
|
+
CONST TEXTMETRIC *metrics,
|
259
|
+
DWORD type, LPARAM data);
|
260
|
+
|
261
|
+
GList *fonts; // [WinFontInfo]
|
262
|
+
HDC dc; // (only used during enumeration)
|
263
|
+
HKEY regKey; // (only used during enumeration)
|
264
|
+
char *winFontDir; // (only used during enumeration)
|
265
|
+
};
|
266
|
+
|
267
|
+
WinFontList::WinFontList(char *winFontDirA) {
|
268
|
+
OSVERSIONINFO version;
|
269
|
+
char *path;
|
270
|
+
|
271
|
+
fonts = new GList();
|
272
|
+
dc = GetDC(NULL);
|
273
|
+
winFontDir = winFontDirA;
|
274
|
+
version.dwOSVersionInfoSize = sizeof(version);
|
275
|
+
GetVersionEx(&version);
|
276
|
+
if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
|
277
|
+
path = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\\";
|
278
|
+
} else {
|
279
|
+
path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts\\";
|
280
|
+
}
|
281
|
+
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, path, 0,
|
282
|
+
KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS,
|
283
|
+
®Key) == ERROR_SUCCESS) {
|
284
|
+
EnumFonts(dc, NULL, &WinFontList::enumFunc1, (LPARAM)this);
|
285
|
+
RegCloseKey(regKey);
|
286
|
+
}
|
287
|
+
ReleaseDC(NULL, dc);
|
288
|
+
}
|
289
|
+
|
290
|
+
WinFontList::~WinFontList() {
|
291
|
+
deleteGList(fonts, WinFontInfo);
|
292
|
+
}
|
293
|
+
|
294
|
+
void WinFontList::add(WinFontInfo *fi) {
|
295
|
+
int i;
|
296
|
+
|
297
|
+
for (i = 0; i < fonts->getLength(); ++i) {
|
298
|
+
if (((WinFontInfo *)fonts->get(i))->equals(fi)) {
|
299
|
+
delete fi;
|
300
|
+
return;
|
301
|
+
}
|
302
|
+
}
|
303
|
+
fonts->append(fi);
|
304
|
+
}
|
305
|
+
|
306
|
+
WinFontInfo *WinFontList::find(GString *font) {
|
307
|
+
GString *name;
|
308
|
+
GBool bold, italic;
|
309
|
+
WinFontInfo *fi;
|
310
|
+
char c;
|
311
|
+
int n, i;
|
312
|
+
|
313
|
+
name = font->copy();
|
314
|
+
|
315
|
+
// remove space, comma, dash chars
|
316
|
+
i = 0;
|
317
|
+
while (i < name->getLength()) {
|
318
|
+
c = name->getChar(i);
|
319
|
+
if (c == ' ' || c == ',' || c == '-') {
|
320
|
+
name->del(i);
|
321
|
+
} else {
|
322
|
+
++i;
|
323
|
+
}
|
324
|
+
}
|
325
|
+
n = name->getLength();
|
326
|
+
|
327
|
+
// remove trailing "MT" (Foo-MT, Foo-BoldMT, etc.)
|
328
|
+
if (!strcmp(name->getCString() + n - 2, "MT")) {
|
329
|
+
name->del(n - 2, 2);
|
330
|
+
n -= 2;
|
331
|
+
}
|
332
|
+
|
333
|
+
// look for "Italic"
|
334
|
+
if (!strcmp(name->getCString() + n - 6, "Italic")) {
|
335
|
+
name->del(n - 6, 6);
|
336
|
+
italic = gTrue;
|
337
|
+
n -= 6;
|
338
|
+
} else {
|
339
|
+
italic = gFalse;
|
340
|
+
}
|
341
|
+
|
342
|
+
// look for "Bold"
|
343
|
+
if (!strcmp(name->getCString() + n - 4, "Bold")) {
|
344
|
+
name->del(n - 4, 4);
|
345
|
+
bold = gTrue;
|
346
|
+
n -= 4;
|
347
|
+
} else {
|
348
|
+
bold = gFalse;
|
349
|
+
}
|
350
|
+
|
351
|
+
// remove trailing "MT" (FooMT-Bold, etc.)
|
352
|
+
if (!strcmp(name->getCString() + n - 2, "MT")) {
|
353
|
+
name->del(n - 2, 2);
|
354
|
+
n -= 2;
|
355
|
+
}
|
356
|
+
|
357
|
+
// remove trailing "PS"
|
358
|
+
if (!strcmp(name->getCString() + n - 2, "PS")) {
|
359
|
+
name->del(n - 2, 2);
|
360
|
+
n -= 2;
|
361
|
+
}
|
362
|
+
|
363
|
+
// search for the font
|
364
|
+
fi = NULL;
|
365
|
+
for (i = 0; i < fonts->getLength(); ++i) {
|
366
|
+
fi = (WinFontInfo *)fonts->get(i);
|
367
|
+
if (!fi->name->cmp(name) && fi->bold == bold && fi->italic == italic) {
|
368
|
+
break;
|
369
|
+
}
|
370
|
+
fi = NULL;
|
371
|
+
}
|
372
|
+
|
373
|
+
delete name;
|
374
|
+
return fi;
|
375
|
+
}
|
376
|
+
|
377
|
+
int CALLBACK WinFontList::enumFunc1(CONST LOGFONT *font,
|
378
|
+
CONST TEXTMETRIC *metrics,
|
379
|
+
DWORD type, LPARAM data) {
|
380
|
+
WinFontList *fl = (WinFontList *)data;
|
381
|
+
|
382
|
+
EnumFonts(fl->dc, font->lfFaceName, &WinFontList::enumFunc2, (LPARAM)fl);
|
383
|
+
return 1;
|
384
|
+
}
|
385
|
+
|
386
|
+
int CALLBACK WinFontList::enumFunc2(CONST LOGFONT *font,
|
387
|
+
CONST TEXTMETRIC *metrics,
|
388
|
+
DWORD type, LPARAM data) {
|
389
|
+
WinFontList *fl = (WinFontList *)data;
|
390
|
+
WinFontInfo *fi;
|
391
|
+
|
392
|
+
if (type & TRUETYPE_FONTTYPE) {
|
393
|
+
if ((fi = WinFontInfo::make(new GString(font->lfFaceName),
|
394
|
+
font->lfWeight >= 600,
|
395
|
+
font->lfItalic ? gTrue : gFalse,
|
396
|
+
fl->regKey, fl->winFontDir))) {
|
397
|
+
fl->add(fi);
|
398
|
+
}
|
399
|
+
}
|
400
|
+
return 1;
|
401
|
+
}
|
402
|
+
|
403
|
+
#endif // WIN32
|
404
|
+
|
405
|
+
//------------------------------------------------------------------------
|
406
|
+
// PSFontParam
|
407
|
+
//------------------------------------------------------------------------
|
408
|
+
|
409
|
+
PSFontParam::PSFontParam(GString *pdfFontNameA, int wModeA,
|
410
|
+
GString *psFontNameA, GString *encodingA) {
|
411
|
+
pdfFontName = pdfFontNameA;
|
412
|
+
wMode = wModeA;
|
413
|
+
psFontName = psFontNameA;
|
414
|
+
encoding = encodingA;
|
415
|
+
}
|
416
|
+
|
417
|
+
PSFontParam::~PSFontParam() {
|
418
|
+
delete pdfFontName;
|
419
|
+
delete psFontName;
|
420
|
+
if (encoding) {
|
421
|
+
delete encoding;
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
//------------------------------------------------------------------------
|
426
|
+
// KeyBinding
|
427
|
+
//------------------------------------------------------------------------
|
428
|
+
|
429
|
+
KeyBinding::KeyBinding(int codeA, int modsA, int contextA, char *cmd0) {
|
430
|
+
code = codeA;
|
431
|
+
mods = modsA;
|
432
|
+
context = contextA;
|
433
|
+
cmds = new GList();
|
434
|
+
cmds->append(new GString(cmd0));
|
435
|
+
}
|
436
|
+
|
437
|
+
KeyBinding::KeyBinding(int codeA, int modsA, int contextA,
|
438
|
+
char *cmd0, char *cmd1) {
|
439
|
+
code = codeA;
|
440
|
+
mods = modsA;
|
441
|
+
context = contextA;
|
442
|
+
cmds = new GList();
|
443
|
+
cmds->append(new GString(cmd0));
|
444
|
+
cmds->append(new GString(cmd1));
|
445
|
+
}
|
446
|
+
|
447
|
+
KeyBinding::KeyBinding(int codeA, int modsA, int contextA, GList *cmdsA) {
|
448
|
+
code = codeA;
|
449
|
+
mods = modsA;
|
450
|
+
context = contextA;
|
451
|
+
cmds = cmdsA;
|
452
|
+
}
|
453
|
+
|
454
|
+
KeyBinding::~KeyBinding() {
|
455
|
+
deleteGList(cmds, GString);
|
456
|
+
}
|
457
|
+
|
458
|
+
#ifdef ENABLE_PLUGINS
|
459
|
+
//------------------------------------------------------------------------
|
460
|
+
// Plugin
|
461
|
+
//------------------------------------------------------------------------
|
462
|
+
|
463
|
+
class Plugin {
|
464
|
+
public:
|
465
|
+
|
466
|
+
static Plugin *load(char *type, char *name);
|
467
|
+
~Plugin();
|
468
|
+
|
469
|
+
private:
|
470
|
+
|
471
|
+
#ifdef WIN32
|
472
|
+
Plugin(HMODULE libA);
|
473
|
+
HMODULE lib;
|
474
|
+
#else
|
475
|
+
Plugin(void *dlA);
|
476
|
+
void *dl;
|
477
|
+
#endif
|
478
|
+
};
|
479
|
+
|
480
|
+
Plugin *Plugin::load(char *type, char *name) {
|
481
|
+
GString *path;
|
482
|
+
Plugin *plugin;
|
483
|
+
XpdfPluginVecTable *vt;
|
484
|
+
XpdfBool (*xpdfInitPlugin)(void);
|
485
|
+
#ifdef WIN32
|
486
|
+
HMODULE libA;
|
487
|
+
#else
|
488
|
+
void *dlA;
|
489
|
+
#endif
|
490
|
+
|
491
|
+
path = globalParams->getBaseDir();
|
492
|
+
appendToPath(path, "plugins");
|
493
|
+
appendToPath(path, type);
|
494
|
+
appendToPath(path, name);
|
495
|
+
|
496
|
+
#ifdef WIN32
|
497
|
+
path->append(".dll");
|
498
|
+
if (!(libA = LoadLibrary(path->getCString()))) {
|
499
|
+
error(-1, "Failed to load plugin '%s'",
|
500
|
+
path->getCString());
|
501
|
+
goto err1;
|
502
|
+
}
|
503
|
+
if (!(vt = (XpdfPluginVecTable *)
|
504
|
+
GetProcAddress(libA, "xpdfPluginVecTable"))) {
|
505
|
+
error(-1, "Failed to find xpdfPluginVecTable in plugin '%s'",
|
506
|
+
path->getCString());
|
507
|
+
goto err2;
|
508
|
+
}
|
509
|
+
#else
|
510
|
+
//~ need to deal with other extensions here
|
511
|
+
path->append(".so");
|
512
|
+
if (!(dlA = dlopen(path->getCString(), RTLD_NOW))) {
|
513
|
+
error(-1, "Failed to load plugin '%s': %s",
|
514
|
+
path->getCString(), dlerror());
|
515
|
+
goto err1;
|
516
|
+
}
|
517
|
+
if (!(vt = (XpdfPluginVecTable *)dlsym(dlA, "xpdfPluginVecTable"))) {
|
518
|
+
error(-1, "Failed to find xpdfPluginVecTable in plugin '%s'",
|
519
|
+
path->getCString());
|
520
|
+
goto err2;
|
521
|
+
}
|
522
|
+
#endif
|
523
|
+
|
524
|
+
if (vt->version != xpdfPluginVecTable.version) {
|
525
|
+
error(-1, "Plugin '%s' is wrong version", path->getCString());
|
526
|
+
goto err2;
|
527
|
+
}
|
528
|
+
memcpy(vt, &xpdfPluginVecTable, sizeof(xpdfPluginVecTable));
|
529
|
+
|
530
|
+
#ifdef WIN32
|
531
|
+
if (!(xpdfInitPlugin = (XpdfBool (*)(void))
|
532
|
+
GetProcAddress(libA, "xpdfInitPlugin"))) {
|
533
|
+
error(-1, "Failed to find xpdfInitPlugin in plugin '%s'",
|
534
|
+
path->getCString());
|
535
|
+
goto err2;
|
536
|
+
}
|
537
|
+
#else
|
538
|
+
if (!(xpdfInitPlugin = (XpdfBool (*)(void))dlsym(dlA, "xpdfInitPlugin"))) {
|
539
|
+
error(-1, "Failed to find xpdfInitPlugin in plugin '%s'",
|
540
|
+
path->getCString());
|
541
|
+
goto err2;
|
542
|
+
}
|
543
|
+
#endif
|
544
|
+
|
545
|
+
if (!(*xpdfInitPlugin)()) {
|
546
|
+
error(-1, "Initialization of plugin '%s' failed",
|
547
|
+
path->getCString());
|
548
|
+
goto err2;
|
549
|
+
}
|
550
|
+
|
551
|
+
#ifdef WIN32
|
552
|
+
plugin = new Plugin(libA);
|
553
|
+
#else
|
554
|
+
plugin = new Plugin(dlA);
|
555
|
+
#endif
|
556
|
+
|
557
|
+
delete path;
|
558
|
+
return plugin;
|
559
|
+
|
560
|
+
err2:
|
561
|
+
#ifdef WIN32
|
562
|
+
FreeLibrary(libA);
|
563
|
+
#else
|
564
|
+
dlclose(dlA);
|
565
|
+
#endif
|
566
|
+
err1:
|
567
|
+
delete path;
|
568
|
+
return NULL;
|
569
|
+
}
|
570
|
+
|
571
|
+
#ifdef WIN32
|
572
|
+
Plugin::Plugin(HMODULE libA) {
|
573
|
+
lib = libA;
|
574
|
+
}
|
575
|
+
#else
|
576
|
+
Plugin::Plugin(void *dlA) {
|
577
|
+
dl = dlA;
|
578
|
+
}
|
579
|
+
#endif
|
580
|
+
|
581
|
+
Plugin::~Plugin() {
|
582
|
+
void (*xpdfFreePlugin)(void);
|
583
|
+
|
584
|
+
#ifdef WIN32
|
585
|
+
if ((xpdfFreePlugin = (void (*)(void))
|
586
|
+
GetProcAddress(lib, "xpdfFreePlugin"))) {
|
587
|
+
(*xpdfFreePlugin)();
|
588
|
+
}
|
589
|
+
FreeLibrary(lib);
|
590
|
+
#else
|
591
|
+
if ((xpdfFreePlugin = (void (*)(void))dlsym(dl, "xpdfFreePlugin"))) {
|
592
|
+
(*xpdfFreePlugin)();
|
593
|
+
}
|
594
|
+
dlclose(dl);
|
595
|
+
#endif
|
596
|
+
}
|
597
|
+
|
598
|
+
#endif // ENABLE_PLUGINS
|
599
|
+
|
600
|
+
//------------------------------------------------------------------------
|
601
|
+
// parsing
|
602
|
+
//------------------------------------------------------------------------
|
603
|
+
|
604
|
+
GlobalParams::GlobalParams(char *cfgFileName) {
|
605
|
+
UnicodeMap *map;
|
606
|
+
GString *fileName;
|
607
|
+
FILE *f;
|
608
|
+
int i;
|
609
|
+
|
610
|
+
#if MULTITHREADED
|
611
|
+
gInitMutex(&mutex);
|
612
|
+
gInitMutex(&unicodeMapCacheMutex);
|
613
|
+
gInitMutex(&cMapCacheMutex);
|
614
|
+
#endif
|
615
|
+
|
616
|
+
initBuiltinFontTables();
|
617
|
+
|
618
|
+
// scan the encoding in reverse because we want the lowest-numbered
|
619
|
+
// index for each char name ('space' is encoded twice)
|
620
|
+
macRomanReverseMap = new NameToCharCode();
|
621
|
+
for (i = 255; i >= 0; --i) {
|
622
|
+
if (macRomanEncoding[i]) {
|
623
|
+
macRomanReverseMap->add(macRomanEncoding[i], (CharCode)i);
|
624
|
+
}
|
625
|
+
}
|
626
|
+
|
627
|
+
#ifdef WIN32
|
628
|
+
// baseDir will be set by a call to setBaseDir
|
629
|
+
baseDir = new GString();
|
630
|
+
#else
|
631
|
+
baseDir = appendToPath(getHomeDir(), ".xpdf");
|
632
|
+
#endif
|
633
|
+
nameToUnicode = new NameToCharCode();
|
634
|
+
cidToUnicodes = new GHash(gTrue);
|
635
|
+
unicodeToUnicodes = new GHash(gTrue);
|
636
|
+
residentUnicodeMaps = new GHash();
|
637
|
+
unicodeMaps = new GHash(gTrue);
|
638
|
+
cMapDirs = new GHash(gTrue);
|
639
|
+
toUnicodeDirs = new GList();
|
640
|
+
displayFonts = new GHash();
|
641
|
+
displayCIDFonts = new GHash();
|
642
|
+
displayNamedCIDFonts = new GHash();
|
643
|
+
#if HAVE_PAPER_H
|
644
|
+
char *paperName;
|
645
|
+
const struct paper *paperType;
|
646
|
+
paperinit();
|
647
|
+
if ((paperName = systempapername())) {
|
648
|
+
paperType = paperinfo(paperName);
|
649
|
+
psPaperWidth = (int)paperpswidth(paperType);
|
650
|
+
psPaperHeight = (int)paperpsheight(paperType);
|
651
|
+
} else {
|
652
|
+
error(-1, "No paper information available - using defaults");
|
653
|
+
psPaperWidth = defPaperWidth;
|
654
|
+
psPaperHeight = defPaperHeight;
|
655
|
+
}
|
656
|
+
paperdone();
|
657
|
+
#else
|
658
|
+
psPaperWidth = defPaperWidth;
|
659
|
+
psPaperHeight = defPaperHeight;
|
660
|
+
#endif
|
661
|
+
psImageableLLX = psImageableLLY = 0;
|
662
|
+
psImageableURX = psPaperWidth;
|
663
|
+
psImageableURY = psPaperHeight;
|
664
|
+
psCrop = gTrue;
|
665
|
+
psExpandSmaller = gFalse;
|
666
|
+
psShrinkLarger = gTrue;
|
667
|
+
psCenter = gTrue;
|
668
|
+
psDuplex = gFalse;
|
669
|
+
psLevel = psLevel2;
|
670
|
+
psFile = NULL;
|
671
|
+
psFonts = new GHash();
|
672
|
+
psNamedFonts16 = new GList();
|
673
|
+
psFonts16 = new GList();
|
674
|
+
psEmbedType1 = gTrue;
|
675
|
+
psEmbedTrueType = gTrue;
|
676
|
+
psEmbedCIDPostScript = gTrue;
|
677
|
+
psEmbedCIDTrueType = gTrue;
|
678
|
+
psPreload = gFalse;
|
679
|
+
psOPI = gFalse;
|
680
|
+
psASCIIHex = gFalse;
|
681
|
+
textEncoding = new GString("Latin1");
|
682
|
+
#if defined(WIN32)
|
683
|
+
textEOL = eolDOS;
|
684
|
+
#elif defined(MACOS)
|
685
|
+
textEOL = eolMac;
|
686
|
+
#else
|
687
|
+
textEOL = eolUnix;
|
688
|
+
#endif
|
689
|
+
textPageBreaks = gTrue;
|
690
|
+
textKeepTinyChars = gFalse;
|
691
|
+
fontDirs = new GList();
|
692
|
+
initialZoom = new GString("125");
|
693
|
+
continuousView = gFalse;
|
694
|
+
enableT1lib = gTrue;
|
695
|
+
enableFreeType = gTrue;
|
696
|
+
antialias = gTrue;
|
697
|
+
vectorAntialias = gTrue;
|
698
|
+
strokeAdjust = gTrue;
|
699
|
+
screenType = screenUnset;
|
700
|
+
screenSize = -1;
|
701
|
+
screenDotRadius = -1;
|
702
|
+
screenGamma = 1.0;
|
703
|
+
screenBlackThreshold = 0.0;
|
704
|
+
screenWhiteThreshold = 1.0;
|
705
|
+
urlCommand = NULL;
|
706
|
+
movieCommand = NULL;
|
707
|
+
mapNumericCharNames = gTrue;
|
708
|
+
mapUnknownCharNames = gFalse;
|
709
|
+
createDefaultKeyBindings();
|
710
|
+
printCommands = gFalse;
|
711
|
+
errQuiet = gFalse;
|
712
|
+
|
713
|
+
cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize);
|
714
|
+
unicodeToUnicodeCache =
|
715
|
+
new CharCodeToUnicodeCache(unicodeToUnicodeCacheSize);
|
716
|
+
unicodeMapCache = new UnicodeMapCache();
|
717
|
+
cMapCache = new CMapCache();
|
718
|
+
|
719
|
+
#ifdef WIN32
|
720
|
+
winFontList = NULL;
|
721
|
+
#endif
|
722
|
+
|
723
|
+
#ifdef ENABLE_PLUGINS
|
724
|
+
plugins = new GList();
|
725
|
+
securityHandlers = new GList();
|
726
|
+
#endif
|
727
|
+
|
728
|
+
// set up the initial nameToUnicode table
|
729
|
+
for (i = 0; nameToUnicodeTab[i].name; ++i) {
|
730
|
+
nameToUnicode->add(nameToUnicodeTab[i].name, nameToUnicodeTab[i].u);
|
731
|
+
}
|
732
|
+
|
733
|
+
// set up the residentUnicodeMaps table
|
734
|
+
map = new UnicodeMap("Latin1", gFalse,
|
735
|
+
latin1UnicodeMapRanges, latin1UnicodeMapLen);
|
736
|
+
residentUnicodeMaps->add(map->getEncodingName(), map);
|
737
|
+
map = new UnicodeMap("ASCII7", gFalse,
|
738
|
+
ascii7UnicodeMapRanges, ascii7UnicodeMapLen);
|
739
|
+
residentUnicodeMaps->add(map->getEncodingName(), map);
|
740
|
+
map = new UnicodeMap("Symbol", gFalse,
|
741
|
+
symbolUnicodeMapRanges, symbolUnicodeMapLen);
|
742
|
+
residentUnicodeMaps->add(map->getEncodingName(), map);
|
743
|
+
map = new UnicodeMap("ZapfDingbats", gFalse, zapfDingbatsUnicodeMapRanges,
|
744
|
+
zapfDingbatsUnicodeMapLen);
|
745
|
+
residentUnicodeMaps->add(map->getEncodingName(), map);
|
746
|
+
map = new UnicodeMap("UTF-8", gTrue, &mapUTF8);
|
747
|
+
residentUnicodeMaps->add(map->getEncodingName(), map);
|
748
|
+
map = new UnicodeMap("UCS-2", gTrue, &mapUCS2);
|
749
|
+
residentUnicodeMaps->add(map->getEncodingName(), map);
|
750
|
+
|
751
|
+
// look for a user config file, then a system-wide config file
|
752
|
+
f = NULL;
|
753
|
+
fileName = NULL;
|
754
|
+
if (cfgFileName && cfgFileName[0]) {
|
755
|
+
fileName = new GString(cfgFileName);
|
756
|
+
if (!(f = fopen(fileName->getCString(), "r"))) {
|
757
|
+
delete fileName;
|
758
|
+
}
|
759
|
+
}
|
760
|
+
if (!f) {
|
761
|
+
fileName = appendToPath(getHomeDir(), xpdfUserConfigFile);
|
762
|
+
if (!(f = fopen(fileName->getCString(), "r"))) {
|
763
|
+
delete fileName;
|
764
|
+
}
|
765
|
+
}
|
766
|
+
if (!f) {
|
767
|
+
#if defined(WIN32) && !defined(__CYGWIN32__)
|
768
|
+
char buf[512];
|
769
|
+
i = GetModuleFileName(NULL, buf, sizeof(buf));
|
770
|
+
if (i <= 0 || i >= sizeof(buf)) {
|
771
|
+
// error or path too long for buffer - just use the current dir
|
772
|
+
buf[0] = '\0';
|
773
|
+
}
|
774
|
+
fileName = grabPath(buf);
|
775
|
+
appendToPath(fileName, xpdfSysConfigFile);
|
776
|
+
#else
|
777
|
+
fileName = new GString(xpdfSysConfigFile);
|
778
|
+
#endif
|
779
|
+
if (!(f = fopen(fileName->getCString(), "r"))) {
|
780
|
+
delete fileName;
|
781
|
+
}
|
782
|
+
}
|
783
|
+
if (f) {
|
784
|
+
parseFile(fileName, f);
|
785
|
+
delete fileName;
|
786
|
+
fclose(f);
|
787
|
+
}
|
788
|
+
}
|
789
|
+
|
790
|
+
void GlobalParams::createDefaultKeyBindings() {
|
791
|
+
keyBindings = new GList();
|
792
|
+
|
793
|
+
//----- mouse buttons
|
794
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress1, xpdfKeyModNone,
|
795
|
+
xpdfKeyContextAny, "startSelection"));
|
796
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeMouseRelease1, xpdfKeyModNone,
|
797
|
+
xpdfKeyContextAny, "endSelection",
|
798
|
+
"followLinkNoSel"));
|
799
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress2, xpdfKeyModNone,
|
800
|
+
xpdfKeyContextAny, "startPan"));
|
801
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeMouseRelease2, xpdfKeyModNone,
|
802
|
+
xpdfKeyContextAny, "endPan"));
|
803
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress3, xpdfKeyModNone,
|
804
|
+
xpdfKeyContextAny, "postPopupMenu"));
|
805
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress4, xpdfKeyModNone,
|
806
|
+
xpdfKeyContextAny,
|
807
|
+
"scrollUpPrevPage(16)"));
|
808
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress5, xpdfKeyModNone,
|
809
|
+
xpdfKeyContextAny,
|
810
|
+
"scrollDownNextPage(16)"));
|
811
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress6, xpdfKeyModNone,
|
812
|
+
xpdfKeyContextAny, "scrollLeft(16)"));
|
813
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeMousePress7, xpdfKeyModNone,
|
814
|
+
xpdfKeyContextAny, "scrollRight(16)"));
|
815
|
+
|
816
|
+
//----- keys
|
817
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModCtrl,
|
818
|
+
xpdfKeyContextAny, "gotoPage(1)"));
|
819
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeHome, xpdfKeyModNone,
|
820
|
+
xpdfKeyContextAny, "scrollToTopLeft"));
|
821
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModCtrl,
|
822
|
+
xpdfKeyContextAny, "gotoLastPage"));
|
823
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeEnd, xpdfKeyModNone,
|
824
|
+
xpdfKeyContextAny,
|
825
|
+
"scrollToBottomRight"));
|
826
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodePgUp, xpdfKeyModNone,
|
827
|
+
xpdfKeyContextAny, "pageUp"));
|
828
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeBackspace, xpdfKeyModNone,
|
829
|
+
xpdfKeyContextAny, "pageUp"));
|
830
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeDelete, xpdfKeyModNone,
|
831
|
+
xpdfKeyContextAny, "pageUp"));
|
832
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodePgDn, xpdfKeyModNone,
|
833
|
+
xpdfKeyContextAny, "pageDown"));
|
834
|
+
keyBindings->append(new KeyBinding(' ', xpdfKeyModNone,
|
835
|
+
xpdfKeyContextAny, "pageDown"));
|
836
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeLeft, xpdfKeyModNone,
|
837
|
+
xpdfKeyContextAny, "scrollLeft(16)"));
|
838
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeRight, xpdfKeyModNone,
|
839
|
+
xpdfKeyContextAny, "scrollRight(16)"));
|
840
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeUp, xpdfKeyModNone,
|
841
|
+
xpdfKeyContextAny, "scrollUp(16)"));
|
842
|
+
keyBindings->append(new KeyBinding(xpdfKeyCodeDown, xpdfKeyModNone,
|
843
|
+
xpdfKeyContextAny, "scrollDown(16)"));
|
844
|
+
keyBindings->append(new KeyBinding('o', xpdfKeyModNone,
|
845
|
+
xpdfKeyContextAny, "open"));
|
846
|
+
keyBindings->append(new KeyBinding('O', xpdfKeyModNone,
|
847
|
+
xpdfKeyContextAny, "open"));
|
848
|
+
keyBindings->append(new KeyBinding('r', xpdfKeyModNone,
|
849
|
+
xpdfKeyContextAny, "reload"));
|
850
|
+
keyBindings->append(new KeyBinding('R', xpdfKeyModNone,
|
851
|
+
xpdfKeyContextAny, "reload"));
|
852
|
+
keyBindings->append(new KeyBinding('f', xpdfKeyModNone,
|
853
|
+
xpdfKeyContextAny, "find"));
|
854
|
+
keyBindings->append(new KeyBinding('F', xpdfKeyModNone,
|
855
|
+
xpdfKeyContextAny, "find"));
|
856
|
+
keyBindings->append(new KeyBinding('f', xpdfKeyModCtrl,
|
857
|
+
xpdfKeyContextAny, "find"));
|
858
|
+
keyBindings->append(new KeyBinding('g', xpdfKeyModCtrl,
|
859
|
+
xpdfKeyContextAny, "findNext"));
|
860
|
+
keyBindings->append(new KeyBinding('p', xpdfKeyModCtrl,
|
861
|
+
xpdfKeyContextAny, "print"));
|
862
|
+
keyBindings->append(new KeyBinding('n', xpdfKeyModNone,
|
863
|
+
xpdfKeyContextScrLockOff, "nextPage"));
|
864
|
+
keyBindings->append(new KeyBinding('N', xpdfKeyModNone,
|
865
|
+
xpdfKeyContextScrLockOff, "nextPage"));
|
866
|
+
keyBindings->append(new KeyBinding('n', xpdfKeyModNone,
|
867
|
+
xpdfKeyContextScrLockOn,
|
868
|
+
"nextPageNoScroll"));
|
869
|
+
keyBindings->append(new KeyBinding('N', xpdfKeyModNone,
|
870
|
+
xpdfKeyContextScrLockOn,
|
871
|
+
"nextPageNoScroll"));
|
872
|
+
keyBindings->append(new KeyBinding('p', xpdfKeyModNone,
|
873
|
+
xpdfKeyContextScrLockOff, "prevPage"));
|
874
|
+
keyBindings->append(new KeyBinding('P', xpdfKeyModNone,
|
875
|
+
xpdfKeyContextScrLockOff, "prevPage"));
|
876
|
+
keyBindings->append(new KeyBinding('p', xpdfKeyModNone,
|
877
|
+
xpdfKeyContextScrLockOn,
|
878
|
+
"prevPageNoScroll"));
|
879
|
+
keyBindings->append(new KeyBinding('P', xpdfKeyModNone,
|
880
|
+
xpdfKeyContextScrLockOn,
|
881
|
+
"prevPageNoScroll"));
|
882
|
+
keyBindings->append(new KeyBinding('v', xpdfKeyModNone,
|
883
|
+
xpdfKeyContextAny, "goForward"));
|
884
|
+
keyBindings->append(new KeyBinding('b', xpdfKeyModNone,
|
885
|
+
xpdfKeyContextAny, "goBackward"));
|
886
|
+
keyBindings->append(new KeyBinding('g', xpdfKeyModNone,
|
887
|
+
xpdfKeyContextAny, "focusToPageNum"));
|
888
|
+
keyBindings->append(new KeyBinding('0', xpdfKeyModNone,
|
889
|
+
xpdfKeyContextAny, "zoomPercent(125)"));
|
890
|
+
keyBindings->append(new KeyBinding('+', xpdfKeyModNone,
|
891
|
+
xpdfKeyContextAny, "zoomIn"));
|
892
|
+
keyBindings->append(new KeyBinding('-', xpdfKeyModNone,
|
893
|
+
xpdfKeyContextAny, "zoomOut"));
|
894
|
+
keyBindings->append(new KeyBinding('z', xpdfKeyModNone,
|
895
|
+
xpdfKeyContextAny, "zoomFitPage"));
|
896
|
+
keyBindings->append(new KeyBinding('w', xpdfKeyModNone,
|
897
|
+
xpdfKeyContextAny, "zoomFitWidth"));
|
898
|
+
keyBindings->append(new KeyBinding('f', xpdfKeyModAlt,
|
899
|
+
xpdfKeyContextAny,
|
900
|
+
"toggleFullScreenMode"));
|
901
|
+
keyBindings->append(new KeyBinding('l', xpdfKeyModCtrl,
|
902
|
+
xpdfKeyContextAny, "redraw"));
|
903
|
+
keyBindings->append(new KeyBinding('w', xpdfKeyModCtrl,
|
904
|
+
xpdfKeyContextAny, "closeWindow"));
|
905
|
+
keyBindings->append(new KeyBinding('?', xpdfKeyModNone,
|
906
|
+
xpdfKeyContextAny, "about"));
|
907
|
+
keyBindings->append(new KeyBinding('q', xpdfKeyModNone,
|
908
|
+
xpdfKeyContextAny, "quit"));
|
909
|
+
keyBindings->append(new KeyBinding('Q', xpdfKeyModNone,
|
910
|
+
xpdfKeyContextAny, "quit"));
|
911
|
+
}
|
912
|
+
|
913
|
+
void GlobalParams::parseFile(GString *fileName, FILE *f) {
|
914
|
+
int line;
|
915
|
+
char buf[512];
|
916
|
+
|
917
|
+
line = 1;
|
918
|
+
while (getLine(buf, sizeof(buf) - 1, f)) {
|
919
|
+
parseLine(buf, fileName, line);
|
920
|
+
++line;
|
921
|
+
}
|
922
|
+
}
|
923
|
+
|
924
|
+
void GlobalParams::parseLine(char *buf, GString *fileName, int line) {
|
925
|
+
GList *tokens;
|
926
|
+
GString *cmd, *incFile;
|
927
|
+
char *p1, *p2;
|
928
|
+
FILE *f2;
|
929
|
+
|
930
|
+
// break the line into tokens
|
931
|
+
tokens = new GList();
|
932
|
+
p1 = buf;
|
933
|
+
while (*p1) {
|
934
|
+
for (; *p1 && isspace(*p1); ++p1) ;
|
935
|
+
if (!*p1) {
|
936
|
+
break;
|
937
|
+
}
|
938
|
+
if (*p1 == '"' || *p1 == '\'') {
|
939
|
+
for (p2 = p1 + 1; *p2 && *p2 != *p1; ++p2) ;
|
940
|
+
++p1;
|
941
|
+
} else {
|
942
|
+
for (p2 = p1 + 1; *p2 && !isspace(*p2); ++p2) ;
|
943
|
+
}
|
944
|
+
tokens->append(new GString(p1, p2 - p1));
|
945
|
+
p1 = *p2 ? p2 + 1 : p2;
|
946
|
+
}
|
947
|
+
|
948
|
+
// parse the line
|
949
|
+
if (tokens->getLength() > 0 &&
|
950
|
+
((GString *)tokens->get(0))->getChar(0) != '#') {
|
951
|
+
cmd = (GString *)tokens->get(0);
|
952
|
+
if (!cmd->cmp("include")) {
|
953
|
+
if (tokens->getLength() == 2) {
|
954
|
+
incFile = (GString *)tokens->get(1);
|
955
|
+
if ((f2 = fopen(incFile->getCString(), "r"))) {
|
956
|
+
parseFile(incFile, f2);
|
957
|
+
fclose(f2);
|
958
|
+
} else {
|
959
|
+
error(-1, "Couldn't find included config file: '%s' (%s:%d)",
|
960
|
+
incFile->getCString(), fileName->getCString(), line);
|
961
|
+
}
|
962
|
+
} else {
|
963
|
+
error(-1, "Bad 'include' config file command (%s:%d)",
|
964
|
+
fileName->getCString(), line);
|
965
|
+
}
|
966
|
+
} else if (!cmd->cmp("nameToUnicode")) {
|
967
|
+
parseNameToUnicode(tokens, fileName, line);
|
968
|
+
} else if (!cmd->cmp("cidToUnicode")) {
|
969
|
+
parseCIDToUnicode(tokens, fileName, line);
|
970
|
+
} else if (!cmd->cmp("unicodeToUnicode")) {
|
971
|
+
parseUnicodeToUnicode(tokens, fileName, line);
|
972
|
+
} else if (!cmd->cmp("unicodeMap")) {
|
973
|
+
parseUnicodeMap(tokens, fileName, line);
|
974
|
+
} else if (!cmd->cmp("cMapDir")) {
|
975
|
+
parseCMapDir(tokens, fileName, line);
|
976
|
+
} else if (!cmd->cmp("toUnicodeDir")) {
|
977
|
+
parseToUnicodeDir(tokens, fileName, line);
|
978
|
+
} else if (!cmd->cmp("displayFontT1")) {
|
979
|
+
parseDisplayFont(tokens, displayFonts, displayFontT1, fileName, line);
|
980
|
+
} else if (!cmd->cmp("displayFontTT")) {
|
981
|
+
parseDisplayFont(tokens, displayFonts, displayFontTT, fileName, line);
|
982
|
+
} else if (!cmd->cmp("displayNamedCIDFontT1")) {
|
983
|
+
parseDisplayFont(tokens, displayNamedCIDFonts,
|
984
|
+
displayFontT1, fileName, line);
|
985
|
+
} else if (!cmd->cmp("displayCIDFontT1")) {
|
986
|
+
parseDisplayFont(tokens, displayCIDFonts,
|
987
|
+
displayFontT1, fileName, line);
|
988
|
+
} else if (!cmd->cmp("displayNamedCIDFontTT")) {
|
989
|
+
parseDisplayFont(tokens, displayNamedCIDFonts,
|
990
|
+
displayFontTT, fileName, line);
|
991
|
+
} else if (!cmd->cmp("displayCIDFontTT")) {
|
992
|
+
parseDisplayFont(tokens, displayCIDFonts,
|
993
|
+
displayFontTT, fileName, line);
|
994
|
+
} else if (!cmd->cmp("psFile")) {
|
995
|
+
parsePSFile(tokens, fileName, line);
|
996
|
+
} else if (!cmd->cmp("psFont")) {
|
997
|
+
parsePSFont(tokens, fileName, line);
|
998
|
+
} else if (!cmd->cmp("psNamedFont16")) {
|
999
|
+
parsePSFont16("psNamedFont16", psNamedFonts16,
|
1000
|
+
tokens, fileName, line);
|
1001
|
+
} else if (!cmd->cmp("psFont16")) {
|
1002
|
+
parsePSFont16("psFont16", psFonts16, tokens, fileName, line);
|
1003
|
+
} else if (!cmd->cmp("psPaperSize")) {
|
1004
|
+
parsePSPaperSize(tokens, fileName, line);
|
1005
|
+
} else if (!cmd->cmp("psImageableArea")) {
|
1006
|
+
parsePSImageableArea(tokens, fileName, line);
|
1007
|
+
} else if (!cmd->cmp("psCrop")) {
|
1008
|
+
parseYesNo("psCrop", &psCrop, tokens, fileName, line);
|
1009
|
+
} else if (!cmd->cmp("psExpandSmaller")) {
|
1010
|
+
parseYesNo("psExpandSmaller", &psExpandSmaller,
|
1011
|
+
tokens, fileName, line);
|
1012
|
+
} else if (!cmd->cmp("psShrinkLarger")) {
|
1013
|
+
parseYesNo("psShrinkLarger", &psShrinkLarger, tokens, fileName, line);
|
1014
|
+
} else if (!cmd->cmp("psCenter")) {
|
1015
|
+
parseYesNo("psCenter", &psCenter, tokens, fileName, line);
|
1016
|
+
} else if (!cmd->cmp("psDuplex")) {
|
1017
|
+
parseYesNo("psDuplex", &psDuplex, tokens, fileName, line);
|
1018
|
+
} else if (!cmd->cmp("psLevel")) {
|
1019
|
+
parsePSLevel(tokens, fileName, line);
|
1020
|
+
} else if (!cmd->cmp("psEmbedType1Fonts")) {
|
1021
|
+
parseYesNo("psEmbedType1", &psEmbedType1, tokens, fileName, line);
|
1022
|
+
} else if (!cmd->cmp("psEmbedTrueTypeFonts")) {
|
1023
|
+
parseYesNo("psEmbedTrueType", &psEmbedTrueType,
|
1024
|
+
tokens, fileName, line);
|
1025
|
+
} else if (!cmd->cmp("psEmbedCIDPostScriptFonts")) {
|
1026
|
+
parseYesNo("psEmbedCIDPostScript", &psEmbedCIDPostScript,
|
1027
|
+
tokens, fileName, line);
|
1028
|
+
} else if (!cmd->cmp("psEmbedCIDTrueTypeFonts")) {
|
1029
|
+
parseYesNo("psEmbedCIDTrueType", &psEmbedCIDTrueType,
|
1030
|
+
tokens, fileName, line);
|
1031
|
+
} else if (!cmd->cmp("psPreload")) {
|
1032
|
+
parseYesNo("psPreload", &psPreload, tokens, fileName, line);
|
1033
|
+
} else if (!cmd->cmp("psOPI")) {
|
1034
|
+
parseYesNo("psOPI", &psOPI, tokens, fileName, line);
|
1035
|
+
} else if (!cmd->cmp("psASCIIHex")) {
|
1036
|
+
parseYesNo("psASCIIHex", &psASCIIHex, tokens, fileName, line);
|
1037
|
+
} else if (!cmd->cmp("textEncoding")) {
|
1038
|
+
parseTextEncoding(tokens, fileName, line);
|
1039
|
+
} else if (!cmd->cmp("textEOL")) {
|
1040
|
+
parseTextEOL(tokens, fileName, line);
|
1041
|
+
} else if (!cmd->cmp("textPageBreaks")) {
|
1042
|
+
parseYesNo("textPageBreaks", &textPageBreaks,
|
1043
|
+
tokens, fileName, line);
|
1044
|
+
} else if (!cmd->cmp("textKeepTinyChars")) {
|
1045
|
+
parseYesNo("textKeepTinyChars", &textKeepTinyChars,
|
1046
|
+
tokens, fileName, line);
|
1047
|
+
} else if (!cmd->cmp("fontDir")) {
|
1048
|
+
parseFontDir(tokens, fileName, line);
|
1049
|
+
} else if (!cmd->cmp("initialZoom")) {
|
1050
|
+
parseInitialZoom(tokens, fileName, line);
|
1051
|
+
} else if (!cmd->cmp("continuousView")) {
|
1052
|
+
parseYesNo("continuousView", &continuousView, tokens, fileName, line);
|
1053
|
+
} else if (!cmd->cmp("enableT1lib")) {
|
1054
|
+
parseYesNo("enableT1lib", &enableT1lib, tokens, fileName, line);
|
1055
|
+
} else if (!cmd->cmp("enableFreeType")) {
|
1056
|
+
parseYesNo("enableFreeType", &enableFreeType, tokens, fileName, line);
|
1057
|
+
} else if (!cmd->cmp("antialias")) {
|
1058
|
+
parseYesNo("antialias", &antialias, tokens, fileName, line);
|
1059
|
+
} else if (!cmd->cmp("vectorAntialias")) {
|
1060
|
+
parseYesNo("vectorAntialias", &vectorAntialias,
|
1061
|
+
tokens, fileName, line);
|
1062
|
+
} else if (!cmd->cmp("strokeAdjust")) {
|
1063
|
+
parseYesNo("strokeAdjust", &strokeAdjust, tokens, fileName, line);
|
1064
|
+
} else if (!cmd->cmp("screenType")) {
|
1065
|
+
parseScreenType(tokens, fileName, line);
|
1066
|
+
} else if (!cmd->cmp("screenSize")) {
|
1067
|
+
parseInteger("screenSize", &screenSize, tokens, fileName, line);
|
1068
|
+
} else if (!cmd->cmp("screenDotRadius")) {
|
1069
|
+
parseInteger("screenDotRadius", &screenDotRadius,
|
1070
|
+
tokens, fileName, line);
|
1071
|
+
} else if (!cmd->cmp("screenGamma")) {
|
1072
|
+
parseFloat("screenGamma", &screenGamma,
|
1073
|
+
tokens, fileName, line);
|
1074
|
+
} else if (!cmd->cmp("screenBlackThreshold")) {
|
1075
|
+
parseFloat("screenBlackThreshold", &screenBlackThreshold,
|
1076
|
+
tokens, fileName, line);
|
1077
|
+
} else if (!cmd->cmp("screenWhiteThreshold")) {
|
1078
|
+
parseFloat("screenWhiteThreshold", &screenWhiteThreshold,
|
1079
|
+
tokens, fileName, line);
|
1080
|
+
} else if (!cmd->cmp("urlCommand")) {
|
1081
|
+
parseCommand("urlCommand", &urlCommand, tokens, fileName, line);
|
1082
|
+
} else if (!cmd->cmp("movieCommand")) {
|
1083
|
+
parseCommand("movieCommand", &movieCommand, tokens, fileName, line);
|
1084
|
+
} else if (!cmd->cmp("mapNumericCharNames")) {
|
1085
|
+
parseYesNo("mapNumericCharNames", &mapNumericCharNames,
|
1086
|
+
tokens, fileName, line);
|
1087
|
+
} else if (!cmd->cmp("mapUnknownCharNames")) {
|
1088
|
+
parseYesNo("mapUnknownCharNames", &mapUnknownCharNames,
|
1089
|
+
tokens, fileName, line);
|
1090
|
+
} else if (!cmd->cmp("bind")) {
|
1091
|
+
parseBind(tokens, fileName, line);
|
1092
|
+
} else if (!cmd->cmp("unbind")) {
|
1093
|
+
parseUnbind(tokens, fileName, line);
|
1094
|
+
} else if (!cmd->cmp("printCommands")) {
|
1095
|
+
parseYesNo("printCommands", &printCommands, tokens, fileName, line);
|
1096
|
+
} else if (!cmd->cmp("errQuiet")) {
|
1097
|
+
parseYesNo("errQuiet", &errQuiet, tokens, fileName, line);
|
1098
|
+
} else {
|
1099
|
+
error(-1, "Unknown config file command '%s' (%s:%d)",
|
1100
|
+
cmd->getCString(), fileName->getCString(), line);
|
1101
|
+
if (!cmd->cmp("displayFontX") ||
|
1102
|
+
!cmd->cmp("displayNamedCIDFontX") ||
|
1103
|
+
!cmd->cmp("displayCIDFontX")) {
|
1104
|
+
error(-1, "-- Xpdf no longer supports X fonts");
|
1105
|
+
} else if (!cmd->cmp("t1libControl") || !cmd->cmp("freetypeControl")) {
|
1106
|
+
error(-1, "-- The t1libControl and freetypeControl options have been replaced");
|
1107
|
+
error(-1, " by the enableT1lib, enableFreeType, and antialias options");
|
1108
|
+
} else if (!cmd->cmp("fontpath") || !cmd->cmp("fontmap")) {
|
1109
|
+
error(-1, "-- the config file format has changed since Xpdf 0.9x");
|
1110
|
+
}
|
1111
|
+
}
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
deleteGList(tokens, GString);
|
1115
|
+
}
|
1116
|
+
|
1117
|
+
void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName,
|
1118
|
+
int line) {
|
1119
|
+
GString *name;
|
1120
|
+
char *tok1, *tok2;
|
1121
|
+
FILE *f;
|
1122
|
+
char buf[256];
|
1123
|
+
int line2;
|
1124
|
+
Unicode u;
|
1125
|
+
|
1126
|
+
if (tokens->getLength() != 2) {
|
1127
|
+
error(-1, "Bad 'nameToUnicode' config file command (%s:%d)",
|
1128
|
+
fileName->getCString(), line);
|
1129
|
+
return;
|
1130
|
+
}
|
1131
|
+
name = (GString *)tokens->get(1);
|
1132
|
+
if (!(f = fopen(name->getCString(), "r"))) {
|
1133
|
+
error(-1, "Couldn't open 'nameToUnicode' file '%s'",
|
1134
|
+
name->getCString());
|
1135
|
+
return;
|
1136
|
+
}
|
1137
|
+
line2 = 1;
|
1138
|
+
while (getLine(buf, sizeof(buf), f)) {
|
1139
|
+
tok1 = strtok(buf, " \t\r\n");
|
1140
|
+
tok2 = strtok(NULL, " \t\r\n");
|
1141
|
+
if (tok1 && tok2) {
|
1142
|
+
sscanf(tok1, "%x", &u);
|
1143
|
+
nameToUnicode->add(tok2, u);
|
1144
|
+
} else {
|
1145
|
+
error(-1, "Bad line in 'nameToUnicode' file (%s:%d)", name, line2);
|
1146
|
+
}
|
1147
|
+
++line2;
|
1148
|
+
}
|
1149
|
+
fclose(f);
|
1150
|
+
}
|
1151
|
+
|
1152
|
+
void GlobalParams::parseCIDToUnicode(GList *tokens, GString *fileName,
|
1153
|
+
int line) {
|
1154
|
+
GString *collection, *name, *old;
|
1155
|
+
|
1156
|
+
if (tokens->getLength() != 3) {
|
1157
|
+
error(-1, "Bad 'cidToUnicode' config file command (%s:%d)",
|
1158
|
+
fileName->getCString(), line);
|
1159
|
+
return;
|
1160
|
+
}
|
1161
|
+
collection = (GString *)tokens->get(1);
|
1162
|
+
name = (GString *)tokens->get(2);
|
1163
|
+
if ((old = (GString *)cidToUnicodes->remove(collection))) {
|
1164
|
+
delete old;
|
1165
|
+
}
|
1166
|
+
cidToUnicodes->add(collection->copy(), name->copy());
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
void GlobalParams::parseUnicodeToUnicode(GList *tokens, GString *fileName,
|
1170
|
+
int line) {
|
1171
|
+
GString *font, *file, *old;
|
1172
|
+
|
1173
|
+
if (tokens->getLength() != 3) {
|
1174
|
+
error(-1, "Bad 'unicodeToUnicode' config file command (%s:%d)",
|
1175
|
+
fileName->getCString(), line);
|
1176
|
+
return;
|
1177
|
+
}
|
1178
|
+
font = (GString *)tokens->get(1);
|
1179
|
+
file = (GString *)tokens->get(2);
|
1180
|
+
if ((old = (GString *)unicodeToUnicodes->remove(font))) {
|
1181
|
+
delete old;
|
1182
|
+
}
|
1183
|
+
unicodeToUnicodes->add(font->copy(), file->copy());
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
void GlobalParams::parseUnicodeMap(GList *tokens, GString *fileName,
|
1187
|
+
int line) {
|
1188
|
+
GString *encodingName, *name, *old;
|
1189
|
+
|
1190
|
+
if (tokens->getLength() != 3) {
|
1191
|
+
error(-1, "Bad 'unicodeMap' config file command (%s:%d)",
|
1192
|
+
fileName->getCString(), line);
|
1193
|
+
return;
|
1194
|
+
}
|
1195
|
+
encodingName = (GString *)tokens->get(1);
|
1196
|
+
name = (GString *)tokens->get(2);
|
1197
|
+
if ((old = (GString *)unicodeMaps->remove(encodingName))) {
|
1198
|
+
delete old;
|
1199
|
+
}
|
1200
|
+
unicodeMaps->add(encodingName->copy(), name->copy());
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
void GlobalParams::parseCMapDir(GList *tokens, GString *fileName, int line) {
|
1204
|
+
GString *collection, *dir;
|
1205
|
+
GList *list;
|
1206
|
+
|
1207
|
+
if (tokens->getLength() != 3) {
|
1208
|
+
error(-1, "Bad 'cMapDir' config file command (%s:%d)",
|
1209
|
+
fileName->getCString(), line);
|
1210
|
+
return;
|
1211
|
+
}
|
1212
|
+
collection = (GString *)tokens->get(1);
|
1213
|
+
dir = (GString *)tokens->get(2);
|
1214
|
+
if (!(list = (GList *)cMapDirs->lookup(collection))) {
|
1215
|
+
list = new GList();
|
1216
|
+
cMapDirs->add(collection->copy(), list);
|
1217
|
+
}
|
1218
|
+
list->append(dir->copy());
|
1219
|
+
}
|
1220
|
+
|
1221
|
+
void GlobalParams::parseToUnicodeDir(GList *tokens, GString *fileName,
|
1222
|
+
int line) {
|
1223
|
+
if (tokens->getLength() != 2) {
|
1224
|
+
error(-1, "Bad 'toUnicodeDir' config file command (%s:%d)",
|
1225
|
+
fileName->getCString(), line);
|
1226
|
+
return;
|
1227
|
+
}
|
1228
|
+
toUnicodeDirs->append(((GString *)tokens->get(1))->copy());
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
void GlobalParams::parseDisplayFont(GList *tokens, GHash *fontHash,
|
1232
|
+
DisplayFontParamKind kind,
|
1233
|
+
GString *fileName, int line) {
|
1234
|
+
DisplayFontParam *param, *old;
|
1235
|
+
|
1236
|
+
if (tokens->getLength() < 2) {
|
1237
|
+
goto err1;
|
1238
|
+
}
|
1239
|
+
param = new DisplayFontParam(((GString *)tokens->get(1))->copy(), kind);
|
1240
|
+
|
1241
|
+
switch (kind) {
|
1242
|
+
case displayFontT1:
|
1243
|
+
if (tokens->getLength() != 3) {
|
1244
|
+
goto err2;
|
1245
|
+
}
|
1246
|
+
param->t1.fileName = ((GString *)tokens->get(2))->copy();
|
1247
|
+
break;
|
1248
|
+
case displayFontTT:
|
1249
|
+
if (tokens->getLength() != 3) {
|
1250
|
+
goto err2;
|
1251
|
+
}
|
1252
|
+
param->tt.fileName = ((GString *)tokens->get(2))->copy();
|
1253
|
+
break;
|
1254
|
+
}
|
1255
|
+
|
1256
|
+
if ((old = (DisplayFontParam *)fontHash->remove(param->name))) {
|
1257
|
+
delete old;
|
1258
|
+
}
|
1259
|
+
fontHash->add(param->name, param);
|
1260
|
+
return;
|
1261
|
+
|
1262
|
+
err2:
|
1263
|
+
delete param;
|
1264
|
+
err1:
|
1265
|
+
error(-1, "Bad 'display*Font*' config file command (%s:%d)",
|
1266
|
+
fileName->getCString(), line);
|
1267
|
+
}
|
1268
|
+
|
1269
|
+
void GlobalParams::parsePSPaperSize(GList *tokens, GString *fileName,
|
1270
|
+
int line) {
|
1271
|
+
GString *tok;
|
1272
|
+
|
1273
|
+
if (tokens->getLength() == 2) {
|
1274
|
+
tok = (GString *)tokens->get(1);
|
1275
|
+
if (!setPSPaperSize(tok->getCString())) {
|
1276
|
+
error(-1, "Bad 'psPaperSize' config file command (%s:%d)",
|
1277
|
+
fileName->getCString(), line);
|
1278
|
+
}
|
1279
|
+
} else if (tokens->getLength() == 3) {
|
1280
|
+
tok = (GString *)tokens->get(1);
|
1281
|
+
psPaperWidth = atoi(tok->getCString());
|
1282
|
+
tok = (GString *)tokens->get(2);
|
1283
|
+
psPaperHeight = atoi(tok->getCString());
|
1284
|
+
psImageableLLX = psImageableLLY = 0;
|
1285
|
+
psImageableURX = psPaperWidth;
|
1286
|
+
psImageableURY = psPaperHeight;
|
1287
|
+
} else {
|
1288
|
+
error(-1, "Bad 'psPaperSize' config file command (%s:%d)",
|
1289
|
+
fileName->getCString(), line);
|
1290
|
+
}
|
1291
|
+
}
|
1292
|
+
|
1293
|
+
void GlobalParams::parsePSImageableArea(GList *tokens, GString *fileName,
|
1294
|
+
int line) {
|
1295
|
+
if (tokens->getLength() != 5) {
|
1296
|
+
error(-1, "Bad 'psImageableArea' config file command (%s:%d)",
|
1297
|
+
fileName->getCString(), line);
|
1298
|
+
return;
|
1299
|
+
}
|
1300
|
+
psImageableLLX = atoi(((GString *)tokens->get(1))->getCString());
|
1301
|
+
psImageableLLY = atoi(((GString *)tokens->get(2))->getCString());
|
1302
|
+
psImageableURX = atoi(((GString *)tokens->get(3))->getCString());
|
1303
|
+
psImageableURY = atoi(((GString *)tokens->get(4))->getCString());
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
void GlobalParams::parsePSLevel(GList *tokens, GString *fileName, int line) {
|
1307
|
+
GString *tok;
|
1308
|
+
|
1309
|
+
if (tokens->getLength() != 2) {
|
1310
|
+
error(-1, "Bad 'psLevel' config file command (%s:%d)",
|
1311
|
+
fileName->getCString(), line);
|
1312
|
+
return;
|
1313
|
+
}
|
1314
|
+
tok = (GString *)tokens->get(1);
|
1315
|
+
if (!tok->cmp("level1")) {
|
1316
|
+
psLevel = psLevel1;
|
1317
|
+
} else if (!tok->cmp("level1sep")) {
|
1318
|
+
psLevel = psLevel1Sep;
|
1319
|
+
} else if (!tok->cmp("level2")) {
|
1320
|
+
psLevel = psLevel2;
|
1321
|
+
} else if (!tok->cmp("level2sep")) {
|
1322
|
+
psLevel = psLevel2Sep;
|
1323
|
+
} else if (!tok->cmp("level3")) {
|
1324
|
+
psLevel = psLevel3;
|
1325
|
+
} else if (!tok->cmp("level3Sep")) {
|
1326
|
+
psLevel = psLevel3Sep;
|
1327
|
+
} else {
|
1328
|
+
error(-1, "Bad 'psLevel' config file command (%s:%d)",
|
1329
|
+
fileName->getCString(), line);
|
1330
|
+
}
|
1331
|
+
}
|
1332
|
+
|
1333
|
+
void GlobalParams::parsePSFile(GList *tokens, GString *fileName, int line) {
|
1334
|
+
if (tokens->getLength() != 2) {
|
1335
|
+
error(-1, "Bad 'psFile' config file command (%s:%d)",
|
1336
|
+
fileName->getCString(), line);
|
1337
|
+
return;
|
1338
|
+
}
|
1339
|
+
if (psFile) {
|
1340
|
+
delete psFile;
|
1341
|
+
}
|
1342
|
+
psFile = ((GString *)tokens->get(1))->copy();
|
1343
|
+
}
|
1344
|
+
|
1345
|
+
void GlobalParams::parsePSFont(GList *tokens, GString *fileName, int line) {
|
1346
|
+
PSFontParam *param;
|
1347
|
+
|
1348
|
+
if (tokens->getLength() != 3) {
|
1349
|
+
error(-1, "Bad 'psFont' config file command (%s:%d)",
|
1350
|
+
fileName->getCString(), line);
|
1351
|
+
return;
|
1352
|
+
}
|
1353
|
+
param = new PSFontParam(((GString *)tokens->get(1))->copy(), 0,
|
1354
|
+
((GString *)tokens->get(2))->copy(), NULL);
|
1355
|
+
psFonts->add(param->pdfFontName, param);
|
1356
|
+
}
|
1357
|
+
|
1358
|
+
void GlobalParams::parsePSFont16(char *cmdName, GList *fontList,
|
1359
|
+
GList *tokens, GString *fileName, int line) {
|
1360
|
+
PSFontParam *param;
|
1361
|
+
int wMode;
|
1362
|
+
GString *tok;
|
1363
|
+
|
1364
|
+
if (tokens->getLength() != 5) {
|
1365
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1366
|
+
cmdName, fileName->getCString(), line);
|
1367
|
+
return;
|
1368
|
+
}
|
1369
|
+
tok = (GString *)tokens->get(2);
|
1370
|
+
if (!tok->cmp("H")) {
|
1371
|
+
wMode = 0;
|
1372
|
+
} else if (!tok->cmp("V")) {
|
1373
|
+
wMode = 1;
|
1374
|
+
} else {
|
1375
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1376
|
+
cmdName, fileName->getCString(), line);
|
1377
|
+
return;
|
1378
|
+
}
|
1379
|
+
param = new PSFontParam(((GString *)tokens->get(1))->copy(),
|
1380
|
+
wMode,
|
1381
|
+
((GString *)tokens->get(3))->copy(),
|
1382
|
+
((GString *)tokens->get(4))->copy());
|
1383
|
+
fontList->append(param);
|
1384
|
+
}
|
1385
|
+
|
1386
|
+
void GlobalParams::parseTextEncoding(GList *tokens, GString *fileName,
|
1387
|
+
int line) {
|
1388
|
+
if (tokens->getLength() != 2) {
|
1389
|
+
error(-1, "Bad 'textEncoding' config file command (%s:%d)",
|
1390
|
+
fileName->getCString(), line);
|
1391
|
+
return;
|
1392
|
+
}
|
1393
|
+
delete textEncoding;
|
1394
|
+
textEncoding = ((GString *)tokens->get(1))->copy();
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
void GlobalParams::parseTextEOL(GList *tokens, GString *fileName, int line) {
|
1398
|
+
GString *tok;
|
1399
|
+
|
1400
|
+
if (tokens->getLength() != 2) {
|
1401
|
+
error(-1, "Bad 'textEOL' config file command (%s:%d)",
|
1402
|
+
fileName->getCString(), line);
|
1403
|
+
return;
|
1404
|
+
}
|
1405
|
+
tok = (GString *)tokens->get(1);
|
1406
|
+
if (!tok->cmp("unix")) {
|
1407
|
+
textEOL = eolUnix;
|
1408
|
+
} else if (!tok->cmp("dos")) {
|
1409
|
+
textEOL = eolDOS;
|
1410
|
+
} else if (!tok->cmp("mac")) {
|
1411
|
+
textEOL = eolMac;
|
1412
|
+
} else {
|
1413
|
+
error(-1, "Bad 'textEOL' config file command (%s:%d)",
|
1414
|
+
fileName->getCString(), line);
|
1415
|
+
}
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
void GlobalParams::parseFontDir(GList *tokens, GString *fileName, int line) {
|
1419
|
+
if (tokens->getLength() != 2) {
|
1420
|
+
error(-1, "Bad 'fontDir' config file command (%s:%d)",
|
1421
|
+
fileName->getCString(), line);
|
1422
|
+
return;
|
1423
|
+
}
|
1424
|
+
fontDirs->append(((GString *)tokens->get(1))->copy());
|
1425
|
+
}
|
1426
|
+
|
1427
|
+
void GlobalParams::parseInitialZoom(GList *tokens,
|
1428
|
+
GString *fileName, int line) {
|
1429
|
+
if (tokens->getLength() != 2) {
|
1430
|
+
error(-1, "Bad 'initialZoom' config file command (%s:%d)",
|
1431
|
+
fileName->getCString(), line);
|
1432
|
+
return;
|
1433
|
+
}
|
1434
|
+
delete initialZoom;
|
1435
|
+
initialZoom = ((GString *)tokens->get(1))->copy();
|
1436
|
+
}
|
1437
|
+
|
1438
|
+
void GlobalParams::parseScreenType(GList *tokens, GString *fileName,
|
1439
|
+
int line) {
|
1440
|
+
GString *tok;
|
1441
|
+
|
1442
|
+
if (tokens->getLength() != 2) {
|
1443
|
+
error(-1, "Bad 'screenType' config file command (%s:%d)",
|
1444
|
+
fileName->getCString(), line);
|
1445
|
+
return;
|
1446
|
+
}
|
1447
|
+
tok = (GString *)tokens->get(1);
|
1448
|
+
if (!tok->cmp("dispersed")) {
|
1449
|
+
screenType = screenDispersed;
|
1450
|
+
} else if (!tok->cmp("clustered")) {
|
1451
|
+
screenType = screenClustered;
|
1452
|
+
} else if (!tok->cmp("stochasticClustered")) {
|
1453
|
+
screenType = screenStochasticClustered;
|
1454
|
+
} else {
|
1455
|
+
error(-1, "Bad 'screenType' config file command (%s:%d)",
|
1456
|
+
fileName->getCString(), line);
|
1457
|
+
}
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
void GlobalParams::parseBind(GList *tokens, GString *fileName, int line) {
|
1461
|
+
KeyBinding *binding;
|
1462
|
+
GList *cmds;
|
1463
|
+
int code, mods, context, i;
|
1464
|
+
|
1465
|
+
if (tokens->getLength() < 4) {
|
1466
|
+
error(-1, "Bad 'bind' config file command (%s:%d)",
|
1467
|
+
fileName->getCString(), line);
|
1468
|
+
return;
|
1469
|
+
}
|
1470
|
+
if (!parseKey((GString *)tokens->get(1), (GString *)tokens->get(2),
|
1471
|
+
&code, &mods, &context,
|
1472
|
+
"bind", tokens, fileName, line)) {
|
1473
|
+
return;
|
1474
|
+
}
|
1475
|
+
for (i = 0; i < keyBindings->getLength(); ++i) {
|
1476
|
+
binding = (KeyBinding *)keyBindings->get(i);
|
1477
|
+
if (binding->code == code &&
|
1478
|
+
binding->mods == mods &&
|
1479
|
+
binding->context == context) {
|
1480
|
+
delete (KeyBinding *)keyBindings->del(i);
|
1481
|
+
break;
|
1482
|
+
}
|
1483
|
+
}
|
1484
|
+
cmds = new GList();
|
1485
|
+
for (i = 3; i < tokens->getLength(); ++i) {
|
1486
|
+
cmds->append(((GString *)tokens->get(i))->copy());
|
1487
|
+
}
|
1488
|
+
keyBindings->append(new KeyBinding(code, mods, context, cmds));
|
1489
|
+
}
|
1490
|
+
|
1491
|
+
void GlobalParams::parseUnbind(GList *tokens, GString *fileName, int line) {
|
1492
|
+
KeyBinding *binding;
|
1493
|
+
int code, mods, context, i;
|
1494
|
+
|
1495
|
+
if (tokens->getLength() != 3) {
|
1496
|
+
error(-1, "Bad 'unbind' config file command (%s:%d)",
|
1497
|
+
fileName->getCString(), line);
|
1498
|
+
return;
|
1499
|
+
}
|
1500
|
+
if (!parseKey((GString *)tokens->get(1), (GString *)tokens->get(2),
|
1501
|
+
&code, &mods, &context,
|
1502
|
+
"unbind", tokens, fileName, line)) {
|
1503
|
+
return;
|
1504
|
+
}
|
1505
|
+
for (i = 0; i < keyBindings->getLength(); ++i) {
|
1506
|
+
binding = (KeyBinding *)keyBindings->get(i);
|
1507
|
+
if (binding->code == code &&
|
1508
|
+
binding->mods == mods &&
|
1509
|
+
binding->context == context) {
|
1510
|
+
delete (KeyBinding *)keyBindings->del(i);
|
1511
|
+
break;
|
1512
|
+
}
|
1513
|
+
}
|
1514
|
+
}
|
1515
|
+
|
1516
|
+
GBool GlobalParams::parseKey(GString *modKeyStr, GString *contextStr,
|
1517
|
+
int *code, int *mods, int *context,
|
1518
|
+
char *cmdName,
|
1519
|
+
GList *tokens, GString *fileName, int line) {
|
1520
|
+
char *p0;
|
1521
|
+
|
1522
|
+
*mods = xpdfKeyModNone;
|
1523
|
+
p0 = modKeyStr->getCString();
|
1524
|
+
while (1) {
|
1525
|
+
if (!strncmp(p0, "shift-", 6)) {
|
1526
|
+
*mods |= xpdfKeyModShift;
|
1527
|
+
p0 += 6;
|
1528
|
+
} else if (!strncmp(p0, "ctrl-", 5)) {
|
1529
|
+
*mods |= xpdfKeyModCtrl;
|
1530
|
+
p0 += 5;
|
1531
|
+
} else if (!strncmp(p0, "alt-", 4)) {
|
1532
|
+
*mods |= xpdfKeyModAlt;
|
1533
|
+
p0 += 4;
|
1534
|
+
} else {
|
1535
|
+
break;
|
1536
|
+
}
|
1537
|
+
}
|
1538
|
+
|
1539
|
+
if (!strcmp(p0, "space")) {
|
1540
|
+
*code = ' ';
|
1541
|
+
} else if (!strcmp(p0, "tab")) {
|
1542
|
+
*code = xpdfKeyCodeTab;
|
1543
|
+
} else if (!strcmp(p0, "return")) {
|
1544
|
+
*code = xpdfKeyCodeReturn;
|
1545
|
+
} else if (!strcmp(p0, "enter")) {
|
1546
|
+
*code = xpdfKeyCodeEnter;
|
1547
|
+
} else if (!strcmp(p0, "backspace")) {
|
1548
|
+
*code = xpdfKeyCodeBackspace;
|
1549
|
+
} else if (!strcmp(p0, "insert")) {
|
1550
|
+
*code = xpdfKeyCodeInsert;
|
1551
|
+
} else if (!strcmp(p0, "delete")) {
|
1552
|
+
*code = xpdfKeyCodeDelete;
|
1553
|
+
} else if (!strcmp(p0, "home")) {
|
1554
|
+
*code = xpdfKeyCodeHome;
|
1555
|
+
} else if (!strcmp(p0, "end")) {
|
1556
|
+
*code = xpdfKeyCodeEnd;
|
1557
|
+
} else if (!strcmp(p0, "pgup")) {
|
1558
|
+
*code = xpdfKeyCodePgUp;
|
1559
|
+
} else if (!strcmp(p0, "pgdn")) {
|
1560
|
+
*code = xpdfKeyCodePgDn;
|
1561
|
+
} else if (!strcmp(p0, "left")) {
|
1562
|
+
*code = xpdfKeyCodeLeft;
|
1563
|
+
} else if (!strcmp(p0, "right")) {
|
1564
|
+
*code = xpdfKeyCodeRight;
|
1565
|
+
} else if (!strcmp(p0, "up")) {
|
1566
|
+
*code = xpdfKeyCodeUp;
|
1567
|
+
} else if (!strcmp(p0, "down")) {
|
1568
|
+
*code = xpdfKeyCodeDown;
|
1569
|
+
} else if (p0[0] == 'f' && p0[1] >= '1' && p0[1] <= '9' && !p0[2]) {
|
1570
|
+
*code = xpdfKeyCodeF1 + (p0[1] - '1');
|
1571
|
+
} else if (p0[0] == 'f' &&
|
1572
|
+
((p0[1] >= '1' && p0[1] <= '2' && p0[2] >= '0' && p0[2] <= '9') ||
|
1573
|
+
(p0[1] == '3' && p0[2] >= '0' && p0[2] <= '5')) &&
|
1574
|
+
!p0[3]) {
|
1575
|
+
*code = xpdfKeyCodeF1 + 10 * (p0[1] - '0') + (p0[2] - '0') - 1;
|
1576
|
+
} else if (!strncmp(p0, "mousePress", 10) &&
|
1577
|
+
p0[10] >= '1' && p0[10] <= '7' && !p0[11]) {
|
1578
|
+
*code = xpdfKeyCodeMousePress1 + (p0[10] - '1');
|
1579
|
+
} else if (!strncmp(p0, "mouseRelease", 12) &&
|
1580
|
+
p0[12] >= '1' && p0[12] <= '7' && !p0[13]) {
|
1581
|
+
*code = xpdfKeyCodeMouseRelease1 + (p0[12] - '1');
|
1582
|
+
} else if (*p0 >= 0x20 && *p0 <= 0x7e && !p0[1]) {
|
1583
|
+
*code = (int)*p0;
|
1584
|
+
} else {
|
1585
|
+
error(-1, "Bad key/modifier in '%s' config file command (%s:%d)",
|
1586
|
+
cmdName, fileName->getCString(), line);
|
1587
|
+
return gFalse;
|
1588
|
+
}
|
1589
|
+
|
1590
|
+
p0 = contextStr->getCString();
|
1591
|
+
if (!strcmp(p0, "any")) {
|
1592
|
+
*context = xpdfKeyContextAny;
|
1593
|
+
} else {
|
1594
|
+
*context = xpdfKeyContextAny;
|
1595
|
+
while (1) {
|
1596
|
+
if (!strncmp(p0, "fullScreen", 10)) {
|
1597
|
+
*context |= xpdfKeyContextFullScreen;
|
1598
|
+
p0 += 10;
|
1599
|
+
} else if (!strncmp(p0, "window", 6)) {
|
1600
|
+
*context |= xpdfKeyContextWindow;
|
1601
|
+
p0 += 6;
|
1602
|
+
} else if (!strncmp(p0, "continuous", 10)) {
|
1603
|
+
*context |= xpdfKeyContextContinuous;
|
1604
|
+
p0 += 10;
|
1605
|
+
} else if (!strncmp(p0, "singlePage", 10)) {
|
1606
|
+
*context |= xpdfKeyContextSinglePage;
|
1607
|
+
p0 += 10;
|
1608
|
+
} else if (!strncmp(p0, "overLink", 8)) {
|
1609
|
+
*context |= xpdfKeyContextOverLink;
|
1610
|
+
p0 += 8;
|
1611
|
+
} else if (!strncmp(p0, "offLink", 7)) {
|
1612
|
+
*context |= xpdfKeyContextOffLink;
|
1613
|
+
p0 += 7;
|
1614
|
+
} else if (!strncmp(p0, "outline", 7)) {
|
1615
|
+
*context |= xpdfKeyContextOutline;
|
1616
|
+
p0 += 7;
|
1617
|
+
} else if (!strncmp(p0, "mainWin", 7)) {
|
1618
|
+
*context |= xpdfKeyContextMainWin;
|
1619
|
+
p0 += 7;
|
1620
|
+
} else if (!strncmp(p0, "scrLockOn", 9)) {
|
1621
|
+
*context |= xpdfKeyContextScrLockOn;
|
1622
|
+
p0 += 9;
|
1623
|
+
} else if (!strncmp(p0, "scrLockOff", 10)) {
|
1624
|
+
*context |= xpdfKeyContextScrLockOff;
|
1625
|
+
p0 += 10;
|
1626
|
+
} else {
|
1627
|
+
error(-1, "Bad context in '%s' config file command (%s:%d)",
|
1628
|
+
cmdName, fileName->getCString(), line);
|
1629
|
+
return gFalse;
|
1630
|
+
}
|
1631
|
+
if (!*p0) {
|
1632
|
+
break;
|
1633
|
+
}
|
1634
|
+
if (*p0 != ',') {
|
1635
|
+
error(-1, "Bad context in '%s' config file command (%s:%d)",
|
1636
|
+
cmdName, fileName->getCString(), line);
|
1637
|
+
return gFalse;
|
1638
|
+
}
|
1639
|
+
++p0;
|
1640
|
+
}
|
1641
|
+
}
|
1642
|
+
|
1643
|
+
return gTrue;
|
1644
|
+
}
|
1645
|
+
|
1646
|
+
void GlobalParams::parseCommand(char *cmdName, GString **val,
|
1647
|
+
GList *tokens, GString *fileName, int line) {
|
1648
|
+
if (tokens->getLength() != 2) {
|
1649
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1650
|
+
cmdName, fileName->getCString(), line);
|
1651
|
+
return;
|
1652
|
+
}
|
1653
|
+
if (*val) {
|
1654
|
+
delete *val;
|
1655
|
+
}
|
1656
|
+
*val = ((GString *)tokens->get(1))->copy();
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
void GlobalParams::parseYesNo(char *cmdName, GBool *flag,
|
1660
|
+
GList *tokens, GString *fileName, int line) {
|
1661
|
+
GString *tok;
|
1662
|
+
|
1663
|
+
if (tokens->getLength() != 2) {
|
1664
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1665
|
+
cmdName, fileName->getCString(), line);
|
1666
|
+
return;
|
1667
|
+
}
|
1668
|
+
tok = (GString *)tokens->get(1);
|
1669
|
+
if (!parseYesNo2(tok->getCString(), flag)) {
|
1670
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1671
|
+
cmdName, fileName->getCString(), line);
|
1672
|
+
}
|
1673
|
+
}
|
1674
|
+
|
1675
|
+
GBool GlobalParams::parseYesNo2(char *token, GBool *flag) {
|
1676
|
+
if (!strcmp(token, "yes")) {
|
1677
|
+
*flag = gTrue;
|
1678
|
+
} else if (!strcmp(token, "no")) {
|
1679
|
+
*flag = gFalse;
|
1680
|
+
} else {
|
1681
|
+
return gFalse;
|
1682
|
+
}
|
1683
|
+
return gTrue;
|
1684
|
+
}
|
1685
|
+
|
1686
|
+
void GlobalParams::parseInteger(char *cmdName, int *val,
|
1687
|
+
GList *tokens, GString *fileName, int line) {
|
1688
|
+
GString *tok;
|
1689
|
+
int i;
|
1690
|
+
|
1691
|
+
if (tokens->getLength() != 2) {
|
1692
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1693
|
+
cmdName, fileName->getCString(), line);
|
1694
|
+
return;
|
1695
|
+
}
|
1696
|
+
tok = (GString *)tokens->get(1);
|
1697
|
+
if (tok->getLength() == 0) {
|
1698
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1699
|
+
cmdName, fileName->getCString(), line);
|
1700
|
+
return;
|
1701
|
+
}
|
1702
|
+
if (tok->getChar(0) == '-') {
|
1703
|
+
i = 1;
|
1704
|
+
} else {
|
1705
|
+
i = 0;
|
1706
|
+
}
|
1707
|
+
for (; i < tok->getLength(); ++i) {
|
1708
|
+
if (tok->getChar(i) < '0' || tok->getChar(i) > '9') {
|
1709
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1710
|
+
cmdName, fileName->getCString(), line);
|
1711
|
+
return;
|
1712
|
+
}
|
1713
|
+
}
|
1714
|
+
*val = atoi(tok->getCString());
|
1715
|
+
}
|
1716
|
+
|
1717
|
+
void GlobalParams::parseFloat(char *cmdName, double *val,
|
1718
|
+
GList *tokens, GString *fileName, int line) {
|
1719
|
+
GString *tok;
|
1720
|
+
int i;
|
1721
|
+
|
1722
|
+
if (tokens->getLength() != 2) {
|
1723
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1724
|
+
cmdName, fileName->getCString(), line);
|
1725
|
+
return;
|
1726
|
+
}
|
1727
|
+
tok = (GString *)tokens->get(1);
|
1728
|
+
if (tok->getLength() == 0) {
|
1729
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1730
|
+
cmdName, fileName->getCString(), line);
|
1731
|
+
return;
|
1732
|
+
}
|
1733
|
+
if (tok->getChar(0) == '-') {
|
1734
|
+
i = 1;
|
1735
|
+
} else {
|
1736
|
+
i = 0;
|
1737
|
+
}
|
1738
|
+
for (; i < tok->getLength(); ++i) {
|
1739
|
+
if (!((tok->getChar(i) >= '0' && tok->getChar(i) <= '9') ||
|
1740
|
+
tok->getChar(i) == '.')) {
|
1741
|
+
error(-1, "Bad '%s' config file command (%s:%d)",
|
1742
|
+
cmdName, fileName->getCString(), line);
|
1743
|
+
return;
|
1744
|
+
}
|
1745
|
+
}
|
1746
|
+
*val = atof(tok->getCString());
|
1747
|
+
}
|
1748
|
+
|
1749
|
+
GlobalParams::~GlobalParams() {
|
1750
|
+
GHashIter *iter;
|
1751
|
+
GString *key;
|
1752
|
+
GList *list;
|
1753
|
+
|
1754
|
+
freeBuiltinFontTables();
|
1755
|
+
|
1756
|
+
delete macRomanReverseMap;
|
1757
|
+
|
1758
|
+
delete baseDir;
|
1759
|
+
delete nameToUnicode;
|
1760
|
+
deleteGHash(cidToUnicodes, GString);
|
1761
|
+
deleteGHash(unicodeToUnicodes, GString);
|
1762
|
+
deleteGHash(residentUnicodeMaps, UnicodeMap);
|
1763
|
+
deleteGHash(unicodeMaps, GString);
|
1764
|
+
deleteGList(toUnicodeDirs, GString);
|
1765
|
+
deleteGHash(displayFonts, DisplayFontParam);
|
1766
|
+
deleteGHash(displayCIDFonts, DisplayFontParam);
|
1767
|
+
deleteGHash(displayNamedCIDFonts, DisplayFontParam);
|
1768
|
+
#ifdef WIN32
|
1769
|
+
if (winFontList) {
|
1770
|
+
delete winFontList;
|
1771
|
+
}
|
1772
|
+
#endif
|
1773
|
+
if (psFile) {
|
1774
|
+
delete psFile;
|
1775
|
+
}
|
1776
|
+
deleteGHash(psFonts, PSFontParam);
|
1777
|
+
deleteGList(psNamedFonts16, PSFontParam);
|
1778
|
+
deleteGList(psFonts16, PSFontParam);
|
1779
|
+
delete textEncoding;
|
1780
|
+
deleteGList(fontDirs, GString);
|
1781
|
+
delete initialZoom;
|
1782
|
+
if (urlCommand) {
|
1783
|
+
delete urlCommand;
|
1784
|
+
}
|
1785
|
+
if (movieCommand) {
|
1786
|
+
delete movieCommand;
|
1787
|
+
}
|
1788
|
+
deleteGList(keyBindings, KeyBinding);
|
1789
|
+
|
1790
|
+
cMapDirs->startIter(&iter);
|
1791
|
+
while (cMapDirs->getNext(&iter, &key, (void **)&list)) {
|
1792
|
+
deleteGList(list, GString);
|
1793
|
+
}
|
1794
|
+
delete cMapDirs;
|
1795
|
+
|
1796
|
+
delete cidToUnicodeCache;
|
1797
|
+
delete unicodeToUnicodeCache;
|
1798
|
+
delete unicodeMapCache;
|
1799
|
+
delete cMapCache;
|
1800
|
+
|
1801
|
+
#ifdef ENABLE_PLUGINS
|
1802
|
+
delete securityHandlers;
|
1803
|
+
deleteGList(plugins, Plugin);
|
1804
|
+
#endif
|
1805
|
+
|
1806
|
+
#if MULTITHREADED
|
1807
|
+
gDestroyMutex(&mutex);
|
1808
|
+
gDestroyMutex(&unicodeMapCacheMutex);
|
1809
|
+
gDestroyMutex(&cMapCacheMutex);
|
1810
|
+
#endif
|
1811
|
+
}
|
1812
|
+
|
1813
|
+
//------------------------------------------------------------------------
|
1814
|
+
|
1815
|
+
void GlobalParams::setBaseDir(char *dir) {
|
1816
|
+
delete baseDir;
|
1817
|
+
baseDir = new GString(dir);
|
1818
|
+
}
|
1819
|
+
|
1820
|
+
void GlobalParams::setupBaseFonts(char *dir) {
|
1821
|
+
GString *fontName;
|
1822
|
+
GString *fileName;
|
1823
|
+
#ifdef WIN32
|
1824
|
+
HMODULE shell32Lib;
|
1825
|
+
BOOL (__stdcall *SHGetSpecialFolderPathFunc)(HWND hwndOwner,
|
1826
|
+
LPTSTR lpszPath,
|
1827
|
+
int nFolder,
|
1828
|
+
BOOL fCreate);
|
1829
|
+
char winFontDir[MAX_PATH];
|
1830
|
+
#endif
|
1831
|
+
FILE *f;
|
1832
|
+
DisplayFontParamKind kind;
|
1833
|
+
DisplayFontParam *dfp;
|
1834
|
+
int i, j;
|
1835
|
+
|
1836
|
+
#ifdef WIN32
|
1837
|
+
// SHGetSpecialFolderPath isn't available in older versions of
|
1838
|
+
// shell32.dll (Win95 and WinNT4), so do a dynamic load
|
1839
|
+
winFontDir[0] = '\0';
|
1840
|
+
if ((shell32Lib = LoadLibrary("shell32.dll"))) {
|
1841
|
+
if ((SHGetSpecialFolderPathFunc =
|
1842
|
+
(BOOL (__stdcall *)(HWND hwndOwner, LPTSTR lpszPath,
|
1843
|
+
int nFolder, BOOL fCreate))
|
1844
|
+
GetProcAddress(shell32Lib, "SHGetSpecialFolderPathA"))) {
|
1845
|
+
if (!(*SHGetSpecialFolderPathFunc)(NULL, winFontDir,
|
1846
|
+
CSIDL_FONTS, FALSE)) {
|
1847
|
+
winFontDir[0] = '\0';
|
1848
|
+
}
|
1849
|
+
}
|
1850
|
+
}
|
1851
|
+
#endif
|
1852
|
+
for (i = 0; displayFontTab[i].name; ++i) {
|
1853
|
+
fontName = new GString(displayFontTab[i].name);
|
1854
|
+
if (getDisplayFont(fontName)) {
|
1855
|
+
delete fontName;
|
1856
|
+
continue;
|
1857
|
+
}
|
1858
|
+
fileName = NULL;
|
1859
|
+
kind = displayFontT1; // make gcc happy
|
1860
|
+
if (dir) {
|
1861
|
+
fileName = appendToPath(new GString(dir), displayFontTab[i].t1FileName);
|
1862
|
+
kind = displayFontT1;
|
1863
|
+
if ((f = fopen(fileName->getCString(), "rb"))) {
|
1864
|
+
fclose(f);
|
1865
|
+
} else {
|
1866
|
+
delete fileName;
|
1867
|
+
fileName = NULL;
|
1868
|
+
}
|
1869
|
+
}
|
1870
|
+
#ifdef WIN32
|
1871
|
+
if (!fileName && winFontDir[0] && displayFontTab[i].ttFileName) {
|
1872
|
+
fileName = appendToPath(new GString(winFontDir),
|
1873
|
+
displayFontTab[i].ttFileName);
|
1874
|
+
kind = displayFontTT;
|
1875
|
+
if ((f = fopen(fileName->getCString(), "rb"))) {
|
1876
|
+
fclose(f);
|
1877
|
+
} else {
|
1878
|
+
delete fileName;
|
1879
|
+
fileName = NULL;
|
1880
|
+
}
|
1881
|
+
}
|
1882
|
+
// SHGetSpecialFolderPath(CSIDL_FONTS) doesn't work on Win 2k Server
|
1883
|
+
// or Win2003 Server, or with older versions of shell32.dll, so check
|
1884
|
+
// the "standard" directories
|
1885
|
+
if (displayFontTab[i].ttFileName) {
|
1886
|
+
for (j = 0; !fileName && displayFontDirs[j]; ++j) {
|
1887
|
+
fileName = appendToPath(new GString(displayFontDirs[j]),
|
1888
|
+
displayFontTab[i].ttFileName);
|
1889
|
+
kind = displayFontTT;
|
1890
|
+
if ((f = fopen(fileName->getCString(), "rb"))) {
|
1891
|
+
fclose(f);
|
1892
|
+
} else {
|
1893
|
+
delete fileName;
|
1894
|
+
fileName = NULL;
|
1895
|
+
}
|
1896
|
+
}
|
1897
|
+
}
|
1898
|
+
#else
|
1899
|
+
for (j = 0; !fileName && displayFontDirs[j]; ++j) {
|
1900
|
+
fileName = appendToPath(new GString(displayFontDirs[j]),
|
1901
|
+
displayFontTab[i].t1FileName);
|
1902
|
+
kind = displayFontT1;
|
1903
|
+
if ((f = fopen(fileName->getCString(), "rb"))) {
|
1904
|
+
fclose(f);
|
1905
|
+
} else {
|
1906
|
+
delete fileName;
|
1907
|
+
fileName = NULL;
|
1908
|
+
}
|
1909
|
+
}
|
1910
|
+
#endif
|
1911
|
+
if (!fileName) {
|
1912
|
+
error(-1, "No display font for '%s'", displayFontTab[i].name);
|
1913
|
+
delete fontName;
|
1914
|
+
continue;
|
1915
|
+
}
|
1916
|
+
dfp = new DisplayFontParam(fontName, kind);
|
1917
|
+
dfp->t1.fileName = fileName;
|
1918
|
+
globalParams->addDisplayFont(dfp);
|
1919
|
+
}
|
1920
|
+
|
1921
|
+
#ifdef WIN32
|
1922
|
+
if (winFontDir[0]) {
|
1923
|
+
winFontList = new WinFontList(winFontDir);
|
1924
|
+
}
|
1925
|
+
#endif
|
1926
|
+
}
|
1927
|
+
|
1928
|
+
//------------------------------------------------------------------------
|
1929
|
+
// accessors
|
1930
|
+
//------------------------------------------------------------------------
|
1931
|
+
|
1932
|
+
CharCode GlobalParams::getMacRomanCharCode(char *charName) {
|
1933
|
+
// no need to lock - macRomanReverseMap is constant
|
1934
|
+
return macRomanReverseMap->lookup(charName);
|
1935
|
+
}
|
1936
|
+
|
1937
|
+
GString *GlobalParams::getBaseDir() {
|
1938
|
+
GString *s;
|
1939
|
+
|
1940
|
+
lockGlobalParams;
|
1941
|
+
s = baseDir->copy();
|
1942
|
+
unlockGlobalParams;
|
1943
|
+
return s;
|
1944
|
+
}
|
1945
|
+
|
1946
|
+
Unicode GlobalParams::mapNameToUnicode(char *charName) {
|
1947
|
+
// no need to lock - nameToUnicode is constant
|
1948
|
+
return nameToUnicode->lookup(charName);
|
1949
|
+
}
|
1950
|
+
|
1951
|
+
UnicodeMap *GlobalParams::getResidentUnicodeMap(GString *encodingName) {
|
1952
|
+
UnicodeMap *map;
|
1953
|
+
|
1954
|
+
lockGlobalParams;
|
1955
|
+
map = (UnicodeMap *)residentUnicodeMaps->lookup(encodingName);
|
1956
|
+
unlockGlobalParams;
|
1957
|
+
if (map) {
|
1958
|
+
map->incRefCnt();
|
1959
|
+
}
|
1960
|
+
return map;
|
1961
|
+
}
|
1962
|
+
|
1963
|
+
FILE *GlobalParams::getUnicodeMapFile(GString *encodingName) {
|
1964
|
+
GString *fileName;
|
1965
|
+
FILE *f;
|
1966
|
+
|
1967
|
+
lockGlobalParams;
|
1968
|
+
if ((fileName = (GString *)unicodeMaps->lookup(encodingName))) {
|
1969
|
+
f = fopen(fileName->getCString(), "r");
|
1970
|
+
} else {
|
1971
|
+
f = NULL;
|
1972
|
+
}
|
1973
|
+
unlockGlobalParams;
|
1974
|
+
return f;
|
1975
|
+
}
|
1976
|
+
|
1977
|
+
FILE *GlobalParams::findCMapFile(GString *collection, GString *cMapName) {
|
1978
|
+
GList *list;
|
1979
|
+
GString *dir;
|
1980
|
+
GString *fileName;
|
1981
|
+
FILE *f;
|
1982
|
+
int i;
|
1983
|
+
|
1984
|
+
lockGlobalParams;
|
1985
|
+
if (!(list = (GList *)cMapDirs->lookup(collection))) {
|
1986
|
+
unlockGlobalParams;
|
1987
|
+
return NULL;
|
1988
|
+
}
|
1989
|
+
for (i = 0; i < list->getLength(); ++i) {
|
1990
|
+
dir = (GString *)list->get(i);
|
1991
|
+
fileName = appendToPath(dir->copy(), cMapName->getCString());
|
1992
|
+
f = fopen(fileName->getCString(), "r");
|
1993
|
+
delete fileName;
|
1994
|
+
if (f) {
|
1995
|
+
unlockGlobalParams;
|
1996
|
+
return f;
|
1997
|
+
}
|
1998
|
+
}
|
1999
|
+
unlockGlobalParams;
|
2000
|
+
return NULL;
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
FILE *GlobalParams::findToUnicodeFile(GString *name) {
|
2004
|
+
GString *dir, *fileName;
|
2005
|
+
FILE *f;
|
2006
|
+
int i;
|
2007
|
+
|
2008
|
+
lockGlobalParams;
|
2009
|
+
for (i = 0; i < toUnicodeDirs->getLength(); ++i) {
|
2010
|
+
dir = (GString *)toUnicodeDirs->get(i);
|
2011
|
+
fileName = appendToPath(dir->copy(), name->getCString());
|
2012
|
+
f = fopen(fileName->getCString(), "r");
|
2013
|
+
delete fileName;
|
2014
|
+
if (f) {
|
2015
|
+
unlockGlobalParams;
|
2016
|
+
return f;
|
2017
|
+
}
|
2018
|
+
}
|
2019
|
+
unlockGlobalParams;
|
2020
|
+
return NULL;
|
2021
|
+
}
|
2022
|
+
|
2023
|
+
DisplayFontParam *GlobalParams::getDisplayFont(GString *fontName) {
|
2024
|
+
DisplayFontParam *dfp;
|
2025
|
+
|
2026
|
+
lockGlobalParams;
|
2027
|
+
dfp = (DisplayFontParam *)displayFonts->lookup(fontName);
|
2028
|
+
#ifdef WIN32
|
2029
|
+
if (!dfp && winFontList) {
|
2030
|
+
dfp = winFontList->find(fontName);
|
2031
|
+
}
|
2032
|
+
#endif
|
2033
|
+
unlockGlobalParams;
|
2034
|
+
return dfp;
|
2035
|
+
}
|
2036
|
+
|
2037
|
+
DisplayFontParam *GlobalParams::getDisplayCIDFont(GString *fontName,
|
2038
|
+
GString *collection) {
|
2039
|
+
DisplayFontParam *dfp;
|
2040
|
+
|
2041
|
+
lockGlobalParams;
|
2042
|
+
if (!fontName ||
|
2043
|
+
!(dfp = (DisplayFontParam *)displayNamedCIDFonts->lookup(fontName))) {
|
2044
|
+
dfp = (DisplayFontParam *)displayCIDFonts->lookup(collection);
|
2045
|
+
}
|
2046
|
+
unlockGlobalParams;
|
2047
|
+
return dfp;
|
2048
|
+
}
|
2049
|
+
|
2050
|
+
GString *GlobalParams::getPSFile() {
|
2051
|
+
GString *s;
|
2052
|
+
|
2053
|
+
lockGlobalParams;
|
2054
|
+
s = psFile ? psFile->copy() : (GString *)NULL;
|
2055
|
+
unlockGlobalParams;
|
2056
|
+
return s;
|
2057
|
+
}
|
2058
|
+
|
2059
|
+
int GlobalParams::getPSPaperWidth() {
|
2060
|
+
int w;
|
2061
|
+
|
2062
|
+
lockGlobalParams;
|
2063
|
+
w = psPaperWidth;
|
2064
|
+
unlockGlobalParams;
|
2065
|
+
return w;
|
2066
|
+
}
|
2067
|
+
|
2068
|
+
int GlobalParams::getPSPaperHeight() {
|
2069
|
+
int h;
|
2070
|
+
|
2071
|
+
lockGlobalParams;
|
2072
|
+
h = psPaperHeight;
|
2073
|
+
unlockGlobalParams;
|
2074
|
+
return h;
|
2075
|
+
}
|
2076
|
+
|
2077
|
+
void GlobalParams::getPSImageableArea(int *llx, int *lly, int *urx, int *ury) {
|
2078
|
+
lockGlobalParams;
|
2079
|
+
*llx = psImageableLLX;
|
2080
|
+
*lly = psImageableLLY;
|
2081
|
+
*urx = psImageableURX;
|
2082
|
+
*ury = psImageableURY;
|
2083
|
+
unlockGlobalParams;
|
2084
|
+
}
|
2085
|
+
|
2086
|
+
GBool GlobalParams::getPSCrop() {
|
2087
|
+
GBool f;
|
2088
|
+
|
2089
|
+
lockGlobalParams;
|
2090
|
+
f = psCrop;
|
2091
|
+
unlockGlobalParams;
|
2092
|
+
return f;
|
2093
|
+
}
|
2094
|
+
|
2095
|
+
GBool GlobalParams::getPSExpandSmaller() {
|
2096
|
+
GBool f;
|
2097
|
+
|
2098
|
+
lockGlobalParams;
|
2099
|
+
f = psExpandSmaller;
|
2100
|
+
unlockGlobalParams;
|
2101
|
+
return f;
|
2102
|
+
}
|
2103
|
+
|
2104
|
+
GBool GlobalParams::getPSShrinkLarger() {
|
2105
|
+
GBool f;
|
2106
|
+
|
2107
|
+
lockGlobalParams;
|
2108
|
+
f = psShrinkLarger;
|
2109
|
+
unlockGlobalParams;
|
2110
|
+
return f;
|
2111
|
+
}
|
2112
|
+
|
2113
|
+
GBool GlobalParams::getPSCenter() {
|
2114
|
+
GBool f;
|
2115
|
+
|
2116
|
+
lockGlobalParams;
|
2117
|
+
f = psCenter;
|
2118
|
+
unlockGlobalParams;
|
2119
|
+
return f;
|
2120
|
+
}
|
2121
|
+
|
2122
|
+
GBool GlobalParams::getPSDuplex() {
|
2123
|
+
GBool d;
|
2124
|
+
|
2125
|
+
lockGlobalParams;
|
2126
|
+
d = psDuplex;
|
2127
|
+
unlockGlobalParams;
|
2128
|
+
return d;
|
2129
|
+
}
|
2130
|
+
|
2131
|
+
PSLevel GlobalParams::getPSLevel() {
|
2132
|
+
PSLevel level;
|
2133
|
+
|
2134
|
+
lockGlobalParams;
|
2135
|
+
level = psLevel;
|
2136
|
+
unlockGlobalParams;
|
2137
|
+
return level;
|
2138
|
+
}
|
2139
|
+
|
2140
|
+
PSFontParam *GlobalParams::getPSFont(GString *fontName) {
|
2141
|
+
PSFontParam *p;
|
2142
|
+
|
2143
|
+
lockGlobalParams;
|
2144
|
+
p = (PSFontParam *)psFonts->lookup(fontName);
|
2145
|
+
unlockGlobalParams;
|
2146
|
+
return p;
|
2147
|
+
}
|
2148
|
+
|
2149
|
+
PSFontParam *GlobalParams::getPSFont16(GString *fontName,
|
2150
|
+
GString *collection, int wMode) {
|
2151
|
+
PSFontParam *p;
|
2152
|
+
int i;
|
2153
|
+
|
2154
|
+
lockGlobalParams;
|
2155
|
+
p = NULL;
|
2156
|
+
if (fontName) {
|
2157
|
+
for (i = 0; i < psNamedFonts16->getLength(); ++i) {
|
2158
|
+
p = (PSFontParam *)psNamedFonts16->get(i);
|
2159
|
+
if (!p->pdfFontName->cmp(fontName) &&
|
2160
|
+
p->wMode == wMode) {
|
2161
|
+
break;
|
2162
|
+
}
|
2163
|
+
p = NULL;
|
2164
|
+
}
|
2165
|
+
}
|
2166
|
+
if (!p && collection) {
|
2167
|
+
for (i = 0; i < psFonts16->getLength(); ++i) {
|
2168
|
+
p = (PSFontParam *)psFonts16->get(i);
|
2169
|
+
if (!p->pdfFontName->cmp(collection) &&
|
2170
|
+
p->wMode == wMode) {
|
2171
|
+
break;
|
2172
|
+
}
|
2173
|
+
p = NULL;
|
2174
|
+
}
|
2175
|
+
}
|
2176
|
+
unlockGlobalParams;
|
2177
|
+
return p;
|
2178
|
+
}
|
2179
|
+
|
2180
|
+
GBool GlobalParams::getPSEmbedType1() {
|
2181
|
+
GBool e;
|
2182
|
+
|
2183
|
+
lockGlobalParams;
|
2184
|
+
e = psEmbedType1;
|
2185
|
+
unlockGlobalParams;
|
2186
|
+
return e;
|
2187
|
+
}
|
2188
|
+
|
2189
|
+
GBool GlobalParams::getPSEmbedTrueType() {
|
2190
|
+
GBool e;
|
2191
|
+
|
2192
|
+
lockGlobalParams;
|
2193
|
+
e = psEmbedTrueType;
|
2194
|
+
unlockGlobalParams;
|
2195
|
+
return e;
|
2196
|
+
}
|
2197
|
+
|
2198
|
+
GBool GlobalParams::getPSEmbedCIDPostScript() {
|
2199
|
+
GBool e;
|
2200
|
+
|
2201
|
+
lockGlobalParams;
|
2202
|
+
e = psEmbedCIDPostScript;
|
2203
|
+
unlockGlobalParams;
|
2204
|
+
return e;
|
2205
|
+
}
|
2206
|
+
|
2207
|
+
GBool GlobalParams::getPSEmbedCIDTrueType() {
|
2208
|
+
GBool e;
|
2209
|
+
|
2210
|
+
lockGlobalParams;
|
2211
|
+
e = psEmbedCIDTrueType;
|
2212
|
+
unlockGlobalParams;
|
2213
|
+
return e;
|
2214
|
+
}
|
2215
|
+
|
2216
|
+
GBool GlobalParams::getPSPreload() {
|
2217
|
+
GBool preload;
|
2218
|
+
|
2219
|
+
lockGlobalParams;
|
2220
|
+
preload = psPreload;
|
2221
|
+
unlockGlobalParams;
|
2222
|
+
return preload;
|
2223
|
+
}
|
2224
|
+
|
2225
|
+
GBool GlobalParams::getPSOPI() {
|
2226
|
+
GBool opi;
|
2227
|
+
|
2228
|
+
lockGlobalParams;
|
2229
|
+
opi = psOPI;
|
2230
|
+
unlockGlobalParams;
|
2231
|
+
return opi;
|
2232
|
+
}
|
2233
|
+
|
2234
|
+
GBool GlobalParams::getPSASCIIHex() {
|
2235
|
+
GBool ah;
|
2236
|
+
|
2237
|
+
lockGlobalParams;
|
2238
|
+
ah = psASCIIHex;
|
2239
|
+
unlockGlobalParams;
|
2240
|
+
return ah;
|
2241
|
+
}
|
2242
|
+
|
2243
|
+
GString *GlobalParams::getTextEncodingName() {
|
2244
|
+
GString *s;
|
2245
|
+
|
2246
|
+
lockGlobalParams;
|
2247
|
+
s = textEncoding->copy();
|
2248
|
+
unlockGlobalParams;
|
2249
|
+
return s;
|
2250
|
+
}
|
2251
|
+
|
2252
|
+
EndOfLineKind GlobalParams::getTextEOL() {
|
2253
|
+
EndOfLineKind eol;
|
2254
|
+
|
2255
|
+
lockGlobalParams;
|
2256
|
+
eol = textEOL;
|
2257
|
+
unlockGlobalParams;
|
2258
|
+
return eol;
|
2259
|
+
}
|
2260
|
+
|
2261
|
+
GBool GlobalParams::getTextPageBreaks() {
|
2262
|
+
GBool pageBreaks;
|
2263
|
+
|
2264
|
+
lockGlobalParams;
|
2265
|
+
pageBreaks = textPageBreaks;
|
2266
|
+
unlockGlobalParams;
|
2267
|
+
return pageBreaks;
|
2268
|
+
}
|
2269
|
+
|
2270
|
+
GBool GlobalParams::getTextKeepTinyChars() {
|
2271
|
+
GBool tiny;
|
2272
|
+
|
2273
|
+
lockGlobalParams;
|
2274
|
+
tiny = textKeepTinyChars;
|
2275
|
+
unlockGlobalParams;
|
2276
|
+
return tiny;
|
2277
|
+
}
|
2278
|
+
|
2279
|
+
GString *GlobalParams::findFontFile(GString *fontName, char **exts) {
|
2280
|
+
GString *dir, *fileName;
|
2281
|
+
char **ext;
|
2282
|
+
FILE *f;
|
2283
|
+
int i;
|
2284
|
+
|
2285
|
+
lockGlobalParams;
|
2286
|
+
for (i = 0; i < fontDirs->getLength(); ++i) {
|
2287
|
+
dir = (GString *)fontDirs->get(i);
|
2288
|
+
for (ext = exts; *ext; ++ext) {
|
2289
|
+
fileName = appendToPath(dir->copy(), fontName->getCString());
|
2290
|
+
fileName->append(*ext);
|
2291
|
+
if ((f = fopen(fileName->getCString(), "rb"))) {
|
2292
|
+
fclose(f);
|
2293
|
+
unlockGlobalParams;
|
2294
|
+
return fileName;
|
2295
|
+
}
|
2296
|
+
delete fileName;
|
2297
|
+
}
|
2298
|
+
}
|
2299
|
+
unlockGlobalParams;
|
2300
|
+
return NULL;
|
2301
|
+
}
|
2302
|
+
|
2303
|
+
GString *GlobalParams::getInitialZoom() {
|
2304
|
+
GString *s;
|
2305
|
+
|
2306
|
+
lockGlobalParams;
|
2307
|
+
s = initialZoom->copy();
|
2308
|
+
unlockGlobalParams;
|
2309
|
+
return s;
|
2310
|
+
}
|
2311
|
+
|
2312
|
+
GBool GlobalParams::getContinuousView() {
|
2313
|
+
GBool f;
|
2314
|
+
|
2315
|
+
lockGlobalParams;
|
2316
|
+
f = continuousView;
|
2317
|
+
unlockGlobalParams;
|
2318
|
+
return f;
|
2319
|
+
}
|
2320
|
+
|
2321
|
+
GBool GlobalParams::getEnableT1lib() {
|
2322
|
+
GBool f;
|
2323
|
+
|
2324
|
+
lockGlobalParams;
|
2325
|
+
f = enableT1lib;
|
2326
|
+
unlockGlobalParams;
|
2327
|
+
return f;
|
2328
|
+
}
|
2329
|
+
|
2330
|
+
GBool GlobalParams::getEnableFreeType() {
|
2331
|
+
GBool f;
|
2332
|
+
|
2333
|
+
lockGlobalParams;
|
2334
|
+
f = enableFreeType;
|
2335
|
+
unlockGlobalParams;
|
2336
|
+
return f;
|
2337
|
+
}
|
2338
|
+
|
2339
|
+
|
2340
|
+
GBool GlobalParams::getAntialias() {
|
2341
|
+
GBool f;
|
2342
|
+
|
2343
|
+
lockGlobalParams;
|
2344
|
+
f = antialias;
|
2345
|
+
unlockGlobalParams;
|
2346
|
+
return f;
|
2347
|
+
}
|
2348
|
+
|
2349
|
+
GBool GlobalParams::getVectorAntialias() {
|
2350
|
+
GBool f;
|
2351
|
+
|
2352
|
+
lockGlobalParams;
|
2353
|
+
f = vectorAntialias;
|
2354
|
+
unlockGlobalParams;
|
2355
|
+
return f;
|
2356
|
+
}
|
2357
|
+
|
2358
|
+
GBool GlobalParams::getStrokeAdjust() {
|
2359
|
+
GBool f;
|
2360
|
+
|
2361
|
+
lockGlobalParams;
|
2362
|
+
f = strokeAdjust;
|
2363
|
+
unlockGlobalParams;
|
2364
|
+
return f;
|
2365
|
+
}
|
2366
|
+
|
2367
|
+
ScreenType GlobalParams::getScreenType() {
|
2368
|
+
ScreenType t;
|
2369
|
+
|
2370
|
+
lockGlobalParams;
|
2371
|
+
t = screenType;
|
2372
|
+
unlockGlobalParams;
|
2373
|
+
return t;
|
2374
|
+
}
|
2375
|
+
|
2376
|
+
int GlobalParams::getScreenSize() {
|
2377
|
+
int size;
|
2378
|
+
|
2379
|
+
lockGlobalParams;
|
2380
|
+
size = screenSize;
|
2381
|
+
unlockGlobalParams;
|
2382
|
+
return size;
|
2383
|
+
}
|
2384
|
+
|
2385
|
+
int GlobalParams::getScreenDotRadius() {
|
2386
|
+
int r;
|
2387
|
+
|
2388
|
+
lockGlobalParams;
|
2389
|
+
r = screenDotRadius;
|
2390
|
+
unlockGlobalParams;
|
2391
|
+
return r;
|
2392
|
+
}
|
2393
|
+
|
2394
|
+
double GlobalParams::getScreenGamma() {
|
2395
|
+
double gamma;
|
2396
|
+
|
2397
|
+
lockGlobalParams;
|
2398
|
+
gamma = screenGamma;
|
2399
|
+
unlockGlobalParams;
|
2400
|
+
return gamma;
|
2401
|
+
}
|
2402
|
+
|
2403
|
+
double GlobalParams::getScreenBlackThreshold() {
|
2404
|
+
double thresh;
|
2405
|
+
|
2406
|
+
lockGlobalParams;
|
2407
|
+
thresh = screenBlackThreshold;
|
2408
|
+
unlockGlobalParams;
|
2409
|
+
return thresh;
|
2410
|
+
}
|
2411
|
+
|
2412
|
+
double GlobalParams::getScreenWhiteThreshold() {
|
2413
|
+
double thresh;
|
2414
|
+
|
2415
|
+
lockGlobalParams;
|
2416
|
+
thresh = screenWhiteThreshold;
|
2417
|
+
unlockGlobalParams;
|
2418
|
+
return thresh;
|
2419
|
+
}
|
2420
|
+
|
2421
|
+
GBool GlobalParams::getMapNumericCharNames() {
|
2422
|
+
GBool map;
|
2423
|
+
|
2424
|
+
lockGlobalParams;
|
2425
|
+
map = mapNumericCharNames;
|
2426
|
+
unlockGlobalParams;
|
2427
|
+
return map;
|
2428
|
+
}
|
2429
|
+
|
2430
|
+
GBool GlobalParams::getMapUnknownCharNames() {
|
2431
|
+
GBool map;
|
2432
|
+
|
2433
|
+
lockGlobalParams;
|
2434
|
+
map = mapUnknownCharNames;
|
2435
|
+
unlockGlobalParams;
|
2436
|
+
return map;
|
2437
|
+
}
|
2438
|
+
|
2439
|
+
GList *GlobalParams::getKeyBinding(int code, int mods, int context) {
|
2440
|
+
KeyBinding *binding;
|
2441
|
+
GList *cmds;
|
2442
|
+
int modMask;
|
2443
|
+
int i, j;
|
2444
|
+
|
2445
|
+
lockGlobalParams;
|
2446
|
+
cmds = NULL;
|
2447
|
+
// for ASCII chars, ignore the shift modifier
|
2448
|
+
modMask = code <= 0xff ? ~xpdfKeyModShift : ~0;
|
2449
|
+
for (i = 0; i < keyBindings->getLength(); ++i) {
|
2450
|
+
binding = (KeyBinding *)keyBindings->get(i);
|
2451
|
+
if (binding->code == code &&
|
2452
|
+
(binding->mods & modMask) == (mods & modMask) &&
|
2453
|
+
(~binding->context | context) == ~0) {
|
2454
|
+
cmds = new GList();
|
2455
|
+
for (j = 0; j < binding->cmds->getLength(); ++j) {
|
2456
|
+
cmds->append(((GString *)binding->cmds->get(j))->copy());
|
2457
|
+
}
|
2458
|
+
break;
|
2459
|
+
}
|
2460
|
+
}
|
2461
|
+
unlockGlobalParams;
|
2462
|
+
return cmds;
|
2463
|
+
}
|
2464
|
+
|
2465
|
+
GBool GlobalParams::getPrintCommands() {
|
2466
|
+
GBool p;
|
2467
|
+
|
2468
|
+
lockGlobalParams;
|
2469
|
+
p = printCommands;
|
2470
|
+
unlockGlobalParams;
|
2471
|
+
return p;
|
2472
|
+
}
|
2473
|
+
|
2474
|
+
GBool GlobalParams::getErrQuiet() {
|
2475
|
+
// no locking -- this function may get called from inside a locked
|
2476
|
+
// section
|
2477
|
+
return errQuiet;
|
2478
|
+
}
|
2479
|
+
|
2480
|
+
CharCodeToUnicode *GlobalParams::getCIDToUnicode(GString *collection) {
|
2481
|
+
GString *fileName;
|
2482
|
+
CharCodeToUnicode *ctu;
|
2483
|
+
|
2484
|
+
lockGlobalParams;
|
2485
|
+
if (!(ctu = cidToUnicodeCache->getCharCodeToUnicode(collection))) {
|
2486
|
+
if ((fileName = (GString *)cidToUnicodes->lookup(collection)) &&
|
2487
|
+
(ctu = CharCodeToUnicode::parseCIDToUnicode(fileName, collection))) {
|
2488
|
+
cidToUnicodeCache->add(ctu);
|
2489
|
+
}
|
2490
|
+
}
|
2491
|
+
unlockGlobalParams;
|
2492
|
+
return ctu;
|
2493
|
+
}
|
2494
|
+
|
2495
|
+
CharCodeToUnicode *GlobalParams::getUnicodeToUnicode(GString *fontName) {
|
2496
|
+
CharCodeToUnicode *ctu;
|
2497
|
+
GHashIter *iter;
|
2498
|
+
GString *fontPattern, *fileName;
|
2499
|
+
|
2500
|
+
lockGlobalParams;
|
2501
|
+
fileName = NULL;
|
2502
|
+
unicodeToUnicodes->startIter(&iter);
|
2503
|
+
while (unicodeToUnicodes->getNext(&iter, &fontPattern, (void **)&fileName)) {
|
2504
|
+
if (strstr(fontName->getCString(), fontPattern->getCString())) {
|
2505
|
+
unicodeToUnicodes->killIter(&iter);
|
2506
|
+
break;
|
2507
|
+
}
|
2508
|
+
fileName = NULL;
|
2509
|
+
}
|
2510
|
+
if (fileName) {
|
2511
|
+
if (!(ctu = unicodeToUnicodeCache->getCharCodeToUnicode(fileName))) {
|
2512
|
+
if ((ctu = CharCodeToUnicode::parseUnicodeToUnicode(fileName))) {
|
2513
|
+
unicodeToUnicodeCache->add(ctu);
|
2514
|
+
}
|
2515
|
+
}
|
2516
|
+
} else {
|
2517
|
+
ctu = NULL;
|
2518
|
+
}
|
2519
|
+
unlockGlobalParams;
|
2520
|
+
return ctu;
|
2521
|
+
}
|
2522
|
+
|
2523
|
+
UnicodeMap *GlobalParams::getUnicodeMap(GString *encodingName) {
|
2524
|
+
return getUnicodeMap2(encodingName);
|
2525
|
+
}
|
2526
|
+
|
2527
|
+
UnicodeMap *GlobalParams::getUnicodeMap2(GString *encodingName) {
|
2528
|
+
UnicodeMap *map;
|
2529
|
+
|
2530
|
+
if (!(map = getResidentUnicodeMap(encodingName))) {
|
2531
|
+
lockUnicodeMapCache;
|
2532
|
+
map = unicodeMapCache->getUnicodeMap(encodingName);
|
2533
|
+
unlockUnicodeMapCache;
|
2534
|
+
}
|
2535
|
+
return map;
|
2536
|
+
}
|
2537
|
+
|
2538
|
+
CMap *GlobalParams::getCMap(GString *collection, GString *cMapName) {
|
2539
|
+
CMap *cMap;
|
2540
|
+
|
2541
|
+
lockCMapCache;
|
2542
|
+
cMap = cMapCache->getCMap(collection, cMapName);
|
2543
|
+
unlockCMapCache;
|
2544
|
+
return cMap;
|
2545
|
+
}
|
2546
|
+
|
2547
|
+
UnicodeMap *GlobalParams::getTextEncoding() {
|
2548
|
+
return getUnicodeMap2(textEncoding);
|
2549
|
+
}
|
2550
|
+
|
2551
|
+
//------------------------------------------------------------------------
|
2552
|
+
// functions to set parameters
|
2553
|
+
//------------------------------------------------------------------------
|
2554
|
+
|
2555
|
+
void GlobalParams::addDisplayFont(DisplayFontParam *param) {
|
2556
|
+
DisplayFontParam *old;
|
2557
|
+
|
2558
|
+
lockGlobalParams;
|
2559
|
+
if ((old = (DisplayFontParam *)displayFonts->remove(param->name))) {
|
2560
|
+
delete old;
|
2561
|
+
}
|
2562
|
+
displayFonts->add(param->name, param);
|
2563
|
+
unlockGlobalParams;
|
2564
|
+
}
|
2565
|
+
|
2566
|
+
void GlobalParams::setPSFile(char *file) {
|
2567
|
+
lockGlobalParams;
|
2568
|
+
if (psFile) {
|
2569
|
+
delete psFile;
|
2570
|
+
}
|
2571
|
+
psFile = new GString(file);
|
2572
|
+
unlockGlobalParams;
|
2573
|
+
}
|
2574
|
+
|
2575
|
+
GBool GlobalParams::setPSPaperSize(char *size) {
|
2576
|
+
lockGlobalParams;
|
2577
|
+
if (!strcmp(size, "match")) {
|
2578
|
+
psPaperWidth = psPaperHeight = -1;
|
2579
|
+
} else if (!strcmp(size, "letter")) {
|
2580
|
+
psPaperWidth = 612;
|
2581
|
+
psPaperHeight = 792;
|
2582
|
+
} else if (!strcmp(size, "legal")) {
|
2583
|
+
psPaperWidth = 612;
|
2584
|
+
psPaperHeight = 1008;
|
2585
|
+
} else if (!strcmp(size, "A4")) {
|
2586
|
+
psPaperWidth = 595;
|
2587
|
+
psPaperHeight = 842;
|
2588
|
+
} else if (!strcmp(size, "A3")) {
|
2589
|
+
psPaperWidth = 842;
|
2590
|
+
psPaperHeight = 1190;
|
2591
|
+
} else {
|
2592
|
+
unlockGlobalParams;
|
2593
|
+
return gFalse;
|
2594
|
+
}
|
2595
|
+
psImageableLLX = psImageableLLY = 0;
|
2596
|
+
psImageableURX = psPaperWidth;
|
2597
|
+
psImageableURY = psPaperHeight;
|
2598
|
+
unlockGlobalParams;
|
2599
|
+
return gTrue;
|
2600
|
+
}
|
2601
|
+
|
2602
|
+
void GlobalParams::setPSPaperWidth(int width) {
|
2603
|
+
lockGlobalParams;
|
2604
|
+
psPaperWidth = width;
|
2605
|
+
psImageableLLX = 0;
|
2606
|
+
psImageableURX = psPaperWidth;
|
2607
|
+
unlockGlobalParams;
|
2608
|
+
}
|
2609
|
+
|
2610
|
+
void GlobalParams::setPSPaperHeight(int height) {
|
2611
|
+
lockGlobalParams;
|
2612
|
+
psPaperHeight = height;
|
2613
|
+
psImageableLLY = 0;
|
2614
|
+
psImageableURY = psPaperHeight;
|
2615
|
+
unlockGlobalParams;
|
2616
|
+
}
|
2617
|
+
|
2618
|
+
void GlobalParams::setPSImageableArea(int llx, int lly, int urx, int ury) {
|
2619
|
+
lockGlobalParams;
|
2620
|
+
psImageableLLX = llx;
|
2621
|
+
psImageableLLY = lly;
|
2622
|
+
psImageableURX = urx;
|
2623
|
+
psImageableURY = ury;
|
2624
|
+
unlockGlobalParams;
|
2625
|
+
}
|
2626
|
+
|
2627
|
+
void GlobalParams::setPSCrop(GBool crop) {
|
2628
|
+
lockGlobalParams;
|
2629
|
+
psCrop = crop;
|
2630
|
+
unlockGlobalParams;
|
2631
|
+
}
|
2632
|
+
|
2633
|
+
void GlobalParams::setPSExpandSmaller(GBool expand) {
|
2634
|
+
lockGlobalParams;
|
2635
|
+
psExpandSmaller = expand;
|
2636
|
+
unlockGlobalParams;
|
2637
|
+
}
|
2638
|
+
|
2639
|
+
void GlobalParams::setPSShrinkLarger(GBool shrink) {
|
2640
|
+
lockGlobalParams;
|
2641
|
+
psShrinkLarger = shrink;
|
2642
|
+
unlockGlobalParams;
|
2643
|
+
}
|
2644
|
+
|
2645
|
+
void GlobalParams::setPSCenter(GBool center) {
|
2646
|
+
lockGlobalParams;
|
2647
|
+
psCenter = center;
|
2648
|
+
unlockGlobalParams;
|
2649
|
+
}
|
2650
|
+
|
2651
|
+
void GlobalParams::setPSDuplex(GBool duplex) {
|
2652
|
+
lockGlobalParams;
|
2653
|
+
psDuplex = duplex;
|
2654
|
+
unlockGlobalParams;
|
2655
|
+
}
|
2656
|
+
|
2657
|
+
void GlobalParams::setPSLevel(PSLevel level) {
|
2658
|
+
lockGlobalParams;
|
2659
|
+
psLevel = level;
|
2660
|
+
unlockGlobalParams;
|
2661
|
+
}
|
2662
|
+
|
2663
|
+
void GlobalParams::setPSEmbedType1(GBool embed) {
|
2664
|
+
lockGlobalParams;
|
2665
|
+
psEmbedType1 = embed;
|
2666
|
+
unlockGlobalParams;
|
2667
|
+
}
|
2668
|
+
|
2669
|
+
void GlobalParams::setPSEmbedTrueType(GBool embed) {
|
2670
|
+
lockGlobalParams;
|
2671
|
+
psEmbedTrueType = embed;
|
2672
|
+
unlockGlobalParams;
|
2673
|
+
}
|
2674
|
+
|
2675
|
+
void GlobalParams::setPSEmbedCIDPostScript(GBool embed) {
|
2676
|
+
lockGlobalParams;
|
2677
|
+
psEmbedCIDPostScript = embed;
|
2678
|
+
unlockGlobalParams;
|
2679
|
+
}
|
2680
|
+
|
2681
|
+
void GlobalParams::setPSEmbedCIDTrueType(GBool embed) {
|
2682
|
+
lockGlobalParams;
|
2683
|
+
psEmbedCIDTrueType = embed;
|
2684
|
+
unlockGlobalParams;
|
2685
|
+
}
|
2686
|
+
|
2687
|
+
void GlobalParams::setPSPreload(GBool preload) {
|
2688
|
+
lockGlobalParams;
|
2689
|
+
psPreload = preload;
|
2690
|
+
unlockGlobalParams;
|
2691
|
+
}
|
2692
|
+
|
2693
|
+
void GlobalParams::setPSOPI(GBool opi) {
|
2694
|
+
lockGlobalParams;
|
2695
|
+
psOPI = opi;
|
2696
|
+
unlockGlobalParams;
|
2697
|
+
}
|
2698
|
+
|
2699
|
+
void GlobalParams::setPSASCIIHex(GBool hex) {
|
2700
|
+
lockGlobalParams;
|
2701
|
+
psASCIIHex = hex;
|
2702
|
+
unlockGlobalParams;
|
2703
|
+
}
|
2704
|
+
|
2705
|
+
void GlobalParams::setTextEncoding(char *encodingName) {
|
2706
|
+
lockGlobalParams;
|
2707
|
+
delete textEncoding;
|
2708
|
+
textEncoding = new GString(encodingName);
|
2709
|
+
unlockGlobalParams;
|
2710
|
+
}
|
2711
|
+
|
2712
|
+
GBool GlobalParams::setTextEOL(char *s) {
|
2713
|
+
lockGlobalParams;
|
2714
|
+
if (!strcmp(s, "unix")) {
|
2715
|
+
textEOL = eolUnix;
|
2716
|
+
} else if (!strcmp(s, "dos")) {
|
2717
|
+
textEOL = eolDOS;
|
2718
|
+
} else if (!strcmp(s, "mac")) {
|
2719
|
+
textEOL = eolMac;
|
2720
|
+
} else {
|
2721
|
+
unlockGlobalParams;
|
2722
|
+
return gFalse;
|
2723
|
+
}
|
2724
|
+
unlockGlobalParams;
|
2725
|
+
return gTrue;
|
2726
|
+
}
|
2727
|
+
|
2728
|
+
void GlobalParams::setTextPageBreaks(GBool pageBreaks) {
|
2729
|
+
lockGlobalParams;
|
2730
|
+
textPageBreaks = pageBreaks;
|
2731
|
+
unlockGlobalParams;
|
2732
|
+
}
|
2733
|
+
|
2734
|
+
void GlobalParams::setTextKeepTinyChars(GBool keep) {
|
2735
|
+
lockGlobalParams;
|
2736
|
+
textKeepTinyChars = keep;
|
2737
|
+
unlockGlobalParams;
|
2738
|
+
}
|
2739
|
+
|
2740
|
+
void GlobalParams::setInitialZoom(char *s) {
|
2741
|
+
lockGlobalParams;
|
2742
|
+
delete initialZoom;
|
2743
|
+
initialZoom = new GString(s);
|
2744
|
+
unlockGlobalParams;
|
2745
|
+
}
|
2746
|
+
|
2747
|
+
void GlobalParams::setContinuousView(GBool cont) {
|
2748
|
+
lockGlobalParams;
|
2749
|
+
continuousView = cont;
|
2750
|
+
unlockGlobalParams;
|
2751
|
+
}
|
2752
|
+
|
2753
|
+
GBool GlobalParams::setEnableT1lib(char *s) {
|
2754
|
+
GBool ok;
|
2755
|
+
|
2756
|
+
lockGlobalParams;
|
2757
|
+
ok = parseYesNo2(s, &enableT1lib);
|
2758
|
+
unlockGlobalParams;
|
2759
|
+
return ok;
|
2760
|
+
}
|
2761
|
+
|
2762
|
+
GBool GlobalParams::setEnableFreeType(char *s) {
|
2763
|
+
GBool ok;
|
2764
|
+
|
2765
|
+
lockGlobalParams;
|
2766
|
+
ok = parseYesNo2(s, &enableFreeType);
|
2767
|
+
unlockGlobalParams;
|
2768
|
+
return ok;
|
2769
|
+
}
|
2770
|
+
|
2771
|
+
|
2772
|
+
GBool GlobalParams::setAntialias(char *s) {
|
2773
|
+
GBool ok;
|
2774
|
+
|
2775
|
+
lockGlobalParams;
|
2776
|
+
ok = parseYesNo2(s, &antialias);
|
2777
|
+
unlockGlobalParams;
|
2778
|
+
return ok;
|
2779
|
+
}
|
2780
|
+
|
2781
|
+
GBool GlobalParams::setVectorAntialias(char *s) {
|
2782
|
+
GBool ok;
|
2783
|
+
|
2784
|
+
lockGlobalParams;
|
2785
|
+
ok = parseYesNo2(s, &vectorAntialias);
|
2786
|
+
unlockGlobalParams;
|
2787
|
+
return ok;
|
2788
|
+
}
|
2789
|
+
|
2790
|
+
void GlobalParams::setScreenType(ScreenType t) {
|
2791
|
+
lockGlobalParams;
|
2792
|
+
screenType = t;
|
2793
|
+
unlockGlobalParams;
|
2794
|
+
}
|
2795
|
+
|
2796
|
+
void GlobalParams::setScreenSize(int size) {
|
2797
|
+
lockGlobalParams;
|
2798
|
+
screenSize = size;
|
2799
|
+
unlockGlobalParams;
|
2800
|
+
}
|
2801
|
+
|
2802
|
+
void GlobalParams::setScreenDotRadius(int r) {
|
2803
|
+
lockGlobalParams;
|
2804
|
+
screenDotRadius = r;
|
2805
|
+
unlockGlobalParams;
|
2806
|
+
}
|
2807
|
+
|
2808
|
+
void GlobalParams::setScreenGamma(double gamma) {
|
2809
|
+
lockGlobalParams;
|
2810
|
+
screenGamma = gamma;
|
2811
|
+
unlockGlobalParams;
|
2812
|
+
}
|
2813
|
+
|
2814
|
+
void GlobalParams::setScreenBlackThreshold(double thresh) {
|
2815
|
+
lockGlobalParams;
|
2816
|
+
screenBlackThreshold = thresh;
|
2817
|
+
unlockGlobalParams;
|
2818
|
+
}
|
2819
|
+
|
2820
|
+
void GlobalParams::setScreenWhiteThreshold(double thresh) {
|
2821
|
+
lockGlobalParams;
|
2822
|
+
screenWhiteThreshold = thresh;
|
2823
|
+
unlockGlobalParams;
|
2824
|
+
}
|
2825
|
+
|
2826
|
+
void GlobalParams::setMapNumericCharNames(GBool map) {
|
2827
|
+
lockGlobalParams;
|
2828
|
+
mapNumericCharNames = map;
|
2829
|
+
unlockGlobalParams;
|
2830
|
+
}
|
2831
|
+
|
2832
|
+
void GlobalParams::setMapUnknownCharNames(GBool map) {
|
2833
|
+
lockGlobalParams;
|
2834
|
+
mapUnknownCharNames = map;
|
2835
|
+
unlockGlobalParams;
|
2836
|
+
}
|
2837
|
+
|
2838
|
+
void GlobalParams::setPrintCommands(GBool printCommandsA) {
|
2839
|
+
lockGlobalParams;
|
2840
|
+
printCommands = printCommandsA;
|
2841
|
+
unlockGlobalParams;
|
2842
|
+
}
|
2843
|
+
|
2844
|
+
void GlobalParams::setErrQuiet(GBool errQuietA) {
|
2845
|
+
lockGlobalParams;
|
2846
|
+
errQuiet = errQuietA;
|
2847
|
+
unlockGlobalParams;
|
2848
|
+
}
|
2849
|
+
|
2850
|
+
void GlobalParams::addSecurityHandler(XpdfSecurityHandler *handler) {
|
2851
|
+
#ifdef ENABLE_PLUGINS
|
2852
|
+
lockGlobalParams;
|
2853
|
+
securityHandlers->append(handler);
|
2854
|
+
unlockGlobalParams;
|
2855
|
+
#endif
|
2856
|
+
}
|
2857
|
+
|
2858
|
+
XpdfSecurityHandler *GlobalParams::getSecurityHandler(char *name) {
|
2859
|
+
#ifdef ENABLE_PLUGINS
|
2860
|
+
XpdfSecurityHandler *hdlr;
|
2861
|
+
int i;
|
2862
|
+
|
2863
|
+
lockGlobalParams;
|
2864
|
+
for (i = 0; i < securityHandlers->getLength(); ++i) {
|
2865
|
+
hdlr = (XpdfSecurityHandler *)securityHandlers->get(i);
|
2866
|
+
if (!strcasecmp(hdlr->name, name)) {
|
2867
|
+
unlockGlobalParams;
|
2868
|
+
return hdlr;
|
2869
|
+
}
|
2870
|
+
}
|
2871
|
+
unlockGlobalParams;
|
2872
|
+
|
2873
|
+
if (!loadPlugin("security", name)) {
|
2874
|
+
return NULL;
|
2875
|
+
}
|
2876
|
+
|
2877
|
+
lockGlobalParams;
|
2878
|
+
for (i = 0; i < securityHandlers->getLength(); ++i) {
|
2879
|
+
hdlr = (XpdfSecurityHandler *)securityHandlers->get(i);
|
2880
|
+
if (!strcmp(hdlr->name, name)) {
|
2881
|
+
unlockGlobalParams;
|
2882
|
+
return hdlr;
|
2883
|
+
}
|
2884
|
+
}
|
2885
|
+
unlockGlobalParams;
|
2886
|
+
#endif
|
2887
|
+
|
2888
|
+
return NULL;
|
2889
|
+
}
|
2890
|
+
|
2891
|
+
#ifdef ENABLE_PLUGINS
|
2892
|
+
//------------------------------------------------------------------------
|
2893
|
+
// plugins
|
2894
|
+
//------------------------------------------------------------------------
|
2895
|
+
|
2896
|
+
GBool GlobalParams::loadPlugin(char *type, char *name) {
|
2897
|
+
Plugin *plugin;
|
2898
|
+
|
2899
|
+
if (!(plugin = Plugin::load(type, name))) {
|
2900
|
+
return gFalse;
|
2901
|
+
}
|
2902
|
+
lockGlobalParams;
|
2903
|
+
plugins->append(plugin);
|
2904
|
+
unlockGlobalParams;
|
2905
|
+
return gTrue;
|
2906
|
+
}
|
2907
|
+
|
2908
|
+
#endif // ENABLE_PLUGINS
|