Forum > Packages and Libraries

TDWEdit

(1/8) > >>

Ed78z:
I'm wondering can anyone help me to write a new component to use it instead of TMemo or even TRichMemo?
A new component based on DirectWrite to render any text styles, formats, layouts,... in addition to support unicode beyond BMP (plane-0)

Please see the attached file as an idea.

dbannon:
Maybe you should look at using KMemo ?  (Might have same problem but don't know).

Failing that, I suggest 'fixing' either TRichMemo or KMemo would be a lot easier than starting from scratch.

Davo

dbannon:
OK, Ed, I have to agree. In my current setup, I cannot display any 4 byte utf8 characters in my app that uses KMemo. However, I used to be able to display, eg, the EGYPTIAN HIEROGLYPH starting at f0 93 80 80 (in a previous install of Linux). I assume I cannot now because the font I am using does not include that range. If that is the case then your problem is not KMemo but the default font.

In other words, before you abandon KMemo (or TRichMemo) I think you need to establish that the selected font can display the range you are needing. The full 5 byte range is a very large set of characters and the vast majority of users don't want to see many more than the 3 byte ones. So, I'd expect most font designers cut some corners to save space. Perhaps ...

Davo

gues1:

--- Quote from: Ed78z on August 04, 2025, 08:20:15 am ---
--- Quote from: dbannon on August 04, 2025, 07:20:51 am ---Maybe you should look at using KMemo ?  (Might have same problem but don't know).

Failing that, I suggest 'fixing' either TRichMemo or KMemo would be a lot easier than starting from scratch.

Davo

--- End quote ---

Thank you for your response, basically TMemo, TRichMemo, KMemo,... all based on GDI not the DirectWrite. The GDI is not reliable for the unicode beyond plane 0 ($0000-$FFFF),  it means for all the characters beyond $10000 has issue and may acts strangely. (you may see this issue in MS WordPad that uses RichEdit v8.0)
Also, advance text style, text layout, scripts, advanced OpenType fonts ... must be done via DirectWire (Windows) [or CoreText (macOS), HarfBuzz (cross-platform)]

https://forum.lazarus.freepascal.org/index.php/topic,71899.msg562024.html#msg562024

Thanks!

--- End quote ---
Wordpad is not distribuited nor present in any actual editions of Windows 11, so you cannot relay on this.

Richedit is based now on version 8.5.

Untill now all characters (or better, all chars I used 'till now) in all defined Planes are working in normal mode for me (I use Delphi, but Lazarus use exactly the same component).
There were some issue in some particular chars (but I have nomore those issues) trasformed with properties (like UpperCase, LowerCase).

I nevere had problems with bolds (I used arabian, chinese and japan chars and cyrillic some times with their various "model"), but I never try to write something about text layout (like oriented chars i.e.).

Also the fonts used are the normal one used commonly.

Your project seems to be very ambitious.

Note: Richedit can work with DirectWrite too .... I'm going to do some tests ..

gues1:

--- Quote from: Ed78z on August 04, 2025, 04:56:38 pm ---WordPad.exe located at C:\Program Files\Windows NT\Accessories, its version is 10.0.22621.3810
Modern WordPad uses msftedit.dll which is located at C:\Windows\System32, if you right click on it and get properties, you will see: Rich Text Edit Control, v8.5

--- End quote ---
Current version of Windows 11 is: "10.0.26100.4770" and there is no WordPad.

I used the new RichEdit control that can works with D2D (DirectWrite), simply activate it by a MESSAGE COMMAND  :D :

Attach are the results and this is the article Microsoft: https://devblogs.microsoft.com/math-in-office/richeditd2d-window-controls/

I have not enabled the GRAPHY or do other tries ... it was only to test it.

You can see the differences between the two drawings (copy / paste the same characters).

The code to do this is:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---const  EM_SWITCHTOD2D = (WM_USER + 389); // with wparam = lparam = 0 that switches the current window control to D2D. procedure TForm1.Button1Click(Sender: TObject);var i: integer;begin  Label1.Caption:= 'DIRECTWRITE';  i := sendmessage(RichMemo1.Handle, EM_SWITCHTOD2D, 0, 0);  ShowMessage(i.ToString);end; 
To use that the control MUST BE EMPTY and you must click the button before any other action on the control.
After you use the button the control atcs with D2D.

The result from SendMessage should be '1'.
Another thing is that the source of Lazarus must be changed, other way is that like I do: edit the DLL and modify some things inside ...

This is only a TRY.

Navigation

[0] Message Index

[#] Next page

Go to full version