mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
[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);
|
::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()
|
void NppParameters::getLangKeywordsFromXmlTree()
|
||||||
{
|
{
|
||||||
|
@ -1366,6 +1366,7 @@ public:
|
|||||||
void setCurLineHilitingColour(COLORREF colour2Set);
|
void setCurLineHilitingColour(COLORREF colour2Set);
|
||||||
|
|
||||||
void setFontList(HWND hWnd);
|
void setFontList(HWND hWnd);
|
||||||
|
bool isInFontList(const generic_string fontName2Search) const;
|
||||||
const std::vector<generic_string>& getFontList() const { return _fontlist; }
|
const std::vector<generic_string>& getFontList() const { return _fontlist; }
|
||||||
|
|
||||||
int getNbUserLang() const {return _nbUserLang;}
|
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);
|
return _callWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DEFAULT_FONT_NAME "Courier New"
|
||||||
|
|
||||||
void ScintillaEditView::setSpecialStyle(const Style & styleToSet)
|
void ScintillaEditView::setSpecialStyle(const Style & styleToSet)
|
||||||
{
|
{
|
||||||
@ -441,8 +442,16 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet)
|
|||||||
if (styleToSet._fontName && lstrcmp(styleToSet._fontName, TEXT("")) != 0)
|
if (styleToSet._fontName && lstrcmp(styleToSet._fontName, TEXT("")) != 0)
|
||||||
{
|
{
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
const char * fontNameA = wmc->wchar2char(styleToSet._fontName, CP_UTF8);
|
|
||||||
execute(SCI_STYLESETFONT, (WPARAM)styleID, (LPARAM)fontNameA);
|
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;
|
int fontStyle = styleToSet._fontStyle;
|
||||||
if (fontStyle != STYLE_NOT_USED)
|
if (fontStyle != STYLE_NOT_USED)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user