Ignore:
Timestamp:
Dec 30, 2009, 7:13:45 PM (12 years ago)
Author:
rbri
Message:

PDF plugin: Poppler library updated to version 0.12.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/poppler/mypoppler/poppler/GlobalParams.cc

    r257 r277  
    1313// Copyright (C) 2005 Martin Kretzschmar <martink@gnome.org>
    1414// Copyright (C) 2005, 2006 Kristian HÞgsberg <krh@redhat.com>
    15 // Copyright (C) 2005, 2007, 2008 Albert Astals Cid <aacid@kde.org>
     15// Copyright (C) 2005, 2007-2009 Albert Astals Cid <aacid@kde.org>
    1616// Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com>
    1717// Copyright (C) 2006, 2007 Jeff Muizelaar <jeff@infidigm.net>
     
    1919// Copyright (C) 2006 Ed Catmur <ed@catmur.co.uk>
    2020// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
    21 // Copyright (C) 2007 Jonathan Kew <jonathan_kew@sil.org>
     21// Copyright (C) 2007, 2009 Jonathan Kew <jonathan_kew@sil.org>
     22// Copyright (C) 2009 Petr Gajdos <pgajdos@novell.com>
     23// Copyright (C) 2009 William Bader <williambader@hotmail.com>
     24// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
    2225//
    2326// To see a description of the changes please see the Changelog file that
     
    3639#include <ctype.h>
    3740#ifdef ENABLE_PLUGINS
    38 #  ifndef WIN32
     41#  ifndef _WIN32
    3942#    include <dlfcn.h>
    4043#  endif
    4144#endif
    42 #ifdef WIN32
     45#ifdef _WIN32
    4346#  include <shlobj.h>
    4447#endif
     
    6164#include "GfxFont.h"
    6265
    63 #ifdef WIN32
     66#ifdef _WIN32
    6467#  define strcasecmp stricmp
    6568#endif
     
    9093
    9194#ifdef ENABLE_PLUGINS
    92 #  ifdef WIN32
     95#  ifdef _WIN32
    9396extern XpdfPluginVecTable xpdfPluginVecTable;
    9497#  endif
     
    138141}
    139142
    140 #ifdef WIN32
     143#ifdef _WIN32
    141144
    142145//------------------------------------------------------------------------
     
    381384}
    382385
    383 #endif // WIN32
     386#endif // _WIN32
    384387
    385388//------------------------------------------------------------------------
     
    416419private:
    417420
    418 #ifdef WIN32
     421#ifdef _WIN32
    419422  Plugin(HMODULE libA);
    420423  HMODULE lib;
     
    430433  XpdfPluginVecTable *vt;
    431434  XpdfBool (*xpdfInitPlugin)(void);
    432 #ifdef WIN32
     435#ifdef _WIN32
    433436  HMODULE libA;
    434437#else
     
    441444  appendToPath(path, name);
    442445
    443 #ifdef WIN32
     446#ifdef _WIN32
    444447  path->append(".dll");
    445448  if (!(libA = LoadLibrary(path->getCString()))) {
     
    475478  memcpy(vt, &xpdfPluginVecTable, sizeof(xpdfPluginVecTable));
    476479
    477 #ifdef WIN32
     480#ifdef _WIN32
    478481  if (!(xpdfInitPlugin = (XpdfBool (*)(void))
    479482                             GetProcAddress(libA, "xpdfInitPlugin"))) {
     
    496499  }
    497500
    498 #ifdef WIN32
     501#ifdef _WIN32
    499502  plugin = new Plugin(libA);
    500503#else
     
    506509
    507510 err2:
    508 #ifdef WIN32
     511#ifdef _WIN32
    509512  FreeLibrary(libA);
    510513#else
     
    516519}
    517520
    518 #ifdef WIN32
     521#ifdef _WIN32
    519522Plugin::Plugin(HMODULE libA) {
    520523  lib = libA;
     
    529532  void (*xpdfFreePlugin)(void);
    530533
    531 #ifdef WIN32
     534#ifdef _WIN32
    532535  if ((xpdfFreePlugin = (void (*)(void))
    533536                            GetProcAddress(lib, "xpdfFreePlugin"))) {
     
    549552//------------------------------------------------------------------------
    550553
    551 GlobalParams::GlobalParams() {
     554GlobalParams::GlobalParams(const char *customPopplerDataDir)
     555  : popplerDataDir(customPopplerDataDir)
     556{
    552557  UnicodeMap *map;
    553558  int i;
     
    575580  }
    576581
    577 #ifdef WIN32
     582#ifdef _WIN32
    578583  // baseDir will be set by a call to setBaseDir
    579584  baseDir = new GooString();
     
    600605  psEmbedCIDPostScript = gTrue;
    601606  psEmbedCIDTrueType = gTrue;
     607  psSubstFonts = gTrue;
    602608  psPreload = gFalse;
    603609  psOPI = gFalse;
    604610  psASCIIHex = gFalse;
    605611  textEncoding = new GooString("UTF-8");
    606 #if defined(WIN32)
     612#if defined(_WIN32)
    607613  textEOL = eolDOS;
    608614#elif defined(MACOS)
     
    636642  cMapCache = new CMapCache();
    637643
    638 #ifdef WIN32
     644#ifdef _WIN32
     645  baseFontsInitialized = gFalse;
    639646  winFontList = NULL;
    640647#endif
     
    674681  GDir *dir;
    675682  GDirEntry *entry;
    676 
    677   dir = new GDir(POPPLER_DATADIR "/nameToUnicode", gTrue);
     683  const char *dataRoot = popplerDataDir ? popplerDataDir : POPPLER_DATADIR;
     684 
     685  // allocate buffer large enough to append "/nameToUnicode"
     686  size_t bufSize = strlen(dataRoot) + strlen("/nameToUnicode") + 1;
     687  char *dataPathBuffer = new char[bufSize];
     688 
     689  snprintf(dataPathBuffer, bufSize, "%s/nameToUnicode", dataRoot);
     690  dir = new GDir(dataPathBuffer, gTrue);
    678691  while (entry = dir->getNextEntry(), entry != NULL) {
    679692    if (!entry->isDir()) {
     
    684697  delete dir;
    685698
    686   dir = new GDir(POPPLER_DATADIR "/cidToUnicode", gFalse);
     699  snprintf(dataPathBuffer, bufSize, "%s/cidToUnicode", dataRoot);
     700  dir = new GDir(dataPathBuffer, gFalse);
    687701  while (entry = dir->getNextEntry(), entry != NULL) {
    688702    addCIDToUnicode(entry->getName(), entry->getFullPath());
     
    691705  delete dir;
    692706
    693   dir = new GDir(POPPLER_DATADIR "/unicodeMap", gFalse);
     707  snprintf(dataPathBuffer, bufSize, "%s/unicodeMap", dataRoot);
     708  dir = new GDir(dataPathBuffer, gFalse);
    694709  while (entry = dir->getNextEntry(), entry != NULL) {
    695710    addUnicodeMap(entry->getName(), entry->getFullPath());
     
    698713  delete dir;
    699714
    700   dir = new GDir(POPPLER_DATADIR "/cMap", gFalse);
     715  snprintf(dataPathBuffer, bufSize, "%s/cMap", dataRoot);
     716  dir = new GDir(dataPathBuffer, gFalse);
    701717  while (entry = dir->getNextEntry(), entry != NULL) {
    702718    addCMapDir(entry->getName(), entry->getFullPath());
     
    705721  }
    706722  delete dir;
     723 
     724  delete[] dataPathBuffer;
    707725}
    708726
     
    789807  deleteGooList(toUnicodeDirs, GooString);
    790808  deleteGooHash(displayFonts, DisplayFontParam);
    791 #ifdef WIN32
     809#ifdef _WIN32
    792810  delete winFontList;
    793811#endif
     
    12751293}
    12761294
     1295GBool GlobalParams::getPSSubstFonts() {
     1296  GBool e;
     1297
     1298  lockGlobalParams;
     1299  e = psSubstFonts;
     1300  unlockGlobalParams;
     1301  return e;
     1302}
     1303
    12771304GBool GlobalParams::getPSPreload() {
    12781305  GBool preload;
     
    15511578}
    15521579
    1553 CMap *GlobalParams::getCMap(GooString *collection, GooString *cMapName) {
     1580CMap *GlobalParams::getCMap(GooString *collection, GooString *cMapName, Stream *stream) {
    15541581  CMap *cMap;
    15551582
    15561583  lockCMapCache;
    1557   cMap = cMapCache->getCMap(collection, cMapName);
     1584  cMap = cMapCache->getCMap(collection, cMapName, stream);
    15581585  unlockCMapCache;
    15591586  return cMap;
     
    16351662}
    16361663
     1664void GlobalParams::setPSSubstFonts(GBool substFonts) {
     1665  lockGlobalParams;
     1666  psSubstFonts = substFonts;
     1667  unlockGlobalParams;
     1668}
     1669
    16371670void GlobalParams::setPSPreload(GBool preload) {
    16381671  lockGlobalParams;
Note: See TracChangeset for help on using the changeset viewer.