Diffstat (limited to 'noncore/unsupported/qpdf/xpdf/GlobalParams.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/qpdf/xpdf/GlobalParams.cc | 381 |
1 files changed, 265 insertions, 116 deletions
diff --git a/noncore/unsupported/qpdf/xpdf/GlobalParams.cc b/noncore/unsupported/qpdf/xpdf/GlobalParams.cc index 8be58a3..0bc908e 100644 --- a/noncore/unsupported/qpdf/xpdf/GlobalParams.cc +++ b/noncore/unsupported/qpdf/xpdf/GlobalParams.cc | |||
@@ -4,3 +4,3 @@ | |||
4 | // | 4 | // |
5 | // Copyright 2001 Derek B. Noonburg | 5 | // Copyright 2001-2002 Glyph & Cog, LLC |
6 | // | 6 | // |
@@ -98,5 +98,8 @@ DisplayFontParam::~DisplayFontParam() { | |||
98 | 98 | ||
99 | PSFontParam::PSFontParam(GString *pdfFontNameA, GString *psFontNameA) { | 99 | PSFontParam::PSFontParam(GString *pdfFontNameA, int wModeA, |
100 | GString *psFontNameA, GString *encodingA) { | ||
100 | pdfFontName = pdfFontNameA; | 101 | pdfFontName = pdfFontNameA; |
102 | wMode = wModeA; | ||
101 | psFontName = psFontNameA; | 103 | psFontName = psFontNameA; |
104 | encoding = encodingA; | ||
102 | } | 105 | } |
@@ -106,2 +109,5 @@ PSFontParam::~PSFontParam() { | |||
106 | delete psFontName; | 109 | delete psFontName; |
110 | if (encoding) { | ||
111 | delete encoding; | ||
112 | } | ||
107 | } | 113 | } |
@@ -117,7 +123,2 @@ GlobalParams::GlobalParams(char *cfgFileName) { | |||
117 | FILE *f; | 123 | FILE *f; |
118 | char buf[512]; | ||
119 | int line; | ||
120 | GList *tokens; | ||
121 | GString *cmd; | ||
122 | char *p1, *p2; | ||
123 | int i; | 124 | int i; |
@@ -126,4 +127,6 @@ GlobalParams::GlobalParams(char *cfgFileName) { | |||
126 | 127 | ||
128 | // scan the encoding in reverse because we want the lowest-numbered | ||
129 | // index for each char name ('space' is encoded twice) | ||
127 | macRomanReverseMap = new NameToCharCode(); | 130 | macRomanReverseMap = new NameToCharCode(); |
128 | for (i = 0; i < 256; ++i) { | 131 | for (i = 255; i >= 0; --i) { |
129 | if (macRomanEncoding[i]) { | 132 | if (macRomanEncoding[i]) { |
@@ -141,2 +144,3 @@ GlobalParams::GlobalParams(char *cfgFileName) { | |||
141 | displayCIDFonts = new GHash(); | 144 | displayCIDFonts = new GHash(); |
145 | displayNamedCIDFonts = new GHash(); | ||
142 | #if HAVE_PAPER_H | 146 | #if HAVE_PAPER_H |
@@ -156,5 +160,10 @@ GlobalParams::GlobalParams(char *cfgFileName) { | |||
156 | psFonts = new GHash(); | 160 | psFonts = new GHash(); |
161 | psNamedFonts16 = new GList(); | ||
162 | psFonts16 = new GList(); | ||
157 | psEmbedType1 = gTrue; | 163 | psEmbedType1 = gTrue; |
158 | psEmbedTrueType = gTrue; | 164 | psEmbedTrueType = gTrue; |
165 | psEmbedCIDPostScript = gTrue; | ||
166 | psEmbedCIDTrueType = gTrue; | ||
159 | psOPI = gFalse; | 167 | psOPI = gFalse; |
168 | psASCIIHex = gFalse; | ||
160 | textEncoding = new GString("Latin1"); | 169 | textEncoding = new GString("Latin1"); |
@@ -168,2 +177,3 @@ GlobalParams::GlobalParams(char *cfgFileName) { | |||
168 | fontDirs = new GList(); | 177 | fontDirs = new GList(); |
178 | initialZoom = new GString("1"); | ||
169 | t1libControl = fontRastAALow; | 179 | t1libControl = fontRastAALow; |
@@ -195,2 +205,4 @@ GlobalParams::GlobalParams(char *cfgFileName) { | |||
195 | residentUnicodeMaps->add(map->getEncodingName(), map); | 205 | residentUnicodeMaps->add(map->getEncodingName(), map); |
206 | map = new UnicodeMap("UCS-2", &mapUCS2); | ||
207 | residentUnicodeMaps->add(map->getEncodingName(), map); | ||
196 | 208 | ||
@@ -221,2 +233,3 @@ GlobalParams::GlobalParams(char *cfgFileName) { | |||
221 | #if defined(WIN32) && !defined(__CYGWIN32__) | 233 | #if defined(WIN32) && !defined(__CYGWIN32__) |
234 | char buf[512]; | ||
222 | i = GetModuleFileName(NULL, buf, sizeof(buf)); | 235 | i = GetModuleFileName(NULL, buf, sizeof(buf)); |
@@ -236,94 +249,137 @@ GlobalParams::GlobalParams(char *cfgFileName) { | |||
236 | if (f) { | 249 | if (f) { |
237 | line = 1; | 250 | parseFile(fileName, f); |
238 | while (fgets(buf, sizeof(buf) - 1, f)) { | 251 | delete fileName; |
239 | 252 | } | |
240 | // break the line into tokens | 253 | } |
241 | tokens = new GList(); | 254 | |
242 | p1 = buf; | 255 | void GlobalParams::parseFile(GString *fileName, FILE *f) { |
243 | while (*p1) { | 256 | int line; |
244 | for (; *p1 && isspace(*p1); ++p1) ; | 257 | GList *tokens; |
245 | if (!*p1) { | 258 | GString *cmd, *incFile; |
246 | break; | 259 | char *p1, *p2; |
247 | } | 260 | char buf[512]; |
248 | if (*p1 == '"' || *p1 == '\'') { | 261 | FILE *f2; |
249 | for (p2 = p1 + 1; *p2 && *p2 != *p1; ++p2) ; | 262 | |
250 | ++p1; | 263 | line = 1; |
251 | } else { | 264 | while (fgets(buf, sizeof(buf) - 1, f)) { |
252 | for (p2 = p1 + 1; *p2 && !isspace(*p2); ++p2) ; | 265 | |
253 | } | 266 | // break the line into tokens |
254 | tokens->append(new GString(p1, p2 - p1)); | 267 | tokens = new GList(); |
255 | p1 = p2 + 1; | 268 | p1 = buf; |
269 | while (*p1) { | ||
270 | for (; *p1 && isspace(*p1); ++p1) ; | ||
271 | if (!*p1) { | ||
272 | break; | ||
273 | } | ||
274 | if (*p1 == '"' || *p1 == '\'') { | ||
275 | for (p2 = p1 + 1; *p2 && *p2 != *p1; ++p2) ; | ||
276 | ++p1; | ||
277 | } else { | ||
278 | for (p2 = p1 + 1; *p2 && !isspace(*p2); ++p2) ; | ||
256 | } | 279 | } |
280 | tokens->append(new GString(p1, p2 - p1)); | ||
281 | p1 = p2 + 1; | ||
282 | } | ||
257 | 283 | ||
258 | if (tokens->getLength() > 0 && | 284 | if (tokens->getLength() > 0 && |
259 | ((GString *)tokens->get(0))->getChar(0) != '#') { | 285 | ((GString *)tokens->get(0))->getChar(0) != '#') { |
260 | cmd = (GString *)tokens->get(0); | 286 | cmd = (GString *)tokens->get(0); |
261 | if (!cmd->cmp("nameToUnicode")) { | 287 | if (!cmd->cmp("include")) { |
262 | parseNameToUnicode(tokens, fileName, line); | 288 | if (tokens->getLength() == 2) { |
263 | } else if (!cmd->cmp("cidToUnicode")) { | 289 | incFile = (GString *)tokens->get(1); |
264 | parseCIDToUnicode(tokens, fileName, line); | 290 | if ((f2 = fopen(incFile->getCString(), "r"))) { |
265 | } else if (!cmd->cmp("unicodeMap")) { | 291 | parseFile(incFile, f2); |
266 | parseUnicodeMap(tokens, fileName, line); | 292 | fclose(f2); |
267 | } else if (!cmd->cmp("cMapDir")) { | 293 | } else { |
268 | parseCMapDir(tokens, fileName, line); | 294 | error(-1, "Couldn't find included config file: '%s' (%s:%d)", |
269 | } else if (!cmd->cmp("toUnicodeDir")) { | 295 | incFile->getCString(), fileName->getCString(), line); |
270 | parseToUnicodeDir(tokens, fileName, line); | 296 | } |
271 | } else if (!cmd->cmp("displayFontX")) { | ||
272 | parseDisplayFont(tokens, gFalse, displayFontX, fileName, line); | ||
273 | } else if (!cmd->cmp("displayFontT1")) { | ||
274 | parseDisplayFont(tokens, gFalse, displayFontT1, fileName, line); | ||
275 | } else if (!cmd->cmp("displayFontTT")) { | ||
276 | parseDisplayFont(tokens, gFalse, displayFontTT, fileName, line); | ||
277 | } else if (!cmd->cmp("displayCIDFontX")) { | ||
278 | parseDisplayFont(tokens, gTrue, displayFontX, fileName, line); | ||
279 | } else if (!cmd->cmp("psFile")) { | ||
280 | parsePSFile(tokens, fileName, line); | ||
281 | } else if (!cmd->cmp("psFont")) { | ||
282 | parsePSFont(tokens, fileName, line); | ||
283 | } else if (!cmd->cmp("psPaperSize")) { | ||
284 | parsePSPaperSize(tokens, fileName, line); | ||
285 | } else if (!cmd->cmp("psDuplex")) { | ||
286 | parseYesNo("psDuplex", &psDuplex, tokens, fileName, line); | ||
287 | } else if (!cmd->cmp("psLevel")) { | ||
288 | parsePSLevel(tokens, fileName, line); | ||
289 | } else if (!cmd->cmp("psEmbedType1")) { | ||
290 | parseYesNo("psEmbedType1", &psEmbedType1, tokens, fileName, line); | ||
291 | } else if (!cmd->cmp("psEmbedTrueType")) { | ||
292 | parseYesNo("psEmbedTrueType", &psEmbedTrueType, | ||
293 | tokens, fileName, line); | ||
294 | } else if (!cmd->cmp("psOPI")) { | ||
295 | parseYesNo("psOPI", &psOPI, tokens, fileName, line); | ||
296 | } else if (!cmd->cmp("textEncoding")) { | ||
297 | parseTextEncoding(tokens, fileName, line); | ||
298 | } else if (!cmd->cmp("textEOL")) { | ||
299 | parseTextEOL(tokens, fileName, line); | ||
300 | } else if (!cmd->cmp("fontDir")) { | ||
301 | parseFontDir(tokens, fileName, line); | ||
302 | } else if (!cmd->cmp("t1libControl")) { | ||
303 | parseFontRastControl("t1libControl", &t1libControl, | ||
304 | tokens, fileName, line); | ||
305 | } else if (!cmd->cmp("freetypeControl")) { | ||
306 | parseFontRastControl("freetypeControl", &freetypeControl, | ||
307 | tokens, fileName, line); | ||
308 | } else if (!cmd->cmp("urlCommand")) { | ||
309 | parseURLCommand(tokens, fileName, line); | ||
310 | } else if (!cmd->cmp("mapNumericCharNames")) { | ||
311 | parseYesNo("mapNumericCharNames", &mapNumericCharNames, | ||
312 | tokens, fileName, line); | ||
313 | } else if (!cmd->cmp("errQuiet")) { | ||
314 | parseYesNo("errQuiet", &errQuiet, tokens, fileName, line); | ||
315 | } else if (!cmd->cmp("fontpath") || !cmd->cmp("fontmap")) { | ||
316 | error(-1, "Unknown config file command"); | ||
317 | error(-1, "-- the config file format has changed since Xpdf 0.9x"); | ||
318 | } else { | 297 | } else { |
319 | error(-1, "Unknown config file command '%s' (%s:%d)", | 298 | error(-1, "Bad 'include' config file command (%s:%d)", |
320 | cmd->getCString(), fileName->getCString(), line); | 299 | fileName->getCString(), line); |
321 | } | 300 | } |
301 | } else if (!cmd->cmp("nameToUnicode")) { | ||
302 | parseNameToUnicode(tokens, fileName, line); | ||
303 | } else if (!cmd->cmp("cidToUnicode")) { | ||
304 | parseCIDToUnicode(tokens, fileName, line); | ||
305 | } else if (!cmd->cmp("unicodeMap")) { | ||
306 | parseUnicodeMap(tokens, fileName, line); | ||
307 | } else if (!cmd->cmp("cMapDir")) { | ||
308 | parseCMapDir(tokens, fileName, line); | ||
309 | } else if (!cmd->cmp("toUnicodeDir")) { | ||
310 | parseToUnicodeDir(tokens, fileName, line); | ||
311 | } else if (!cmd->cmp("displayFontX")) { | ||
312 | parseDisplayFont(tokens, displayFonts, displayFontX, fileName, line); | ||
313 | } else if (!cmd->cmp("displayFontT1")) { | ||
314 | parseDisplayFont(tokens, displayFonts, displayFontT1, fileName, line); | ||
315 | } else if (!cmd->cmp("displayFontTT")) { | ||
316 | parseDisplayFont(tokens, displayFonts, displayFontTT, fileName, line); | ||
317 | } else if (!cmd->cmp("displayCIDFontX")) { | ||
318 | parseDisplayFont(tokens, displayCIDFonts, | ||
319 | displayFontX, fileName, line); | ||
320 | } else if (!cmd->cmp("displayNamedCIDFontX")) { | ||
321 | parseDisplayFont(tokens, displayNamedCIDFonts, | ||
322 | displayFontX, fileName, line); | ||
323 | } else if (!cmd->cmp("psFile")) { | ||
324 | parsePSFile(tokens, fileName, line); | ||
325 | } else if (!cmd->cmp("psFont")) { | ||
326 | parsePSFont(tokens, fileName, line); | ||
327 | } else if (!cmd->cmp("psNamedFont16")) { | ||
328 | parsePSFont16("psNamedFont16", psNamedFonts16, | ||
329 | tokens, fileName, line); | ||
330 | } else if (!cmd->cmp("psFont16")) { | ||
331 | parsePSFont16("psFont16", psFonts16, tokens, fileName, line); | ||
332 | } else if (!cmd->cmp("psPaperSize")) { | ||
333 | parsePSPaperSize(tokens, fileName, line); | ||
334 | } else if (!cmd->cmp("psDuplex")) { | ||
335 | parseYesNo("psDuplex", &psDuplex, tokens, fileName, line); | ||
336 | } else if (!cmd->cmp("psLevel")) { | ||
337 | parsePSLevel(tokens, fileName, line); | ||
338 | } else if (!cmd->cmp("psEmbedType1Fonts")) { | ||
339 | parseYesNo("psEmbedType1", &psEmbedType1, tokens, fileName, line); | ||
340 | } else if (!cmd->cmp("psEmbedTrueTypeFonts")) { | ||
341 | parseYesNo("psEmbedTrueType", &psEmbedTrueType, | ||
342 | tokens, fileName, line); | ||
343 | } else if (!cmd->cmp("psEmbedCIDPostScriptFonts")) { | ||
344 | parseYesNo("psEmbedCIDPostScript", &psEmbedCIDPostScript, | ||
345 | tokens, fileName, line); | ||
346 | } else if (!cmd->cmp("psEmbedCIDTrueTypeFonts")) { | ||
347 | parseYesNo("psEmbedCIDTrueType", &psEmbedCIDTrueType, | ||
348 | tokens, fileName, line); | ||
349 | } else if (!cmd->cmp("psOPI")) { | ||
350 | parseYesNo("psOPI", &psOPI, tokens, fileName, line); | ||
351 | } else if (!cmd->cmp("psASCIIHex")) { | ||
352 | parseYesNo("psASCIIHex", &psASCIIHex, tokens, fileName, line); | ||
353 | } else if (!cmd->cmp("textEncoding")) { | ||
354 | parseTextEncoding(tokens, fileName, line); | ||
355 | } else if (!cmd->cmp("textEOL")) { | ||
356 | parseTextEOL(tokens, fileName, line); | ||
357 | } else if (!cmd->cmp("fontDir")) { | ||
358 | parseFontDir(tokens, fileName, line); | ||
359 | } else if (!cmd->cmp("initialZoom")) { | ||
360 | parseInitialZoom(tokens, fileName, line); | ||
361 | } else if (!cmd->cmp("t1libControl")) { | ||
362 | parseFontRastControl("t1libControl", &t1libControl, | ||
363 | tokens, fileName, line); | ||
364 | } else if (!cmd->cmp("freetypeControl")) { | ||
365 | parseFontRastControl("freetypeControl", &freetypeControl, | ||
366 | tokens, fileName, line); | ||
367 | } else if (!cmd->cmp("urlCommand")) { | ||
368 | parseURLCommand(tokens, fileName, line); | ||
369 | } else if (!cmd->cmp("mapNumericCharNames")) { | ||
370 | parseYesNo("mapNumericCharNames", &mapNumericCharNames, | ||
371 | tokens, fileName, line); | ||
372 | } else if (!cmd->cmp("errQuiet")) { | ||
373 | parseYesNo("errQuiet", &errQuiet, tokens, fileName, line); | ||
374 | } else if (!cmd->cmp("fontpath") || !cmd->cmp("fontmap")) { | ||
375 | error(-1, "Unknown config file command"); | ||
376 | error(-1, "-- the config file format has changed since Xpdf 0.9x"); | ||
377 | } else { | ||
378 | error(-1, "Unknown config file command '%s' (%s:%d)", | ||
379 | cmd->getCString(), fileName->getCString(), line); | ||
322 | } | 380 | } |
323 | |||
324 | deleteGList(tokens, GString); | ||
325 | ++line; | ||
326 | } | 381 | } |
327 | 382 | ||
328 | delete fileName; | 383 | deleteGList(tokens, GString); |
384 | ++line; | ||
329 | } | 385 | } |
@@ -428,3 +484,3 @@ void GlobalParams::parseToUnicodeDir(GList *tokens, GString *fileName, | |||
428 | 484 | ||
429 | void GlobalParams::parseDisplayFont(GList *tokens, GBool isCID, | 485 | void GlobalParams::parseDisplayFont(GList *tokens, GHash *fontHash, |
430 | DisplayFontParamKind kind, | 486 | DisplayFontParamKind kind, |
@@ -460,13 +516,6 @@ void GlobalParams::parseDisplayFont(GList *tokens, GBool isCID, | |||
460 | 516 | ||
461 | if (isCID) { | 517 | if ((old = (DisplayFontParam *)fontHash->remove(param->name))) { |
462 | if ((old = (DisplayFontParam *)displayCIDFonts->remove(param->name))) { | 518 | delete old; |
463 | delete old; | ||
464 | } | ||
465 | displayCIDFonts->add(param->name, param); | ||
466 | } else { | ||
467 | if ((old = (DisplayFontParam *)displayFonts->remove(param->name))) { | ||
468 | delete old; | ||
469 | } | ||
470 | displayFonts->add(param->name, param); | ||
471 | } | 519 | } |
520 | fontHash->add(param->name, param); | ||
472 | return; | 521 | return; |
@@ -476,3 +525,3 @@ void GlobalParams::parseDisplayFont(GList *tokens, GBool isCID, | |||
476 | err1: | 525 | err1: |
477 | error(-1, "Bad 'displayFont...' config file command (%s:%d)", | 526 | error(-1, "Bad 'display*Font*' config file command (%s:%d)", |
478 | fileName->getCString(), line); | 527 | fileName->getCString(), line); |
@@ -518,2 +567,6 @@ void GlobalParams::parsePSLevel(GList *tokens, GString *fileName, int line) { | |||
518 | psLevel = psLevel2Sep; | 567 | psLevel = psLevel2Sep; |
568 | } else if (!tok->cmp("level3")) { | ||
569 | psLevel = psLevel3; | ||
570 | } else if (!tok->cmp("level3Sep")) { | ||
571 | psLevel = psLevel3Sep; | ||
519 | } else { | 572 | } else { |
@@ -544,4 +597,4 @@ void GlobalParams::parsePSFont(GList *tokens, GString *fileName, int line) { | |||
544 | } | 597 | } |
545 | param = new PSFontParam(((GString *)tokens->get(1))->copy(), | 598 | param = new PSFontParam(((GString *)tokens->get(1))->copy(), 0, |
546 | ((GString *)tokens->get(2))->copy()); | 599 | ((GString *)tokens->get(2))->copy(), NULL); |
547 | psFonts->add(param->pdfFontName, param); | 600 | psFonts->add(param->pdfFontName, param); |
@@ -549,2 +602,30 @@ void GlobalParams::parsePSFont(GList *tokens, GString *fileName, int line) { | |||
549 | 602 | ||
603 | void GlobalParams::parsePSFont16(char *cmdName, GList *fontList, | ||
604 | GList *tokens, GString *fileName, int line) { | ||
605 | PSFontParam *param; | ||
606 | int wMode; | ||
607 | GString *tok; | ||
608 | |||
609 | if (tokens->getLength() != 5) { | ||
610 | error(-1, "Bad '%s' config file command (%s:%d)", | ||
611 | cmdName, fileName->getCString(), line); | ||
612 | return; | ||
613 | } | ||
614 | tok = (GString *)tokens->get(2); | ||
615 | if (!tok->cmp("H")) { | ||
616 | wMode = 0; | ||
617 | } else if (!tok->cmp("V")) { | ||
618 | wMode = 1; | ||
619 | } else { | ||
620 | error(-1, "Bad '%s' config file command (%s:%d)", | ||
621 | cmdName, fileName->getCString(), line); | ||
622 | return; | ||
623 | } | ||
624 | param = new PSFontParam(((GString *)tokens->get(1))->copy(), | ||
625 | wMode, | ||
626 | ((GString *)tokens->get(3))->copy(), | ||
627 | ((GString *)tokens->get(4))->copy()); | ||
628 | fontList->append(param); | ||
629 | } | ||
630 | |||
550 | void GlobalParams::parseTextEncoding(GList *tokens, GString *fileName, | 631 | void GlobalParams::parseTextEncoding(GList *tokens, GString *fileName, |
@@ -590,6 +671,6 @@ void GlobalParams::parseFontDir(GList *tokens, GString *fileName, int line) { | |||
590 | 671 | ||
591 | void GlobalParams::parseURLCommand(GList *tokens, GString *fileName, | 672 | void GlobalParams::parseInitialZoom(GList *tokens, |
592 | int line) { | 673 | GString *fileName, int line) { |
593 | if (tokens->getLength() != 2) { | 674 | if (tokens->getLength() != 2) { |
594 | error(-1, "Bad 'urlCommand' config file command (%s:%d)", | 675 | error(-1, "Bad 'initialZoom' config file command (%s:%d)", |
595 | fileName->getCString(), line); | 676 | fileName->getCString(), line); |
@@ -597,6 +678,4 @@ void GlobalParams::parseURLCommand(GList *tokens, GString *fileName, | |||
597 | } | 678 | } |
598 | if (urlCommand) { | 679 | delete initialZoom; |
599 | delete urlCommand; | 680 | initialZoom = ((GString *)tokens->get(1))->copy(); |
600 | } | ||
601 | urlCommand = ((GString *)tokens->get(1))->copy(); | ||
602 | } | 681 | } |
@@ -620,2 +699,15 @@ void GlobalParams::parseFontRastControl(char *cmdName, FontRastControl *val, | |||
620 | 699 | ||
700 | void GlobalParams::parseURLCommand(GList *tokens, GString *fileName, | ||
701 | int line) { | ||
702 | if (tokens->getLength() != 2) { | ||
703 | error(-1, "Bad 'urlCommand' config file command (%s:%d)", | ||
704 | fileName->getCString(), line); | ||
705 | return; | ||
706 | } | ||
707 | if (urlCommand) { | ||
708 | delete urlCommand; | ||
709 | } | ||
710 | urlCommand = ((GString *)tokens->get(1))->copy(); | ||
711 | } | ||
712 | |||
621 | void GlobalParams::parseYesNo(char *cmdName, GBool *flag, | 713 | void GlobalParams::parseYesNo(char *cmdName, GBool *flag, |
@@ -656,2 +748,3 @@ GlobalParams::~GlobalParams() { | |||
656 | deleteGHash(displayCIDFonts, DisplayFontParam); | 748 | deleteGHash(displayCIDFonts, DisplayFontParam); |
749 | deleteGHash(displayNamedCIDFonts, DisplayFontParam); | ||
657 | if (psFile) { | 750 | if (psFile) { |
@@ -660,4 +753,7 @@ GlobalParams::~GlobalParams() { | |||
660 | deleteGHash(psFonts, PSFontParam); | 753 | deleteGHash(psFonts, PSFontParam); |
754 | deleteGList(psNamedFonts16, PSFontParam); | ||
755 | deleteGList(psFonts16, PSFontParam); | ||
661 | delete textEncoding; | 756 | delete textEncoding; |
662 | deleteGList(fontDirs, GString); | 757 | deleteGList(fontDirs, GString); |
758 | delete initialZoom; | ||
663 | if (urlCommand) { | 759 | if (urlCommand) { |
@@ -754,4 +850,11 @@ DisplayFontParam *GlobalParams::getDisplayFont(GString *fontName) { | |||
754 | 850 | ||
755 | DisplayFontParam *GlobalParams::getDisplayCIDFont(GString *collection) { | 851 | DisplayFontParam *GlobalParams::getDisplayCIDFont(GString *fontName, |
756 | return (DisplayFontParam *)displayCIDFonts->lookup(collection); | 852 | GString *collection) { |
853 | DisplayFontParam *dfp; | ||
854 | |||
855 | if (!fontName || | ||
856 | !(dfp = (DisplayFontParam *)displayNamedCIDFonts->lookup(fontName))) { | ||
857 | dfp = (DisplayFontParam *)displayCIDFonts->lookup(collection); | ||
858 | } | ||
859 | return dfp; | ||
757 | } | 860 | } |
@@ -762,2 +865,31 @@ PSFontParam *GlobalParams::getPSFont(GString *fontName) { | |||
762 | 865 | ||
866 | PSFontParam *GlobalParams::getPSFont16(GString *fontName, | ||
867 | GString *collection, int wMode) { | ||
868 | PSFontParam *p; | ||
869 | int i; | ||
870 | |||
871 | p = NULL; | ||
872 | if (fontName) { | ||
873 | for (i = 0; i < psNamedFonts16->getLength(); ++i) { | ||
874 | p = (PSFontParam *)psNamedFonts16->get(i); | ||
875 | if (!p->pdfFontName->cmp(fontName) && | ||
876 | p->wMode == wMode) { | ||
877 | break; | ||
878 | } | ||
879 | p = NULL; | ||
880 | } | ||
881 | } | ||
882 | if (!p && collection) { | ||
883 | for (i = 0; i < psFonts16->getLength(); ++i) { | ||
884 | p = (PSFontParam *)psFonts16->get(i); | ||
885 | if (!p->pdfFontName->cmp(collection) && | ||
886 | p->wMode == wMode) { | ||
887 | break; | ||
888 | } | ||
889 | p = NULL; | ||
890 | } | ||
891 | } | ||
892 | return p; | ||
893 | } | ||
894 | |||
763 | GString *GlobalParams::findFontFile(GString *fontName, | 895 | GString *GlobalParams::findFontFile(GString *fontName, |
@@ -868,2 +1000,10 @@ void GlobalParams::setPSEmbedTrueType(GBool embed) { | |||
868 | 1000 | ||
1001 | void GlobalParams::setPSEmbedCIDPostScript(GBool embed) { | ||
1002 | psEmbedCIDPostScript = embed; | ||
1003 | } | ||
1004 | |||
1005 | void GlobalParams::setPSEmbedCIDTrueType(GBool embed) { | ||
1006 | psEmbedCIDTrueType = embed; | ||
1007 | } | ||
1008 | |||
869 | void GlobalParams::setPSOPI(GBool opi) { | 1009 | void GlobalParams::setPSOPI(GBool opi) { |
@@ -872,2 +1012,6 @@ void GlobalParams::setPSOPI(GBool opi) { | |||
872 | 1012 | ||
1013 | void GlobalParams::setPSASCIIHex(GBool hex) { | ||
1014 | psASCIIHex = hex; | ||
1015 | } | ||
1016 | |||
873 | void GlobalParams::setTextEncoding(char *encodingName) { | 1017 | void GlobalParams::setTextEncoding(char *encodingName) { |
@@ -890,2 +1034,7 @@ GBool GlobalParams::setTextEOL(char *s) { | |||
890 | 1034 | ||
1035 | void GlobalParams::setInitialZoom(char *s) { | ||
1036 | delete initialZoom; | ||
1037 | initialZoom = new GString(s); | ||
1038 | } | ||
1039 | |||
891 | GBool GlobalParams::setT1libControl(char *s) { | 1040 | GBool GlobalParams::setT1libControl(char *s) { |