diff options
author | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2004-05-16 22:45:42 (GMT) |
---|---|---|
committer | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2004-05-16 22:45:42 (GMT) |
commit | ad63666daeeda50acc7630132d61fe044634fddd (patch) | |
tree | 487b52b30f8a563cbb2e16c6fd2527a6eeb5990f /pdf/xpdf/pdffonts.cc | |
parent | d57c02ebc09bfd1a0cac44140ec7a80dbe43877e (diff) |
Imported Xpdf 2.03 and fixed build.
* ANNOUNCE:
* CHANGES:
* README:
* aconf2.h:
* configure.in:
* dj_make.bat:
* doc/pdffonts.1:
* doc/pdffonts.cat:
* doc/pdffonts.hlp:
* doc/pdfimages.1:
* doc/pdfimages.cat:
* doc/pdfimages.hlp:
* doc/pdfinfo.1:
* doc/pdfinfo.cat:
* doc/pdfinfo.hlp:
* doc/pdftopbm.1:
* doc/pdftopbm.cat:
* doc/pdftopbm.hlp:
* doc/pdftops.1:
* doc/pdftops.cat:
* doc/pdftops.hlp:
* doc/pdftotext.1:
* doc/pdftotext.cat:
* doc/pdftotext.hlp:
* doc/xpdf.1:
* doc/xpdf.cat:
* doc/xpdf.hlp:
* doc/xpdfrc.5:
* doc/xpdfrc.cat:
* doc/xpdfrc.hlp:
* goo/gfile.cc:
* ms_make.bat:
* vms_make.com:
* xpdf/Annot.cc:
* xpdf/Array.cc:
* xpdf/BuiltinFontTables.cc:
* xpdf/CMap.cc:
* xpdf/CMap.h:
* xpdf/Catalog.cc:
* xpdf/CharCodeToUnicode.cc:
* xpdf/CharCodeToUnicode.h:
* xpdf/Decrypt.cc:
* xpdf/Dict.cc:
* xpdf/ErrorCodes.h:
* xpdf/FTFont.cc:
* xpdf/FTFont.h:
* xpdf/FontFile.cc:
* xpdf/FontFile.h:
* xpdf/Function.cc:
* xpdf/Gfx.cc:
* xpdf/Gfx.h:
* xpdf/GfxFont.cc:
* xpdf/GfxFont.h:
* xpdf/GfxState.cc:
* xpdf/GfxState.h:
* xpdf/GlobalParams.cc:
* xpdf/GlobalParams.h:
* xpdf/JBIG2Stream.cc:
* xpdf/Link.cc:
* xpdf/Link.h:
* xpdf/Makefile.am:
* xpdf/OutputDev.h:
* xpdf/PDFDoc.cc:
* xpdf/PDFDoc.h:
* xpdf/PSOutputDev.cc:
* xpdf/PSOutputDev.h:
* xpdf/Page.cc:
* xpdf/Page.h:
* xpdf/Parser.cc:
* xpdf/Stream.cc:
* xpdf/Stream.h:
* xpdf/TTFont.cc:
* xpdf/TTFont.h:
* xpdf/TextOutputDev.cc:
* xpdf/TextOutputDev.h:
* xpdf/UnicodeMap.cc:
* xpdf/UnicodeMap.h:
* xpdf/UnicodeTypeTable.cc:
* xpdf/UnicodeTypeTable.h:
* xpdf/XOutputDev.cc:
* xpdf/XOutputDev.h:
* xpdf/XPDFApp.cc:
* xpdf/XPDFCore.cc:
* xpdf/XPDFCore.h:
* xpdf/XPDFViewer.cc:
* xpdf/XPDFViewer.h:
* xpdf/XRef.cc:
* xpdf/about-text.h:
* xpdf/config.h:
* xpdf/gpdf-control.cc:
* xpdf/gpdf-link-canvas-item.cc:
* xpdf/gpdf-links-canvas-layer.cc:
* xpdf/pdffonts.cc:
* xpdf/pdfimages.cc:
* xpdf/pdfinfo.cc:
* xpdf/pdftopbm.cc:
* xpdf/pdftops.cc:
* xpdf/pdftotext.cc:
* xpdf/tests/test-links.cc:
* xpdf/vms_make.com:
* xpdf/xpdf.cc: Imported Xpdf 2.03 and fixed build.
Diffstat (limited to 'pdf/xpdf/pdffonts.cc')
-rw-r--r-- | pdf/xpdf/pdffonts.cc | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/pdf/xpdf/pdffonts.cc b/pdf/xpdf/pdffonts.cc index f3a1b48..2fcd1a8 100644 --- a/pdf/xpdf/pdffonts.cc +++ b/pdf/xpdf/pdffonts.cc @@ -40,8 +40,8 @@ static void scanFont(GfxFont *font, PDFDoc *doc); static int firstPage = 1; static int lastPage = 0; -static char ownerPassword[33] = ""; -static char userPassword[33] = ""; +static char ownerPassword[33] = "\001"; +static char userPassword[33] = "\001"; static char cfgFileName[256] = ""; static GBool printVersion = gFalse; static GBool printHelp = gFalse; @@ -91,10 +91,10 @@ int main(int argc, char *argv[]) { // parse args ok = parseArgs(argDesc, &argc, argv); if (!ok || argc != 2 || printVersion || printHelp) { - fprintf(stderr, "pdfinfo version %s\n", xpdfVersion); + fprintf(stderr, "pdffonts version %s\n", xpdfVersion); fprintf(stderr, "%s\n", xpdfCopyright); if (!printVersion) { - printUsage("pdfinfo", "<PDF-file>", argDesc); + printUsage("pdffonts", "<PDF-file>", argDesc); } goto err0; } @@ -104,12 +104,12 @@ int main(int argc, char *argv[]) { globalParams = new GlobalParams(cfgFileName); // open PDF file - if (ownerPassword[0]) { + if (ownerPassword[0] != '\001') { ownerPW = new GString(ownerPassword); } else { ownerPW = NULL; } - if (userPassword[0]) { + if (userPassword[0] != '\001') { userPW = new GString(userPassword); } else { userPW = NULL; @@ -176,22 +176,33 @@ int main(int argc, char *argv[]) { } static void scanFonts(Dict *resDict, PDFDoc *doc) { + Object obj1, obj2, xObjDict, xObj, resObj; + Ref r; GfxFontDict *gfxFontDict; GfxFont *font; - Object fontDict, xObjDict, xObj, resObj; int i; // scan the fonts in this resource dictionary - resDict->lookup("Font", &fontDict); - if (fontDict.isDict()) { - gfxFontDict = new GfxFontDict(doc->getXRef(), fontDict.getDict()); + gfxFontDict = NULL; + resDict->lookupNF("Font", &obj1); + if (obj1.isRef()) { + obj1.fetch(doc->getXRef(), &obj2); + if (obj2.isDict()) { + r = obj1.getRef(); + gfxFontDict = new GfxFontDict(doc->getXRef(), &r, obj2.getDict()); + } + obj2.free(); + } else if (obj1.isDict()) { + gfxFontDict = new GfxFontDict(doc->getXRef(), NULL, obj1.getDict()); + } + if (gfxFontDict) { for (i = 0; i < gfxFontDict->getNumFonts(); ++i) { font = gfxFontDict->getFont(i); scanFont(font, doc); } delete gfxFontDict; } - fontDict.free(); + obj1.free(); // recursively scan any resource dictionaries in objects in this // resource dictionary @@ -228,17 +239,12 @@ static void scanFont(GfxFont *font, PDFDoc *doc) { } } - // get the original font name -- the GfxFont class munges substitute - // Base-14 font names into proper form, so this code grabs the - // original name from the font dictionary; also look for a ToUnicode - // map - name = NULL; + // font name + name = font->getOrigName(); + + // look for a ToUnicode map hasToUnicode = gFalse; if (doc->getXRef()->fetch(fontRef.num, fontRef.gen, &fontObj)->isDict()) { - if (fontObj.dictLookup("BaseFont", &nameObj)->isName()) { - name = new GString(nameObj.getName()); - } - nameObj.free(); hasToUnicode = fontObj.dictLookup("ToUnicode", &toUnicodeObj)->isStream(); toUnicodeObj.free(); } @@ -263,14 +269,11 @@ static void scanFont(GfxFont *font, PDFDoc *doc) { font->getEmbeddedFontID(&embRef) ? "yes" : "no", subset ? "yes" : "no", hasToUnicode ? "yes" : "no"); - if (fontRef.gen == 999999) { + if (fontRef.gen >= 100000) { printf(" [none]\n"); } else { printf(" %6d %2d\n", fontRef.num, fontRef.gen); } - if (name) { - delete name; - } // add this font to the list if (fontsLen == fontsSize) { |