Prevent Direct Write being set if user uses RTL

Ref: 975d29b30b (commitcomment-132946815)

Close #14374
This commit is contained in:
Don Ho 2023-11-19 18:26:56 +01:00
parent c62e222985
commit 9bc790b014
6 changed files with 34 additions and 9 deletions

View File

@ -5,7 +5,7 @@ Translation note:
2. All the comments are for explanation, they are not for translation. 2. All the comments are for explanation, they are not for translation.
--> -->
<NotepadPlus> <NotepadPlus>
<Native-Langue name="English" filename="english.xml" version="8.5.9"> <Native-Langue name="English" filename="english.xml" version="8.6">
<Menu> <Menu>
<Main> <Main>
<!-- Main Menu Entries --> <!-- Main Menu Entries -->
@ -1505,6 +1505,7 @@ NOTE: Choosing not to create the placeholders or closing them later, your manual
Would you like to create those placeholders? Would you like to create those placeholders?
NOTE: Choosing not to create the placeholders or closing them later, your session WILL BE MODIFIED ON EXIT! We suggest you backup your &quot;session.xml&quot; now."/> NOTE: Choosing not to create the placeholders or closing them later, your session WILL BE MODIFIED ON EXIT! We suggest you backup your &quot;session.xml&quot; now."/>
<RTLvsDirectWrite title="Cannot run RTL" message="RTL is not compatible with DirectWrite mode. Please disable DirectWrite mode in MISC. section of Preferences dialog, restart Notepad++, and try this command again."/>
</MessageBox> </MessageBox>
<ClipboardHistory> <ClipboardHistory>
<PanelTitle name="Clipboard History"/> <PanelTitle name="Clipboard History"/>

View File

@ -5,7 +5,7 @@ Translation note:
2. All the comments are for explanation, they are not for translation. 2. All the comments are for explanation, they are not for translation.
--> -->
<NotepadPlus> <NotepadPlus>
<Native-Langue name="English" filename="english_customizable.xml" version="8.5.9"> <Native-Langue name="English" filename="english_customizable.xml" version="8.6">
<Menu> <Menu>
<Main> <Main>
<!-- Main Menu Entries --> <!-- Main Menu Entries -->
@ -1505,6 +1505,7 @@ NOTE: Choosing not to create the placeholders or closing them later, your manual
Would you like to create those placeholders? Would you like to create those placeholders?
NOTE: Choosing not to create the placeholders or closing them later, your session WILL BE MODIFIED ON EXIT! We suggest you backup your &quot;session.xml&quot; now."/> NOTE: Choosing not to create the placeholders or closing them later, your session WILL BE MODIFIED ON EXIT! We suggest you backup your &quot;session.xml&quot; now."/>
<RTLvsDirectWrite title="Cannot run RTL" message="RTL is not compatible with DirectWrite mode. Please disable DirectWrite mode in MISC. section of Preferences dialog, restart Notepad++, and try this command again."/>
</MessageBox> </MessageBox>
<ClipboardHistory> <ClipboardHistory>
<PanelTitle name="Clipboard History"/> <PanelTitle name="Clipboard History"/>

View File

