1
//========================================================================
5
// Copyright 2001-2003 Glyph & Cog, LLC
7
//========================================================================
9
//========================================================================
11
// Modified under the Poppler project - http://poppler.freedesktop.org
13
// All changes made under the Poppler project to this file are licensed
14
// under GPL version 2 or later
16
// Copyright (C) 2005, 2007-2010 Albert Astals Cid <aacid@kde.org>
17
// Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com>
18
// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
19
// Copyright (C) 2006 Kristian HĆøgsberg <krh@redhat.com>
20
// Copyright (C) 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
21
// Copyright (C) 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) 2010 Hib Eris <hib@hiberis.nl>
26
// To see a description of the changes please see the Changelog file that
27
// came with your tarball or type make ChangeLog if you are building from git
29
//========================================================================
31
#ifndef GLOBALPARAMS_H
32
#define GLOBALPARAMS_H
34
#ifdef USE_GCC_PRAGMAS
39
#include "poppler-config.h"
41
#if WITH_FONTCONFIGURATION_FONTCONFIG
42
#include <fontconfig/fontconfig.h>
44
#include "goo/gtypes.h"
45
#include "CharTypes.h"
48
#include "goo/GooMutex.h"
55
class CharCodeToUnicode;
56
class CharCodeToUnicodeCache;
58
class UnicodeMapCache;
61
struct XpdfSecurityHandler;
69
//------------------------------------------------------------------------
71
// The global parameters object.
72
extern GlobalParams *globalParams;
74
//------------------------------------------------------------------------
76
enum DisplayFontParamKind {
81
struct DisplayFontParamT1 {
85
struct DisplayFontParamTT {
90
class DisplayFontParam {
93
GooString *name; // font name for 8-bit fonts and named
94
// CID fonts; collection name for
96
DisplayFontParamKind kind;
98
DisplayFontParamT1 t1;
99
DisplayFontParamTT tt;
102
DisplayFontParam(GooString *nameA, DisplayFontParamKind kindA);
103
void setFileName(GooString *fileNameA) {
104
if (displayFontT1 == kind)
105
t1.fileName = fileNameA;
107
assert(displayFontTT == kind);
108
tt.fileName = fileNameA;
111
virtual ~DisplayFontParam();
114
//------------------------------------------------------------------------
119
GooString *pdfFontName; // PDF font name for 8-bit fonts and
120
// named 16-bit fonts; char collection
121
// name for generic 16-bit fonts
122
int wMode; // writing mode (0=horiz, 1=vert) for
124
GooString *psFontName; // PostScript font name
125
GooString *encoding; // encoding, for 16-bit fonts only
127
PSFontParam(GooString *pdfFontNameA, int wModeA,
128
GooString *psFontNameA, GooString *encodingA);
132
//------------------------------------------------------------------------
143
//------------------------------------------------------------------------
151
//------------------------------------------------------------------------
157
screenStochasticClustered
160
//------------------------------------------------------------------------
165
// Initialize the global parameters by attempting to read a config
167
GlobalParams(const char *customPopplerDataDir = NULL);
171
void setBaseDir(char *dir);
173
#if WITH_FONTCONFIGURATION_WIN32
174
void setupBaseFonts(char *dir);
179
CharCode getMacRomanCharCode(char *charName);
181
GooString *getBaseDir();
182
Unicode mapNameToUnicode(char *charName);
183
UnicodeMap *getResidentUnicodeMap(GooString *encodingName);
184
FILE *getUnicodeMapFile(GooString *encodingName);
185
FILE *findCMapFile(GooString *collection, GooString *cMapName);
186
FILE *findToUnicodeFile(GooString *name);
187
DisplayFontParam *getDisplayFont(GfxFont *font);
188
GBool getPSExpandSmaller();
189
GBool getPSShrinkLarger();
191
PSLevel getPSLevel();
192
PSFontParam *getPSFont(GooString *fontName);
193
PSFontParam *getPSFont16(GooString *fontName, GooString *collection, int wMode);
194
GBool getPSEmbedType1();
195
GBool getPSEmbedTrueType();
196
GBool getPSEmbedCIDPostScript();
197
GBool getPSEmbedCIDTrueType();
198
GBool getPSSubstFonts();
199
GBool getPSPreload();
201
GBool getPSASCIIHex();
202
GooString *getTextEncodingName();
203
EndOfLineKind getTextEOL();
204
GBool getTextPageBreaks();
205
GBool getTextKeepTinyChars();
206
GooString *findFontFile(GooString *fontName, char **exts);
207
GBool getEnableFreeType();
208
GBool getAntialias();
209
GBool getVectorAntialias();
210
GBool getStrokeAdjust();
211
ScreenType getScreenType();
213
int getScreenDotRadius();
214
double getScreenGamma();
215
double getScreenBlackThreshold();
216
double getScreenWhiteThreshold();
217
GBool getMapNumericCharNames();
218
GBool getMapUnknownCharNames();
219
GBool getPrintCommands();
220
GBool getProfileCommands();
223
CharCodeToUnicode *getCIDToUnicode(GooString *collection);
224
CharCodeToUnicode *getUnicodeToUnicode(GooString *fontName);
225
UnicodeMap *getUnicodeMap(GooString *encodingName);
226
CMap *getCMap(GooString *collection, GooString *cMapName, Stream *stream = NULL);
227
UnicodeMap *getTextEncoding();
228
#ifdef ENABLE_PLUGINS
229
GBool loadPlugin(char *type, char *name);
232
GooList *getEncodingNames();
234
//----- functions to set parameters
235
void setPSExpandSmaller(GBool expand);
236
void setPSShrinkLarger(GBool shrink);
237
void setPSCenter(GBool center);
238
void setPSLevel(PSLevel level);
239
void setPSEmbedType1(GBool embed);
240
void setPSEmbedTrueType(GBool embed);
241
void setPSEmbedCIDPostScript(GBool embed);
242
void setPSEmbedCIDTrueType(GBool embed);
243
void setPSSubstFonts(GBool substFonts);
244
void setPSPreload(GBool preload);
245
void setPSOPI(GBool opi);
246
void setPSASCIIHex(GBool hex);
247
void setTextEncoding(char *encodingName);
248
GBool setTextEOL(char *s);
249
void setTextPageBreaks(GBool pageBreaks);
250
void setTextKeepTinyChars(GBool keep);
251
GBool setEnableFreeType(char *s);
252
GBool setAntialias(char *s);
253
GBool setVectorAntialias(char *s);
254
void setStrokeAdjust(GBool strokeAdjust);
255
void setScreenType(ScreenType st);
256
void setScreenSize(int size);
257
void setScreenDotRadius(int radius);
258
void setScreenGamma(double gamma);
259
void setScreenBlackThreshold(double blackThreshold);
260
void setScreenWhiteThreshold(double whiteThreshold);
261
void setMapNumericCharNames(GBool map);
262
void setMapUnknownCharNames(GBool map);
263
void setPrintCommands(GBool printCommandsA);
264
void setProfileCommands(GBool profileCommandsA);
265
void setErrQuiet(GBool errQuietA);
267
//----- security handlers
269
void addSecurityHandler(XpdfSecurityHandler *handler);
270
XpdfSecurityHandler *getSecurityHandler(char *name);
274
void parseNameToUnicode(GooString *name);
275
GBool parseYesNo2(char *token, GBool *flag);
276
UnicodeMap *getUnicodeMap2(GooString *encodingName);
278
void scanEncodingDirs();
279
void addCIDToUnicode(GooString *collection, GooString *fileName);
280
void addUnicodeMap(GooString *encodingName, GooString *fileName);
281
void addCMapDir(GooString *collection, GooString *dir);
283
//----- static tables
285
NameToCharCode * // mapping from char name to
286
macRomanReverseMap; // MacRomanEncoding index
288
//----- user-modifiable settings
290
GooString *baseDir; // base directory - for plugins, etc.
291
NameToCharCode * // mapping from char name to Unicode
293
GooHash *cidToUnicodes; // files for mappings from char collections
294
// to Unicode, indexed by collection name
296
GooHash *unicodeToUnicodes; // files for Unicode-to-Unicode mappings,
297
// indexed by font name pattern [GooString]
298
GooHash *residentUnicodeMaps; // mappings from Unicode to char codes,
299
// indexed by encoding name [UnicodeMap]
300
GooHash *unicodeMaps; // files for mappings from Unicode to char
301
// codes, indexed by encoding name [GooString]
302
GooHash *cMapDirs; // list of CMap dirs, indexed by collection
303
// name [GooList[GooString]]
304
GooList *toUnicodeDirs; // list of ToUnicode CMap dirs [GooString]
305
GooHash *displayFonts; // display font info, indexed by font name
306
// [DisplayFontParam]
308
GBool baseFontsInitialized;
309
WinFontList *winFontList; // system TrueType fonts
311
GBool psExpandSmaller; // expand smaller pages to fill paper
312
GBool psShrinkLarger; // shrink larger pages to fit paper
313
GBool psCenter; // center pages on the paper
314
PSLevel psLevel; // PostScript level to generate
315
GooHash *psFonts; // PostScript font info, indexed by PDF
316
// font name [PSFontParam]
317
GooList *psNamedFonts16; // named 16-bit fonts [PSFontParam]
318
GooList *psFonts16; // generic 16-bit fonts [PSFontParam]
319
GBool psEmbedType1; // embed Type 1 fonts?
320
GBool psEmbedTrueType; // embed TrueType fonts?
321
GBool psEmbedCIDPostScript; // embed CID PostScript fonts?
322
GBool psEmbedCIDTrueType; // embed CID TrueType fonts?
323
GBool psSubstFonts; // substitute missing fonts?
324
GBool psPreload; // preload PostScript images and forms into
326
GBool psOPI; // generate PostScript OPI comments?
327
GBool psASCIIHex; // use ASCIIHex instead of ASCII85?
328
GooString *textEncoding; // encoding (unicodeMap) to use for text
330
EndOfLineKind textEOL; // type of EOL marker to use for text
332
GBool textPageBreaks; // insert end-of-page markers?
333
GBool textKeepTinyChars; // keep all characters in text output
334
GooList *fontDirs; // list of font dirs [GooString]
335
GBool enableFreeType; // FreeType enable flag
336
GBool antialias; // anti-aliasing enable flag
337
GBool vectorAntialias; // vector anti-aliasing enable flag
338
GBool strokeAdjust; // stroke adjustment enable flag
339
ScreenType screenType; // halftone screen type
340
int screenSize; // screen matrix size
341
int screenDotRadius; // screen dot radius
342
double screenGamma; // screen gamma correction
343
double screenBlackThreshold; // screen black clamping threshold
344
double screenWhiteThreshold; // screen white clamping threshold
345
GBool mapNumericCharNames; // map numeric char names (from font subsets)?
346
GBool mapUnknownCharNames; // map unknown char names?
347
GBool printCommands; // print the drawing commands
348
GBool profileCommands; // profile the drawing commands
349
GBool errQuiet; // suppress error messages?
351
CharCodeToUnicodeCache *cidToUnicodeCache;
352
CharCodeToUnicodeCache *unicodeToUnicodeCache;
353
UnicodeMapCache *unicodeMapCache;
354
CMapCache *cMapCache;
356
#ifdef ENABLE_PLUGINS
357
GList *plugins; // list of plugins [Plugin]
358
GList *securityHandlers; // list of loaded security handlers
359
// [XpdfSecurityHandler]
364
GooMutex unicodeMapCacheMutex;
365
GooMutex cMapCacheMutex;
368
const char *popplerDataDir;