Page 1 of 1

Stretched text in metafile

Posted: Thu Jun 23, 2011 9:34 am
by 16559497
Hi, there is a problem with how metafiles are used within TeeChart, that will make the text look wrong (stretched, overlapping characters) in some cases. The problem pops up when the application is running on some kind of virtual environment (VirtualBox, Citrix, Terminal services, etc.), where that environment has a screen resolution different from that in the host environment (client PC). The problem is the same in QuickReport, which is based on metafiles. There, the problem has been solved by calling "SetMapMode(FMetafile.Handle, MM_ANISOTROPIC)". I assume that making the same call within TeeChart will solve the problem, but haven't tried. Probably the call should be placed at the end of "Function TCustomTeePanel.TeeCreateMetafile".

For more info on the problem, read/translate the last post here: http://forum.delphi-treff.de/showthread ... zerrt-Text

Regards, Cantor AS

Re: Stretched text in metafile

Posted: Thu Jun 30, 2011 8:35 am
by narcis
Hi Cantor AS,

First of all I'd like to apologise for the delayed reply.

Does this occur in any specific circumstances besides what you explained of virtual environments? Could you arrange a simple example project we can run "as-is" to reproduce the problem here?

Thanks in advance.

Re: Stretched text in metafile

Posted: Thu Jul 07, 2011 2:31 pm
by 16559497
Hi, I don't think there is any way to make the behaviour appear without using some sort of virtualization. Maybe the easiest way to test this is to set up a vurtual machine using VirtualBox. You would need (some time and) a copy of Windows to set it up - I don't know if you have to register Windows if you just want to test this and throw it away. I think also there are trial version of Windows available from Microsoft.

Then, you only need a clean TChart with some text, a button to invoke the a TChartEditor, and use the built in export to metafile. Then you should see how the text looks in QuickReport. I have tested a fix for this today, that seems to work. In TeeCreateMetafile, add the folowing line after the TMetafileCanvas is created:

SetGraphicsMode(tmpCanvas.Handle, GM_ADVANCED);

Regards, Cantor AS

Re: Stretched text in metafile

Posted: Tue Jul 12, 2011 10:24 am
by yeray
Hello Cantor,
Cantor AS wrote:Hi, I don't think there is any way to make the behaviour appear without using some sort of virtualization. Maybe the easiest way to test this is to set up a vurtual machine using VirtualBox. You would need (some time and) a copy of Windows to set it up - I don't know if you have to register Windows if you just want to test this and throw it away. I think also there are trial version of Windows available from Microsoft.

Then, you only need a clean TChart with some text, a button to invoke the a TChartEditor, and use the built in export to metafile. Then you should see how the text looks in QuickReport.
We'd need to know some extra details if we want to try a similar environment to the one where you found the problem. And after reproducing the problem we may be able to generalize trying slightly different environments. So please, tell us in what virtual environment did you find the problem, what Windows version, if it is 32 bit or 64 bit, what IDE was and what TeeChart and QuickReport versions were you using as well.
Cantor AS wrote:I have tested a fix for this today, that seems to work. In TeeCreateMetafile, add the folowing line after the TMetafileCanvas is created:

SetGraphicsMode(tmpCanvas.Handle, GM_ADVANCED);
I'm glad to hear that! :)

Re: Stretched text in metafile

Posted: Tue Jul 12, 2011 1:53 pm
by 16559497
I have seen this on a lot of different environments (VirtualBox, Citrix, MS Terminalserver, MS Virtual PC ++), however, today I discovered a much easier way for you to test this: Remote Desktop. I connected to a machine running Windows 7 Professional 64-bit, from a machine running the same. I set the resolution of the remote desktop very wide to easily see the problem by using the commandline /console /w:1600 /h:800.

The sample application I use to test this is very simple, and contains only one TChart, one TChartEditor, and one TButton. Run the application, push the button to execute the editor, go to Export, select "as Metafile", push Preview, and you should see that the title of the chart, "TChart", doesn't look good. The characters are not spaced correctly, sometimes overlapping. This is also how it looks in QuickReport, and generally whenever charts are saved to metafiles.

I use Delphi XE with all updates and the latest TeeChart (2011.03.30407). QuickReport is not involved in this sample.

Regards, Cantor AS

Re: Stretched text in metafile

Posted: Tue Jul 12, 2011 3:46 pm
by yeray
Hello Cantor,

I could reproduce it with a very width screen (I used the command "mstsc.exe /w:2500 /h:800") so I've added it to the wish list to be investigated in future releases (TV52015656).

Thanks for reporting it.