Certain fonts cause problems for the TMSFNCWXHTMLMemo

Certain fonts cause problems for the TMSFNCWXHTMLMemo.

In the demo program "HTMLMemo Advanced" the result looks correct, when I open it with a standard webbrowser, not all fonts are correct (see picture).

When I open the saved HTML document again in the demo program, the fonts are correct in the demo program, but not in the web browser.

When closing the demo program "HTMLMemo Advanced", it takes several seconds until the program closes.
The demo program "HTMLMemo Standard" closes without noticeable delay.

The ribbon does not look very nice under 4k (150%, 200% tested - see picture (D10.4.2 & D11))

Can you send by email the HTML file itself so we can inspect the tags & other details.

As requested I send two files by email, or also as attachment.

The file "Original_HTMLMemoDemo.html" is a file, which was saved without any changes directly after starting the demo program (different font as result in the web browser).

The file "HTMLMemoDemo.html" is the example mentioned above.

In general, the editor behaves a bit strange, especially when there are still (numeric) bullets involved.

Yesterday I wanted to create a text with numeric bullets and a table. In doing so, I regularly saved the file as an html file and viewed each in the web browser. Well, I did not manage to make the document error free.
So all you need to do is write a text, save it and view the result in the web browser

tms1.zip (11.0 KB)

We have seen the issue when you create a standalone HTML file out of it and we're working on an improvement.
We are working on improvements for the high DPI handling in the FNC ribbon as well.

This sounds good :slight_smile:
Thank you very much.

Could you also find out why the program closes only after several seconds?

When closing the demo program "HTMLMemo Advanced", it takes several seconds until the program closes.
The demo program "HTMLMemo Standard" closes without noticeable delay.

I have also noticed this in connection with the TMSFNCWebBrowser, but I have not been able to find a direct cause (initialization?).

Is this on multiple machines as we can't see this here so far.
What is the OS?

According to the version history, the HTML import function has been improved. I assume that the export function is still being revised. Currently the problem is not fixed yet.

Regarding the delayed exit:
I have tested on four different Dell machines (laptop/PC) and the behavior occurs with all four machines.
The operating system is Win10 Enterprise (20H2) in each case.

  1. Do you TTMSFNCWXHTMLMemo.SaveAsHTMLFile() ?
  2. What do you see when you exit a new created app that just hosts the TWebBrowser (in D10.4 or D11) ? Is there a difference?

Regarding the slow exit: Can you try the following (just for testing purposes)

type
  TTMSFNCHTMLMemoOpen = class(TTMSFNCHTMLMemo);

procedure TForm1.FormCreate(Sender: TObject);
begin
  TTMSFNCHTMLMemoOpen(TMSFNCHTMLMemo1).AutoClearCache := False;
end;

Problem HTML-Export:
The tests I have done on the one hand with the original code of the examples (VCL).
With the "simple" demo
open_close
.

var
  fn: string;
begin
  fn := 'TMSFNCWXHTMLMemoDemo.html';
  if TTMSFNCUtils.SaveFile(fn) then
    TMSFNCWXHTMLMemo1.HTML.SaveToFile(fn);
end;

.
In the example "HTMLMemo Advanced" a text is given.
My procedure:

  • Start program in the IDE
  • Save the text with the button "Save File"
  • Load the text with an external web browser (Edge, Firefox,...)

The content is displayed incorrectly

But also using a stream into a blob field of a MySQL database.
Again the content is wrong.

myBlobStream_Answer := TMemoryStream.Create;
...
htmlFAQ.HTML.SaveToStream(myBlobStream);				   
...
dm.quSave.ParamByName('FAQ').LoadFromStream(myBlobStream, ftBlob);

.

Problem slow exit
I found the cause in the sample project "HTMLMemo Advanced" (VCL Version!)

program Demo;

uses
  Vcl.Forms,
  UDemo in '..\..\Shared Code\Form Unit\HTMLMemo Advanced\UDemo.pas' {Form1},
  UBL in '..\..\Shared Code\Business Logic\HTMLMemo Advanced\UBL.pas';

{$R *.res}begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  **Application.CreateForm(TForm1, Form1);**
  **Application.CreateForm(TForm1, Form1);**
  Application.Run;
end.

.

Is it possible that this property AutoClearCache does not exist in the TTMSFNCWXHTMLMemo
-> Does a FNCHTMLMemo exist at all?

type
TTMSFNCHTMLMemoOpen = class(TTMSFNCHTMLMemo);

procedure TForm1.FormCreate(Sender: TObject);
begin
  TTMSFNCHTMLMemoOpen(TMSFNCHTMLMemo1).AutoClearCache := False;
end;

.
.

I don't know if it has a correlation:
Earlier I installed "TMS Web Core" and since then the TTMSFNCWXHTMLMemo is displayed very delayed. Both in the IDE (dragging new TMSFNCWXHTMLMemo onto the form) and after starting the program. (This also happens when I use the TMSFNCWebBrowser component, )

Delay
edge_chromium

Addendum
.
You can see how it looks from the attachment in post number three (zip file), or in the picture of the first post.

In the answer to the 4th post it was recognized that the output function is faulty - but the input function was corrected ???

We have seen the issue when you create a standalone HTML file out of it and we're working on an improvement.
We are working on improvements for the high DPI handling in the FNC ribbon as well.

The correct code would be

type
TTMSFNCWXHTMLMemoOpen = class(TTMSFNCWXHTMLMemo);

procedure TForm1.FormCreate(Sender: TObject);
begin
  TTMSFNCWXHTMLMemoOpen(TMSFNCWXHTMLMemo1).AutoClearCache := False;
end;

My colleagues will look into the remaning issues as soon as possible.

We added TTMSFNCWXHTMLMemo.SaveAsHTMLFile, but the demos were not updated accordingly.

What you are seeing as different fonts comes from a behavior in Summernote. It does not automatically apply the default selected font to your output HTML, so when you open the result in your browser, all text that are not formatted will be displayed in a default font available.

TTMSFNCWXHTMLMemo.SaveAsHTMLFile will save the output as a whole HTML page with html, head and body tags included + the default selected font applied as font-family. You'll see the difference if you compare the result of TTMSFNCWXHTMLMemo.SaveAsHTMLFile with TTMSFNCWXHTMLMemo.HTML.SaveToFile.

Ok, I have overlooked/misunderstood this.
What is special is that an HTML component does not output HTML-compliant text by default.
As a "user", I assume this.

With this function it works as it should. :slight_smile:
Best thanks for this.

Will there also be a function to write HTML-conform text into a stream?
In relation to databases, this is still important.

TTMSFNCWXHTMLMemo.SaveAsHTMLStream

This is a good suggestion, we'll investigate the possibilities!

Hi,

We added TTMSFNCWXHTMLMemo.SaveAsHTMLStream and TTMSFNCWXHTMLMemo.LoadFromHTMLStream. The next update will contain these new methods.