zufuliu / notepad4

Notepad4 (Notepad2⨯2, Notepad2++) is a light-weight Scintilla based text editor for Windows with syntax highlighting, code folding, auto-completion and API list for many programming languages and documents, bundled with file browser plugin matepath.
Other
2.59k stars 184 forks source link

Direction for rtl #392

Open mammadkoma opened 2 years ago

mammadkoma commented 2 years ago

Hello How can we change the text direction to right to left (RTL)?

zufuliu commented 2 years ago

Please try Settings -> Advanced Settings -> Rendering Technology, Text Layout and Bidirectional menus.

mammadkoma commented 2 years ago

not work , not work in direction and not work to right text align.

zufuliu commented 2 years ago

Can you provide test file and expected working screenshot?

mammadkoma commented 2 years ago

image

mammadkoma commented 2 years ago

you should change direction to RTL and align text to the right by click on right ctrl and right shift on keyboard like this pic on sticky notes : image

zufuliu commented 2 years ago

I tried codes from https://docs.microsoft.com/en-us/windows/win32/winmsg/window-features#window-layout-and-mirroring, seems none is working.

After enable RTL layout (with WS_EX_LAYOUTRTL), text is right aligned, but not in correct direction.

zufuliu commented 2 years ago

@mammadkoma Can you test latest builds (with artifacts from https://github.com/zufuliu/notepad2/actions or https://ci.appveyor.com/project/zufuliu/notepad2), commit 8a5a6c4259753a13ac0fef2a6740c32ebbfb21b1 appears fixed the text direction problem for GDI RTL layout.

rdipardo commented 2 years ago

@zufuliu,

The Bidirectional (Direct2D) menu options still do nothing. It may be a separate issue, but I've seen that RTL only works when GDI rendering is active (same with Notepad3, like I reported here). Neil's patch did correct the direction, but only when "Legacy GDI" is selected.

np2_appveyor_directwrite

"DirectWrite GDI DC" reverts to the backward rendering as before the patch.

np2_appveyor_gdi

Notepad2 (64-bit) 4.22.03 r4130 (8a5a6c42)
Compiled on Apr  9 2022 with Visual C++ 19.16.27035.0, Scintilla 5.2.2.
Encoding: UTF-8, Windows-1252
Scheme: .txt, Text File
System: 10.0.22000  x64
zufuliu commented 2 years ago

SetLayout(hdc, LAYOUT_BITMAPORIENTATIONPRESERVED); can be added to make all Direct2D rendering technologies behaviors same (no RTL). see https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nn-d2d1-id2d1dcrendertarget#id2d1dcrendertargets--gdi-transforms--and-right-to-left-language-builds-of-windows

mammadkoma commented 2 years ago

I downloaded Notepad2_en_x64_v4.22.03r4130.zip from https://github.com/zufuliu/notepad2/releases/tag/v4.22.03r4130 , but still not work. image

zufuliu commented 2 years ago

@mammadkoma Sorry, I meant test the daily build from CI (for RTL Layout with Legacy GDI, Direct2D still not work), e.g. artifacts from https://github.com/zufuliu/notepad2/actions/runs/2142231772 or https://ci.appveyor.com/project/zufuliu/notepad2/builds/43187878/job/0v3o7t8jf637a5k8/artifacts

mammadkoma commented 2 years ago

Not work! You should add a button for direction like ms word with right ctrl+shift shortcut and left ctrl+shift shortcut toogle. image

zufuliu commented 2 years ago

@mammadkoma can paste the text in above and sticky notes screenshots?

mammadkoma commented 2 years ago

آموزش word فارسی سلام john