From 4fe2e7f02882419ef4ae716b723af01fb328b17a Mon Sep 17 00:00:00 2001 From: Ashish Kulkarni Date: Sun, 28 Dec 2008 20:50:46 +0530 Subject: [PATCH] remove dead Win32 code --- poppler/GlobalParams.cc | 252 ----------------------------------------------- poppler/GlobalParams.h | 6 - 2 files changed, 0 insertions(+), 258 deletions(-) diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc index ee7bb12..d676177 100644 --- a/poppler/GlobalParams.cc +++ b/poppler/GlobalParams.cc @@ -137,251 +137,6 @@ DisplayFontParam::~DisplayFontParam() { } } -#ifdef WIN32 - -//------------------------------------------------------------------------ -// WinFontInfo -//------------------------------------------------------------------------ - -class WinFontInfo: public DisplayFontParam { -public: - - GBool bold, italic; - - static WinFontInfo *make(GooString *nameA, GBool boldA, GBool italicA, - HKEY regKey, char *winFontDir); - WinFontInfo(GooString *nameA, GBool boldA, GBool italicA, - GooString *fileNameA); - virtual ~WinFontInfo(); - GBool equals(WinFontInfo *fi); -}; - -WinFontInfo *WinFontInfo::make(GooString *nameA, GBool boldA, GBool italicA, - HKEY regKey, char *winFontDir) { - GooString *regName; - GooString *fileNameA; - char buf[MAX_PATH]; - DWORD n; - char c; - int i; - - //----- find the font file - fileNameA = NULL; - regName = nameA->copy(); - if (boldA) { - regName->append(" Bold"); - } - if (italicA) { - regName->append(" Italic"); - } - regName->append(" (TrueType)"); - n = sizeof(buf); - if (RegQueryValueEx(regKey, regName->getCString(), NULL, NULL, - (LPBYTE)buf, &n) == ERROR_SUCCESS) { - fileNameA = new GooString(winFontDir); - fileNameA->append('\\')->append(buf); - } - delete regName; - if (!fileNameA) { - delete nameA; - return NULL; - } - - //----- normalize the font name - i = 0; - while (i < nameA->getLength()) { - c = nameA->getChar(i); - if (c == ' ' || c == ',' || c == '-') { - nameA->del(i); - } else { - ++i; - } - } - - return new WinFontInfo(nameA, boldA, italicA, fileNameA); -} - -WinFontInfo::WinFontInfo(GooString *nameA, GBool boldA, GBool italicA, - GooString *fileNameA): - DisplayFontParam(nameA, displayFontTT) -{ - bold = boldA; - italic = italicA; - tt.fileName = fileNameA; -} - -WinFontInfo::~WinFontInfo() { -} - -GBool WinFontInfo::equals(WinFontInfo *fi) { - return !name->cmp(fi->name) && bold == fi->bold && italic == fi->italic; -} - -//------------------------------------------------------------------------ -// WinFontList -//------------------------------------------------------------------------ - -class WinFontList { -public: - - WinFontList(char *winFontDirA); - ~WinFontList(); - WinFontInfo *find(GooString *font); - -private: - - void add(WinFontInfo *fi); - static int CALLBACK enumFunc1(CONST LOGFONT *font, - CONST TEXTMETRIC *metrics, - DWORD type, LPARAM data); - static int CALLBACK enumFunc2(CONST LOGFONT *font, - CONST TEXTMETRIC *metrics, - DWORD type, LPARAM data); - - GooList *fonts; // [WinFontInfo] - HDC dc; // (only used during enumeration) - HKEY regKey; // (only used during enumeration) - char *winFontDir; // (only used during enumeration) -}; - -WinFontList::WinFontList(char *winFontDirA) { - OSVERSIONINFO version; - char *path; - - fonts = new GooList(); - dc = GetDC(NULL); - winFontDir = winFontDirA; - version.dwOSVersionInfoSize = sizeof(version); - GetVersionEx(&version); - if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) { - path = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\\"; - } else { - path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts\\"; - } - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, path, 0, - KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, - ®Key) == ERROR_SUCCESS) { - EnumFonts(dc, NULL, &WinFontList::enumFunc1, (LPARAM)this); - RegCloseKey(regKey); - } - ReleaseDC(NULL, dc); -} - -WinFontList::~WinFontList() { - deleteGooList(fonts, WinFontInfo); -} - -void WinFontList::add(WinFontInfo *fi) { - int i; - - for (i = 0; i < fonts->getLength(); ++i) { - if (((WinFontInfo *)fonts->get(i))->equals(fi)) { - delete fi; - return; - } - } - fonts->append(fi); -} - -WinFontInfo *WinFontList::find(GooString *font) { - GooString *name; - GBool bold, italic; - WinFontInfo *fi; - char c; - int n, i; - - name = font->copy(); - - // remove space, comma, dash chars - i = 0; - while (i < name->getLength()) { - c = name->getChar(i); - if (c == ' ' || c == ',' || c == '-') { - name->del(i); - } else { - ++i; - } - } - n = name->getLength(); - - // remove trailing "MT" (Foo-MT, Foo-BoldMT, etc.) - if (!strcmp(name->getCString() + n - 2, "MT")) { - name->del(n - 2, 2); - n -= 2; - } - - // look for "Italic" - if (!strcmp(name->getCString() + n - 6, "Italic")) { - name->del(n - 6, 6); - italic = gTrue; - n -= 6; - } else { - italic = gFalse; - } - - // look for "Bold" - if (!strcmp(name->getCString() + n - 4, "Bold")) { - name->del(n - 4, 4); - bold = gTrue; - n -= 4; - } else { - bold = gFalse; - } - - // remove trailing "MT" (FooMT-Bold, etc.) - if (!strcmp(name->getCString() + n - 2, "MT")) { - name->del(n - 2, 2); - n -= 2; - } - - // remove trailing "PS" - if (!strcmp(name->getCString() + n - 2, "PS")) { - name->del(n - 2, 2); - n -= 2; - } - - // search for the font - fi = NULL; - for (i = 0; i < fonts->getLength(); ++i) { - fi = (WinFontInfo *)fonts->get(i); - if (!fi->name->cmp(name) && fi->bold == bold && fi->italic == italic) { - break; - } - fi = NULL; - } - - delete name; - return fi; -} - -int CALLBACK WinFontList::enumFunc1(CONST LOGFONT *font, - CONST TEXTMETRIC *metrics, - DWORD type, LPARAM data) { - WinFontList *fl = (WinFontList *)data; - - EnumFonts(fl->dc, font->lfFaceName, &WinFontList::enumFunc2, (LPARAM)fl); - return 1; -} - -int CALLBACK WinFontList::enumFunc2(CONST LOGFONT *font, - CONST TEXTMETRIC *metrics, - DWORD type, LPARAM data) { - WinFontList *fl = (WinFontList *)data; - WinFontInfo *fi; - - if (type & TRUETYPE_FONTTYPE) { - if ((fi = WinFontInfo::make(new GooString(font->lfFaceName), - font->lfWeight >= 600, - font->lfItalic ? gTrue : gFalse, - fl->regKey, fl->winFontDir))) { - fl->add(fi); - } - } - return 1; -} - -#endif // WIN32 - //------------------------------------------------------------------------ // PSFontParam //------------------------------------------------------------------------ @@ -635,10 +390,6 @@ GlobalParams::GlobalParams() { unicodeMapCache = new UnicodeMapCache(); cMapCache = new CMapCache(); -#ifdef WIN32 - winFontList = NULL; -#endif - #ifdef ENABLE_PLUGINS plugins = new GooList(); securityHandlers = new GooList(); @@ -788,9 +539,6 @@ GlobalParams::~GlobalParams() { deleteGooHash(unicodeMaps, GooString); deleteGooList(toUnicodeDirs, GooString); deleteGooHash(displayFonts, DisplayFontParam); -#ifdef WIN32 - delete winFontList; -#endif deleteGooHash(psFonts, PSFontParam); deleteGooList(psNamedFonts16, PSFontParam); deleteGooList(psFonts16, PSFontParam); diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h index 80c30f5..cdf4efc 100644 --- a/poppler/GlobalParams.h +++ b/poppler/GlobalParams.h @@ -57,9 +57,6 @@ class CMapCache; struct XpdfSecurityHandler; class GlobalParams; class GfxFont; -#ifdef WIN32 -class WinFontList; -#endif //------------------------------------------------------------------------ @@ -297,9 +294,6 @@ private: GooList *toUnicodeDirs; // list of ToUnicode CMap dirs [GooString] GooHash *displayFonts; // display font info, indexed by font name // [DisplayFontParam] -#ifdef WIN32 - WinFontList *winFontList; // system TrueType fonts -#endif GBool psExpandSmaller; // expand smaller pages to fill paper GBool psShrinkLarger; // shrink larger pages to fit paper GBool psCenter; // center pages on the paper -- 1.5.2.5