From 05e9d2e90e4a7cd738b25efdea4fcaacb1f3df0b Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sat, 27 Nov 2010 23:12:10 +1030 Subject: [PATCH] pdffonts: scan patterns for fonts Patterns can also use fonts --- utils/pdffonts.cc | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/utils/pdffonts.cc b/utils/pdffonts.cc index 30e25dc..11d61cc 100644 --- a/utils/pdffonts.cc +++ b/utils/pdffonts.cc @@ -208,7 +208,7 @@ int main(int argc, char *argv[]) { } static void scanFonts(Dict *resDict, PDFDoc *doc) { - Object obj1, obj2, xObjDict, xObj, resObj; + Object obj1, obj2, xObjDict, xObj, resObj, patObjDict, patObj; Ref r; GfxFontDict *gfxFontDict; GfxFont *font; @@ -254,6 +254,22 @@ static void scanFonts(Dict *resDict, PDFDoc *doc) { } } xObjDict.free(); + + resDict->lookup("Pattern", &patObjDict); + if (patObjDict.isDict()) { + for (i = 0; i < patObjDict.dictGetLength(); ++i) { + patObjDict.dictGetVal(i, &patObj); + if (patObj.isStream()) { + patObj.streamGetDict()->lookup("Resources", &resObj); + if (resObj.isDict()) { + scanFonts(resObj.getDict(), doc); + } + resObj.free(); + } + patObj.free(); + } + } + patObjDict.free(); } static void scanFont(GfxFont *font, PDFDoc *doc) { -- 1.7.1