[RELEASE] Notepad++ 6.8.2 release
Use default font if font name loaded from stylers.xml cannot be found in system.
This commit is contained in:
parent
54b04cd284
commit
234e0615db
@ -1511,6 +1511,18 @@ void NppParameters::setFontList(HWND hWnd)
|
||||
::EnumFontFamiliesEx(hDC, &lf, EnumFontFamExProc, (LPARAM)&_fontlist, 0);
|
||||
}
|
||||
|
||||
bool NppParameters::isInFontList(const generic_string fontName2Search) const
|
||||
{
|
||||
if (fontName2Search.empty())
|
||||
return false;
|
||||
|
||||
for (size_t i = 0, len = _fontlist.size(); i < len; i++)
|
||||
{
|
||||
if (_fontlist[i] == fontName2Search)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void NppParameters::getLangKeywordsFromXmlTree()
|
||||
{
|
||||
|
@ -1366,6 +1366,7 @@ public:
|
||||
void setCurLineHilitingColour(COLORREF colour2Set);
|
||||
|
||||
void setFontList(HWND hWnd);
|
||||
bool isInFontList(const generic_string fontName2Search) const;
|
||||
const std::vector<generic_string>& getFontList() const { return _fontlist; }
|
||||
|
||||
int getNbUserLang() const {return _nbUserLang;}
|
||||
|
@ -428,6 +428,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
||||
return _callWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam);
|
||||
}
|
||||
|
||||
#define DEFAULT_FONT_NAME "Courier New"
|
||||
|
||||
void ScintillaEditView::setSpecialStyle(const Style & styleToSet)
|
||||
{
|
||||
@ -441,9 +442,17 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet)
|
||||
if (styleToSet._fontName && lstrcmp(styleToSet._fontName, TEXT("")) != 0)
|
||||
{
|
||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||
|
||||
if (not _pParameter->isInFontList(styleToSet._fontName))
|
||||
{
|
||||
execute(SCI_STYLESETFONT, (WPARAM)styleID, (LPARAM)DEFAULT_FONT_NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char * fontNameA = wmc->wchar2char(styleToSet._fontName, CP_UTF8);
|
||||
execute(SCI_STYLESETFONT, (WPARAM)styleID, (LPARAM)fontNameA);
|
||||
}
|
||||
}
|
||||
int fontStyle = styleToSet._fontStyle;
|
||||
if (fontStyle != STYLE_NOT_USED)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user