Merge pull request #151 from NN---/EnumFonts
[UPDATE] Use updated prototype of EnumFontFamExProc.
This commit is contained in:
commit
3ff0ad484d
@ -1628,10 +1628,7 @@ void NppParameters::setFontList(HWND hWnd)
|
|||||||
lf.lfPitchAndFamily = 0;
|
lf.lfPitchAndFamily = 0;
|
||||||
HDC hDC = ::GetDC(hWnd);
|
HDC hDC = ::GetDC(hWnd);
|
||||||
|
|
||||||
::EnumFontFamiliesEx(hDC,
|
::EnumFontFamiliesEx(hDC, &lf, EnumFontFamExProc, (LPARAM)&_fontlist, 0);
|
||||||
&lf,
|
|
||||||
(FONTENUMPROC) EnumFontFamExProc,
|
|
||||||
(LPARAM) &_fontlist, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NppParameters::getLangKeywordsFromXmlTree()
|
void NppParameters::getLangKeywordsFromXmlTree()
|
||||||
|
@ -1618,19 +1618,20 @@ private:
|
|||||||
COLORREF _currentDefaultBgColor;
|
COLORREF _currentDefaultBgColor;
|
||||||
COLORREF _currentDefaultFgColor;
|
COLORREF _currentDefaultFgColor;
|
||||||
|
|
||||||
static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *, int, LPARAM lParam) {
|
static int CALLBACK EnumFontFamExProc(const LOGFONT* lpelfe, const TEXTMETRIC *, DWORD, LPARAM lParam) {
|
||||||
std::vector<generic_string> *pStrVect = (std::vector<generic_string> *)lParam;
|
std::vector<generic_string>& strVect = *(std::vector<generic_string> *)lParam;
|
||||||
size_t vectSize = pStrVect->size();
|
const size_t vectSize = strVect.size();
|
||||||
|
const TCHAR* lfFaceName = ((ENUMLOGFONTEX*)lpelfe)->elfLogFont.lfFaceName;
|
||||||
|
|
||||||
//Search through all the fonts, EnumFontFamiliesEx never states anything about order
|
//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
|
//Start at the end though, that's the most likely place to find a duplicate
|
||||||
for(int i = vectSize - 1 ; i >= 0 ; i--) {
|
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
|
return 1; //we already have seen this typeface, ignore it
|
||||||
}
|
}
|
||||||
//We can add the font
|
//We can add the font
|
||||||
//Add the face name and not the full name, we do not care about any styles
|
//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
|
return 1; // I want to get all fonts
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user