--- poppler-30jul09/utils/pdftops.cc- 2009-07-30 01:10:42.000000000 +0100 +++ poppler-30jul09/utils/pdftops.cc 2009-07-30 13:54:20.000000000 +0100 @@ -46,6 +46,10 @@ #include "PSOutputDev.h" #include "Error.h" +#ifndef SUBST_FONTS +#define SUBST_FONTS 0 /* set default: 1 to substitute missing fonts, 0 to pass missing fonts */ +#endif + static GBool setPSPaperSize(char *size, int &psPaperWidth, int &psPaperHeight) { if (!strcmp(size, "match")) { psPaperWidth = psPaperHeight = -1; @@ -86,6 +90,11 @@ static GBool noEmbedTTFonts = gFalse; static GBool noEmbedCIDPSFonts = gFalse; static GBool noEmbedCIDTTFonts = gFalse; +#if SUBST_FONTS +static GBool noSubstFonts = gFalse; +#else +static GBool substFonts = gFalse; +#endif static GBool preload = gFalse; static char paperSize[15] = ""; static int paperWidth = -1; @@ -136,6 +145,13 @@ "don't embed CID PostScript fonts"}, {"-noembcidtt", argFlag, &noEmbedCIDTTFonts, 0, "don't embed CID TrueType fonts"}, +#if SUBST_FONTS + {"-nosubst", argFlag, &noSubstFonts,0, + "don't substitute missing fonts"}, +#else + {"-subst", argFlag, &substFonts, 0, + "substitute missing fonts"}, +#endif {"-preload", argFlag, &preload, 0, "preload images and forms"}, {"-paper", argString, paperSize, sizeof(paperSize), @@ -269,6 +285,15 @@ if (noEmbedCIDTTFonts) { globalParams->setPSEmbedCIDTrueType(!noEmbedCIDTTFonts); } +#if SUBST_FONTS + if (noSubstFonts) { + globalParams->setPSSubstFonts(!noSubstFonts); + } +#else + if (!substFonts) { + globalParams->setPSSubstFonts(substFonts); + } +#endif if (preload) { globalParams->setPSPreload(preload); } --- poppler-30jul09/poppler/GlobalParams.h- 2009-07-30 01:10:42.000000000 +0100 +++ poppler-30jul09/poppler/GlobalParams.h 2009-07-30 01:12:09.000000000 +0100 @@ -193,6 +193,7 @@ GBool getPSEmbedTrueType(); GBool getPSEmbedCIDPostScript(); GBool getPSEmbedCIDTrueType(); + GBool getPSSubstFonts(); GBool getPSPreload(); GBool getPSOPI(); GBool getPSASCIIHex(); @@ -238,6 +239,7 @@ void setPSEmbedTrueType(GBool embed); void setPSEmbedCIDPostScript(GBool embed); void setPSEmbedCIDTrueType(GBool embed); + void setPSSubstFonts(GBool substFonts); void setPSPreload(GBool preload); void setPSOPI(GBool opi); void setPSASCIIHex(GBool hex); @@ -317,6 +319,7 @@ GBool psEmbedTrueType; // embed TrueType fonts? GBool psEmbedCIDPostScript; // embed CID PostScript fonts? GBool psEmbedCIDTrueType; // embed CID TrueType fonts? + GBool psSubstFonts; // substitute missing fonts? GBool psPreload; // preload PostScript images and forms into // memory GBool psOPI; // generate PostScript OPI comments? --- poppler-30jul09/poppler/GlobalParams.cc- 2009-07-30 01:10:42.000000000 +0100 +++ poppler-30jul09/poppler/GlobalParams.cc 2009-07-30 01:12:09.000000000 +0100 @@ -602,6 +602,7 @@ psEmbedTrueType = gTrue; psEmbedCIDPostScript = gTrue; psEmbedCIDTrueType = gTrue; + psSubstFonts = gTrue; psPreload = gFalse; psOPI = gFalse; psASCIIHex = gFalse; @@ -1280,6 +1281,15 @@ return e; } +GBool GlobalParams::getPSSubstFonts() { + GBool e; + + lockGlobalParams; + e = psSubstFonts; + unlockGlobalParams; + return e; +} + GBool GlobalParams::getPSPreload() { GBool preload; @@ -1649,6 +1659,12 @@ unlockGlobalParams; } +void GlobalParams::setPSSubstFonts(GBool substFonts) { + lockGlobalParams; + psSubstFonts = substFonts; + unlockGlobalParams; +} + void GlobalParams::setPSPreload(GBool preload) { lockGlobalParams; psPreload = preload; --- poppler-30jul09/poppler/PSOutputDev.h- 2009-07-30 01:10:42.000000000 +0100 +++ poppler-30jul09/poppler/PSOutputDev.h 2009-07-30 01:12:09.000000000 +0100 @@ -358,6 +358,7 @@ // (only psModePSOrigPageSizes output mode) int imgLLX, imgLLY, // imageable area, in pts imgURX, imgURY; + GBool substFonts; // substitute missing fonts GBool preload; // load all images into memory, and // predefine forms --- poppler-30jul09/poppler/PSOutputDev.cc- 2009-07-30 01:10:42.000000000 +0100 +++ poppler-30jul09/poppler/PSOutputDev.cc 2009-07-30 01:12:09.000000000 +0100 @@ -1106,6 +1104,7 @@ paperHeight = 1; } } + substFonts = globalParams->getPSSubstFonts(); preload = globalParams->getPSPreload(); if (imgLLX == 0 && imgURX == 0 && imgLLY == 0 && imgURY == 0) { imgLLX = imgLLY = 0; @@ -1764,7 +1763,11 @@ if (font->isItalic()) { i += 1; } - psName = new GooString(psSubstFonts[i].psName); + if (substFonts) { + psName = new GooString(psSubstFonts[i].psName); + } else { + psName = new GooString(name); + } for (code = 0; code < 256; ++code) { if ((charName = ((Gfx8BitFont *)font)->getCharName(code)) && charName[0] == 'm' && charName[1] == '\0') { @@ -1778,7 +1781,7 @@ } w2 = psSubstFonts[i].mWidth; xs = w1 / w2; - if (xs < 0.1) { + if (xs < 0.1 || !substFonts) { xs = 1; } if (font->getType() == fontType3) {