Fix font definition for languages regression in Style Configurator

Defining font for languages is no more possible in Style Configurator.
This regression is due to commit 1567847 (PR #10483).

Fix #11786, close #11787
pull/11790/head
Don Ho 2 years ago
parent 79e766755d
commit 2d7b2093a1

@ -3796,6 +3796,7 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode)
if (str)
{
s._fontName = str;
s._isFontEnabled = true;
}
str = element->Attribute(TEXT("fontStyle"));

@ -401,9 +401,12 @@ struct Style final
COLORREF _fgColor = COLORREF(STYLE_NOT_USED);
COLORREF _bgColor = COLORREF(STYLE_NOT_USED);
int _colorStyle = COLORSTYLE_ALL;
bool _isFontEnabled = false;
generic_string _fontName;
int _fontStyle = FONTSTYLE_NONE;
int _fontSize = STYLE_NOT_USED;
int _nesting = FONTSTYLE_NONE;
int _keywordClass = STYLE_NOT_USED;

@ -968,25 +968,22 @@ void WordStyleDlg::setVisualFromStyleList()
InvalidateRect(_hBgColourStaticText, NULL, FALSE);
//-- font name
isEnable = false;
LRESULT iFontName;
if (!style._fontName.empty())
{
iFontName = ::SendMessage(_hFontNameCombo, CB_FINDSTRING, 1, reinterpret_cast<LPARAM>(style._fontName.c_str()));
if (iFontName == CB_ERR)
iFontName = 0;
isEnable = true;
}
else
{
iFontName = 0;
}
::SendMessage(_hFontNameCombo, CB_SETCURSEL, iFontName, 0);
::EnableWindow(_hFontNameCombo, isEnable);
::EnableWindow(_hFontNameCombo, style._isFontEnabled);
InvalidateRect(_hFontNameStaticText, NULL, FALSE);
//-- font size
isEnable = false;
const size_t intStrLen = 3;
TCHAR intStr[intStrLen];
LRESULT iFontSize = 0;
@ -994,14 +991,12 @@ void WordStyleDlg::setVisualFromStyleList()
{
wsprintf(intStr, TEXT("%d"), style._fontSize);
iFontSize = ::SendMessage(_hFontSizeCombo, CB_FINDSTRING, 1, reinterpret_cast<LPARAM>(intStr));
isEnable = true;
}
::SendMessage(_hFontSizeCombo, CB_SETCURSEL, iFontSize, 0);
::EnableWindow(_hFontSizeCombo, isEnable);
::EnableWindow(_hFontSizeCombo, style._isFontEnabled);
InvalidateRect(_hFontSizeStaticText, NULL, FALSE);
//-- font style : bold & italic
isEnable = false;
if (style._fontStyle != STYLE_NOT_USED)
{
int isBold = (style._fontStyle & FONTSTYLE_BOLD)?BST_CHECKED:BST_UNCHECKED;
@ -1010,7 +1005,6 @@ void WordStyleDlg::setVisualFromStyleList()
::SendMessage(_hCheckBold, BM_SETCHECK, isBold, 0);
::SendMessage(_hCheckItalic, BM_SETCHECK, isItalic, 0);
::SendMessage(_hCheckUnderline, BM_SETCHECK, isUnderline, 0);
isEnable = true;
}
else // STYLE_NOT_USED : reset them all
{
@ -1019,7 +1013,7 @@ void WordStyleDlg::setVisualFromStyleList()
::SendMessage(_hCheckUnderline, BM_SETCHECK, BST_UNCHECKED, 0);
}
enableFontStyle(isEnable);
enableFontStyle(style._isFontEnabled);
//-- Default Keywords

Loading…
Cancel
Save