From 485c7f21d040e11cf24cae6f79613976bc7fed3c Mon Sep 17 00:00:00 2001 From: NN Date: Mon, 1 Jun 2015 21:09:10 +0300 Subject: [PATCH] Use correct prototype of EnumFontFamExProc. --- PowerEditor/src/Parameters.cpp | 5 +---- PowerEditor/src/Parameters.h | 11 ++++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 93086e7a..17bae060 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -1627,10 +1627,7 @@ void NppParameters::setFontList(HWND hWnd) lf.lfPitchAndFamily = 0; HDC hDC = ::GetDC(hWnd); - ::EnumFontFamiliesEx(hDC, - &lf, - (FONTENUMPROC) EnumFontFamExProc, - (LPARAM) &_fontlist, 0); + ::EnumFontFamiliesEx(hDC, &lf, EnumFontFamExProc, (LPARAM)&_fontlist, 0); } void NppParameters::getLangKeywordsFromXmlTree() diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 86243821..bd639309 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1618,19 +1618,20 @@ private: COLORREF _currentDefaultBgColor; COLORREF _currentDefaultFgColor; - static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *, int, LPARAM lParam) { - std::vector *pStrVect = (std::vector *)lParam; - size_t vectSize = pStrVect->size(); + static int CALLBACK EnumFontFamExProc(const LOGFONT* lpelfe, const TEXTMETRIC *, DWORD, LPARAM lParam) { + std::vector& strVect = *(std::vector *)lParam; + const size_t vectSize = strVect.size(); + const TCHAR* lfFaceName = ((ENUMLOGFONTEX*)lpelfe)->elfLogFont.lfFaceName; //Search through all the fonts, EnumFontFamiliesEx never states anything about order //Start at the end though, that's the most likely place to find a duplicate for(int i = vectSize - 1 ; i >= 0 ; i--) { - if ( !lstrcmp((*pStrVect)[i].c_str(), (const TCHAR *)lpelfe->elfLogFont.lfFaceName) ) + if ( !lstrcmp(strVect[i].c_str(), lfFaceName) ) return 1; //we already have seen this typeface, ignore it } //We can add the font //Add the face name and not the full name, we do not care about any styles - pStrVect->push_back((TCHAR *)lpelfe->elfLogFont.lfFaceName); + strVect.push_back(lfFaceName); return 1; // I want to get all fonts };