diff --git a/src/Notepad3.c b/src/Notepad3.c index 2c246e711..d602114a3 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -179,21 +179,20 @@ int iSciDirectWriteTech; int iSciFontQuality; int iHighDpiToolBar; -const int DirectWriteTechnology[] = { +const int DirectWriteTechnology[4] = { SC_TECHNOLOGY_DEFAULT , SC_TECHNOLOGY_DIRECTWRITE , SC_TECHNOLOGY_DIRECTWRITERETAIN , SC_TECHNOLOGY_DIRECTWRITEDC }; -const int FontQuality[] = { +const int FontQuality[4] = { SC_EFF_QUALITY_DEFAULT , SC_EFF_QUALITY_NON_ANTIALIASED , SC_EFF_QUALITY_ANTIALIASED , SC_EFF_QUALITY_LCD_OPTIMIZED }; - typedef struct _wi { int x; @@ -698,8 +697,6 @@ int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpCmdLine,int n if (IsVista()) { if (iSciDirectWriteTech >= 0) SciCall_SetTechnology(DirectWriteTechnology[iSciDirectWriteTech]); - if (iSciFontQuality >= 0) - SciCall_SetFontQuality(FontQuality[iSciFontQuality]); } if (bAccelWordNavigation) @@ -5894,8 +5891,8 @@ void LoadSettings() iSciDirectWriteTech = IniSectionGetInt(pIniSection,L"SciDirectWriteTech",-1); iSciDirectWriteTech = max(min(iSciDirectWriteTech,3),-1); - iSciFontQuality = IniSectionGetInt(pIniSection,L"SciFontQuality",-1); - iSciFontQuality = max(min(iSciFontQuality,3),-1); + iSciFontQuality = IniSectionGetInt(pIniSection,L"SciFontQuality",0); + iSciFontQuality = max(min(iSciFontQuality,3),0); WCHAR buffer[MIDSZ_BUFFER] = { L'\0' }; const WCHAR defextwsc[] = L"!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~"; // underscore counted as part of word @@ -5908,7 +5905,6 @@ void LoadSettings() chExtendedWhiteSpaceChars[i] = ' '; // space } - LoadIniSection(L"Toolbar Images",pIniSection,cchIniSection); IniSectionGetString(pIniSection,L"BitmapDefault",L"", @@ -5927,7 +5923,7 @@ void LoadSettings() StringCchPrintf(tchHighDpiToolBar,COUNTOF(tchHighDpiToolBar),L"%ix%i HighDpiToolBar", ResX, ResY); iHighDpiToolBar = IniSectionGetInt(pIniSection, tchHighDpiToolBar, -1); iHighDpiToolBar = max(min(iHighDpiToolBar, 1), -1); - if (iHighDpiToolBar < 0) { // undefined: derermine high DPI (higher than Full-HD) + if (iHighDpiToolBar < 0) { // undefined: determine high DPI (higher than Full-HD) if ((ResX > 1920) && (ResY > 1080)) iHighDpiToolBar = 1; } @@ -5960,7 +5956,7 @@ void LoadSettings() WCHAR tchSciFontQuality[32]; StringCchPrintf(tchSciFontQuality,COUNTOF(tchSciFontQuality),L"%ix%i SciFontQuality",ResX,ResY); iSciFontQuality = IniSectionGetInt(pIniSection,tchSciFontQuality,iSciFontQuality); - iSciFontQuality = max(min(iSciFontQuality,3),-1); + iSciFontQuality = max(min(iSciFontQuality,3),0); LocalFree(pIniSection); diff --git a/src/SciCall.h b/src/SciCall.h index f1ff6fc19..d15958ddd 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -162,11 +162,4 @@ DeclareSciCallV2(SetProperty, SETPROPERTY, const char *, key, const char *, valu DeclareSciCallV1(SetTechnology, SETTECHNOLOGY, int, technology); -//============================================================================= -// -// SetFontQuality -// -// -DeclareSciCallV1(SetFontQuality, SETFONTQUALITY, int, quality); - #endif //_NP3_SCICALL_H_ diff --git a/src/Styles.c b/src/Styles.c index 8402ca590..01326cf33 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -35,6 +35,8 @@ extern HINSTANCE g_hInstance; extern int iEncoding; +extern int iSciFontQuality; +extern const int FontQuality[4]; #define MULTI_STYLE(a,b,c,d) ((a)|(b<<8)|(c<<16)|(d<<24)) @@ -4272,20 +4274,20 @@ void Style_SetStyles(HWND hwnd,int iStyle,LPCWSTR lpszStyle) // void Style_SetFontQuality(HWND hwnd,LPCWSTR lpszStyle) { - WPARAM wQuality = SC_EFF_QUALITY_DEFAULT; - WCHAR tch[32]; + WPARAM wQuality = (WPARAM)FontQuality[iSciFontQuality];; + WCHAR tch[64] = { L'\0' }; if (Style_StrGetFontQuality(lpszStyle,tch,COUNTOF(tch))) { - if (lstrcmpi(tch,L"none") == 0) + if (lstrcmpi(tch,L"default") == 0) + wQuality = SC_EFF_QUALITY_DEFAULT; + else if (lstrcmpi(tch,L"none") == 0) wQuality = SC_EFF_QUALITY_NON_ANTIALIASED; else if (lstrcmpi(tch,L"standard") == 0) wQuality = SC_EFF_QUALITY_ANTIALIASED; else if (lstrcmpi(tch,L"cleartype") == 0) wQuality = SC_EFF_QUALITY_LCD_OPTIMIZED; - else - wQuality = SC_EFF_QUALITY_DEFAULT; } - else { + else { // undefined, use general settings, except for special fonts if (Style_StrGetFont(lpszStyle,tch,COUNTOF(tch))) { if (lstrcmpi(tch,L"Calibri") == 0 || lstrcmpi(tch,L"Cambria") == 0 || @@ -4293,11 +4295,10 @@ void Style_SetFontQuality(HWND hwnd,LPCWSTR lpszStyle) { lstrcmpi(tch,L"Consolas") == 0 || lstrcmpi(tch,L"Constantia") == 0 || lstrcmpi(tch,L"Corbel") == 0 || - lstrcmpi(tch,L"Segoe UI") == 0) + lstrcmpi(tch,L"Segoe UI") == 0 || + lstrcmpi(tch,L"Source Code Pro") == 0) wQuality = SC_EFF_QUALITY_LCD_OPTIMIZED; } - else - wQuality = SC_EFF_QUALITY_DEFAULT; } SendMessage(hwnd,SCI_SETFONTQUALITY,wQuality,0); }