@ -5,7 +5,7 @@ Translation note:
2. All the comments are for explanation, they are not for translation. 2. All the comments are for explanation, they are not for translation.
--> -->
<NotepadPlus> <NotepadPlus>
<Native-Langue name="français" filename="french.xml" version="8.5.9"> <Native-Langue name="français" filename="french.xml" version="8.6">
<Menu> <Menu>
<Main> <Main>
<!-- Main Menu Entries --> <!-- Main Menu Entries -->
@ -1505,6 +1505,7 @@ Notez que si vous choisissez de ne pas créer d'espaces réservés ou de les fer
Voulez-vous créer des espaces réservés pour eux ? Voulez-vous créer des espaces réservés pour eux ?
NOTE : Si vous choisissez de ne pas créer d'espaces réservés ou de les fermer plus tard, votre fichier de session sera modifié à la sortie. Nous vous suggérons de faire une sauvegarde du fichier de session &quot;session.xml&quot; maintenant."/> NOTE : Si vous choisissez de ne pas créer d'espaces réservés ou de les fermer plus tard, votre fichier de session sera modifié à la sortie. Nous vous suggérons de faire une sauvegarde du fichier de session &quot;session.xml&quot; maintenant."/>
<RTLvsDirectWrite title="Exécution de la commande &quot;Texte de droite à gauche&quot; impossible" message="&quot;Texte de droite à gauche&quot; n'est pas compatible avec le mode &quot;DirectWrite&quot;. Veuillez désactiver ce mode dans la section &quot;Divers&quot; du dialogue Préférences, redémarer Notepad++, pour exécuter la commande de nouveau."/>
</MessageBox> </MessageBox>
<ClipboardHistory> <ClipboardHistory>
<PanelTitle name="Historique du presse-papier"/> <PanelTitle name="Historique du presse-papier"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<NotepadPlus> <NotepadPlus>
<Native-Langue name="台灣繁體" filename="taiwaneseMandarin.xml" version="8.5.9"> <Native-Langue name="台灣繁體" filename="taiwaneseMandarin.xml" version="8.6">
<Menu> <Menu>
<Main> <Main>
<!-- Main Menu Entries --> <!-- Main Menu Entries -->
@ -1233,7 +1233,7 @@
<Item id="6324" name="文件切換器Ctrl + TAB"/> <Item id="6324" name="文件切換器Ctrl + TAB"/>
<Item id="6331" name="在標題列僅顯示檔案名稱(隱藏資料夾路徑)"/> <Item id="6331" name="在標題列僅顯示檔案名稱(隱藏資料夾路徑)"/>
<Item id="6334" name="自動偵測檔案編碼"/> <Item id="6334" name="自動偵測檔案編碼"/>
<Item id="6349" name="使用 DirectWrite(可改善特殊字符的呈現,需要重新啟動 Notepad++"/> <Item id="6349" name="使用「直接寫入」模式(可改善特殊字符的呈現,需要重新啟動 Notepad++"/>
<Item id="6337" name="資料夾工作區檔案副檔名:"/> <Item id="6337" name="資料夾工作區檔案副檔名:"/>
<Item id="6114" name="啟動"/> <Item id="6114" name="啟動"/>
<Item id="6117" name="開啟「最近使用的檔案」功能"/> <Item id="6117" name="開啟「最近使用的檔案」功能"/>
@ -1390,6 +1390,7 @@
你想為它們創建佔位欄嗎? 你想為它們創建佔位欄嗎?
請注意,如果你選擇不創建佔位欄或稍後關閉它們,工作階段檔案將在 Notepad++ 關閉時被修改。我們建議你現在備份工作階段檔案 &quot;session.xml&quot; 。"/> 請注意,如果你選擇不創建佔位欄或稍後關閉它們,工作階段檔案將在 Notepad++ 關閉時被修改。我們建議你現在備份工作階段檔案 &quot;session.xml&quot; 。"/>
<RTLvsDirectWrite title="無法執行「文字由右至左」指令" message="「文字由右至左」指令與「直接寫入」模式不相容。 請在偏好設定對話框的「其他」中停用「直接寫入」模式,然後重新​​啟動 Notepad++,重試此指令。"/>
</MessageBox> </MessageBox>
<ClipboardHistory> <ClipboardHistory>
<PanelTitle name="剪貼簿記錄"/> <PanelTitle name="剪貼簿記錄"/>

View File

@ -3802,13 +3802,26 @@ void Notepad_plus::command(int id)
case IDM_EDIT_LTR : case IDM_EDIT_LTR :
{ {
bool toRTL = id == IDM_EDIT_RTL; bool toRTL = id == IDM_EDIT_RTL;
bool isRTL = _pEditView->isTextDirectionRTL(); bool isRTL = _pEditView->isTextDirectionRTL();
if ((toRTL && isRTL) || (!toRTL && !isRTL)) if ((toRTL && isRTL) || (!toRTL && !isRTL))
{ {
if (! ((NppParameters::getInstance()).getNppGUI())._muteSounds) if (! ((NppParameters::getInstance()).getNppGUI())._muteSounds)
::MessageBeep(MB_OK); ::MessageBeep(MB_OK);
break;
return;
}
if (toRTL && (NppParameters::getInstance()).getNppGUI()._writeTechnologyEngine == directWriteTechnology)
{
_nativeLangSpeaker.messageBox("RTLvsDirectWrite",
_pPublicInterface->getHSelf(),
TEXT("RTL is not compatible with Direct Write mode. Please disable DirectWrite mode in MISC. section of Preferences dialog, restart Notepad++, and try this command again."),
TEXT("Cannot run RTL"),
MB_OK | MB_APPLMODAL);
return;
} }
_pEditView->changeTextDirection(toRTL); _pEditView->changeTextDirection(toRTL);

View File

@ -312,10 +312,18 @@ 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);
NppGUI& nppGui = (NppParameters::getInstance()).getNppGUI();
HMODULE hNtdllModule = ::GetModuleHandle(L"ntdll.dll"); HMODULE hNtdllModule = ::GetModuleHandle(L"ntdll.dll");
FARPROC isWINE = ::GetProcAddress(hNtdllModule, "wine_get_version"); FARPROC isWINE = nullptr;
if ((NppParameters::getInstance()).getNppGUI()._writeTechnologyEngine == directWriteTechnology && !isWINE) // There is a performance issue under WINE when DirectWright is ON, if (hNtdllModule)
// so we turn it off if user uses Notepad++ under WINE isWINE = ::GetProcAddress(hNtdllModule, "wine_get_version");
if (isWINE || // There is a performance issue under WINE when DirectWright is ON, so we turn it off if user uses Notepad++ under WINE
isTextDirectionRTL()) // RTL is not compatible with Direct Write Technology
nppGui._writeTechnologyEngine = defaultTechnology;
if (nppGui._writeTechnologyEngine == directWriteTechnology)
{ {
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,