Enable Direct Write Technology in Scintilla by default

And disable Direct Write under WINE, due to the performance issue.
Ref: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/8510
pull/14379/head
Don Ho 1 year ago
parent 6ba33563bd
commit 975d29b30b

@ -822,7 +822,7 @@ struct NppGUI final
bool _muteSounds = false; bool _muteSounds = false;
bool _enableFoldCmdToggable = false; bool _enableFoldCmdToggable = false;
bool _hideMenuRightShortcuts = false; bool _hideMenuRightShortcuts = false;
writeTechnologyEngine _writeTechnologyEngine = defaultTechnology; writeTechnologyEngine _writeTechnologyEngine = directWriteTechnology;
bool _isWordCharDefault = true; bool _isWordCharDefault = true;
std::string _customWordChars; std::string _customWordChars;
urlMode _styleURL = urlUnderLineFg; urlMode _styleURL = urlUnderLineFg;

@ -312,10 +312,15 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT4, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT4, true);
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT5, true); execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT5, true);
if ((NppParameters::getInstance()).getNppGUI()._writeTechnologyEngine == directWriteTechnology) HMODULE hNtdllModule = ::GetModuleHandle(L"ntdll.dll");
FARPROC isWINE = ::GetProcAddress(hNtdllModule, "wine_get_version");
if ((NppParameters::getInstance()).getNppGUI()._writeTechnologyEngine == directWriteTechnology && !isWINE) // There is a performance issue under WINE when DirectWright is ON,
// so we turn it off if user uses Notepad++ under WINE
{
execute(SCI_SETTECHNOLOGY, SC_TECHNOLOGY_DIRECTWRITE); execute(SCI_SETTECHNOLOGY, SC_TECHNOLOGY_DIRECTWRITE);
// If useDirectWrite is turned off, leave the technology setting untouched, // If useDirectWrite is turned off, leave the technology setting untouched,
// so that existing plugins using SCI_SETTECHNOLOGY behave like before // so that existing plugins using SCI_SETTECHNOLOGY behave like before
}
_codepage = ::GetACP(); _codepage = ::GetACP();

Loading…
Cancel
Save