diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2012-06-12 12:25:33 +0200 |
---|---|---|
committer | Carlos Garcia Campos <cgarcia@igalia.com> | 2012-06-12 12:45:35 +0200 |
commit | a0cbbf68ea2082f29ed3bf0b5a17cae66df19cec (patch) | |
tree | 642f68b065114b835aec29135318fa389c1be3a9 | |
parent | 63f9ddbe99a4dab87cca25a20b8cc609321c8ce1 (diff) |
DisplayFontParam has been removed
Now is enough to override GlobalParams::findFontFile() and return the
font path.
-rw-r--r-- | lib/pdf/CharOutputDev.cc | 40 | ||||
-rw-r--r-- | lib/pdf/CharOutputDev.h | 3 |
2 files changed, 7 insertions, 36 deletions
diff --git a/lib/pdf/CharOutputDev.cc b/lib/pdf/CharOutputDev.cc index e9f3c5e3..9314ffb0 100644 --- a/lib/pdf/CharOutputDev.cc +++ b/lib/pdf/CharOutputDev.cc @@ -83,7 +83,6 @@ struct fontentry { char*pfb; int pfblen; char*fullfilename; - DisplayFontParam *dfp; } pdf2t1map[] ={ {"Times-Roman", "n021003l", n021003l_afm, n021003l_afm_len, n021003l_pfb, n021003l_pfb_len}, {"Times-Italic", "n021023l", n021023l_afm, n021023l_afm_len, n021023l_pfb, n021023l_pfb_len}, @@ -424,16 +423,7 @@ char* fontconfig_searchForFont(char*name) #endif } -static DisplayFontParamKind detectFontType(const char*filename) -{ - if(strstr(filename, ".ttf") || strstr(filename, ".TTF")) - return displayFontTT; - if(strstr(filename, ".pfa") || strstr(filename, ".PFA") || strstr(filename, ".pfb")) - return displayFontT1; - return displayFontTT; -} - -DisplayFontParam *GFXGlobalParams::getDisplayFont(GString *fontName) +GString *GFXGlobalParams::findFontFile(GString *fontName) { msg("<verbose> looking for font %s", fontName->getCString()); @@ -450,11 +440,8 @@ DisplayFontParam *GFXGlobalParams::getDisplayFont(GString *fontName) } else { msg("<verbose> Storing standard PDF font %s at %s", name, pdf2t1map[t].fullfilename); } - DisplayFontParam *dfp = new DisplayFontParam(new GString(fontName), displayFontT1); - dfp->t1.fileName = new GString(pdf2t1map[t].fullfilename); - pdf2t1map[t].dfp = dfp; } - return pdf2t1map[t].dfp; + return pdf2t1map[t].fullfilename ? new GString(pdf2t1map[t].fullfilename) : NULL; } } @@ -485,29 +472,14 @@ DisplayFontParam *GFXGlobalParams::getDisplayFont(GString *fontName) } if(filename) { + GString*retval = new GString(filename); msg("<verbose> Font %s maps to %s\n", name, filename); - DisplayFontParamKind kind = detectFontType(filename); - DisplayFontParam *dfp = new DisplayFontParam(new GString(fontName), kind); - if(kind == displayFontTT) { - dfp->tt.fileName = new GString(filename); - } else { - dfp->t1.fileName = new GString(filename); - } - free(filename); - return dfp; + free(filename); + return retval; } else { msg("<verbose> Font %s not found\n", name); - return GlobalParams::getDisplayFont(fontName); - } -} - -DisplayFontParam *GFXGlobalParams::getDisplayCIDFont(GString *fontName, GString *collection) -{ - DisplayFontParam*dfp = GlobalParams::getDisplayCIDFont(fontName, collection); - if(!dfp) { - dfp = this->getDisplayFont(fontName); + return GlobalParams::findFontFile(fontName); } - return dfp; } CharOutputDev::CharOutputDev(InfoOutputDev*info, PDFDoc*doc, int*page2page, int num_pages, int x, int y, int x1, int y1, int x2, int y2) diff --git a/lib/pdf/CharOutputDev.h b/lib/pdf/CharOutputDev.h index 08010904..b4e72ec8 100644 --- a/lib/pdf/CharOutputDev.h +++ b/lib/pdf/CharOutputDev.h @@ -112,8 +112,7 @@ class GFXGlobalParams: public GlobalParams { public: GFXGlobalParams(); ~GFXGlobalParams(); - virtual DisplayFontParam *getDisplayFont(GString *fontName); - virtual DisplayFontParam *getDisplayCIDFont(GString *fontName, GString *collection); + virtual GString *findFontFile(GString *fontName); }; #endif //__charoutputdev_h__ |