From: Michal H. <ms...@gm...> - 2012-01-29 20:18:05
|
I have looked at SplashOutputDev::getFontById introduced by Pdfeditor and to be honest I didn't get the point of the function. It is quite hackish because we are allocating an artificial id just to use it as an argument. I know xpdf object hierarchy doesn't allow better implementation without much more code changes. The part I am not getting is why do we _need_ it at all when we can use getFont name with a name argument instead (fallback in the current implementation). So here is a RFC patch which removes the function and updates the gui to use only the fallback method. Let me know if I am missing something important and the function should stay. --- >From 7c96209bc3e0d430c6e2dc4301a2e5e3bc1bf5e1 Mon Sep 17 00:00:00 2001 From: Michal Hocko <ms...@gm...> Date: Sun, 29 Jan 2012 21:10:28 +0100 Subject: [RFC PATCH for gui-staging] Remove getFontById The functionality is not necessary as we still might use getFont with font->getName parameter so rather use that than adding a new code. --- src/gui/TabPage.cpp | 4 +--- src/xpdf/xpdf/SplashOutputDev.cc | 12 ------------ src/xpdf/xpdf/SplashOutputDev.h | 2 -- 3 files changed, 1 insertions(+), 17 deletions(-) diff --git a/src/gui/TabPage.cpp b/src/gui/TabPage.cpp index d2b9423..17d0805 100644 --- a/src/gui/TabPage.cpp +++ b/src/gui/TabPage.cpp @@ -2938,9 +2938,7 @@ GlyphInfo TabPage::checkCode( QString s, std::string fontName ) Unicode u = s[i].unicode(); char c = font->getCodeFromUnicode(&u,1); double temp[] = {1,0,0,1,0,0}; - SplashFont * fnt = splash.getFontById(font); - if (!fnt) - fnt = splash.getFont(font->getName(),temp); + SplashFont * fnt = splash.getFont(font->getName(),temp); SplashGlyphBitmap tBitmap; assert(fnt); fnt->getGlyph(c,0,0,&tBitmap); diff --git a/src/xpdf/xpdf/SplashOutputDev.cc b/src/xpdf/xpdf/SplashOutputDev.cc index b7fea5c..5c61a01 100644 --- a/src/xpdf/xpdf/SplashOutputDev.cc +++ b/src/xpdf/xpdf/SplashOutputDev.cc @@ -959,18 +959,6 @@ void SplashOutputDev::updateStrokeOpacity(GfxState *state) { void SplashOutputDev::updateFont(GfxState *state) { needFontUpdate = gTrue; } -SplashFont * SplashOutputDev::getFontById(GfxFont * gfxFont) -{ - SplashOutFontFileID *id; - id = new SplashOutFontFileID(gfxFont->getID()); - SplashFontFile *fontFile = fontEngine->getFontFile(id); - delete id; - if (!fontFile ) - return NULL; - SplashCoord coord[] = {1,0,0,1,0,0}; - SplashFont * fnt = fontEngine->getFont(fontFile,coord,coord); - return fnt; -} void SplashOutputDev::doUpdateFont(GfxState *state) { const GfxFont *gfxFont; GfxFontType fontType; diff --git a/src/xpdf/xpdf/SplashOutputDev.h b/src/xpdf/xpdf/SplashOutputDev.h index ad5c037..04ee167 100644 --- a/src/xpdf/xpdf/SplashOutputDev.h +++ b/src/xpdf/xpdf/SplashOutputDev.h @@ -78,8 +78,6 @@ public: //----- save/restore graphics state virtual void saveState(GfxState *state); virtual void restoreState(GfxState *state); - - SplashFont * getFontById(GfxFont * gfxFont); //----- update graphics state virtual void updateAll(GfxState *state); virtual void updateCTM(GfxState *state, double m11, double m12, -- 1.7.8.3 -- Michal Hocko |