Page 1 of 1

TTeeCanvas3D Bug and Font Unit

Posted: Wed Jan 07, 2015 12:00 pm
by 17570671
Hi Steema Team,

At first, I wish you a Happy New Year! And thank you for your big work! I use the TTeeCanvas3D and TGDIPlusCanvas on our owner draw TChart’s. But with the last 2014 version I have any problems:

As I can see in the VCL version: You have included in the function TextOut() the new line “OldFont:=GetNewFont(tmpDC,FFont.Size);” and the equivalent DeleteObject(). This is very strange, but you create in the TextOut() function a “private” font based on point units. All other functions such as TextSize() beyond this function work with the old font. I have deleted this strange lines and after I call ReferenceCanvas.Font.Assign(Font) on creation time all function work good as before.

The next problem for TTeeCanvas3D and TGDIPlusCanvas is the question: Why do you use the font unit in points instead of pixels? All other units such as TextHeight, TextWidth and all coordinates are in pixel. I think the better way is the font creation in pixel. This is the device unit, the best resolution and you avoid many problems with DPI recalculation such as in Metafiling and on Printer.

See also the Bug: http://bugs.teechart.net/show_bug.cgi?id=1025

I think, this is a big problem of the future, because the standard 96dpi displays are changed to higher resolutions as 120dpi or over 200dpi (e.g. Retina). Therefore you need a flexible way to scale the fonts and line widths etc.. The standard VCL controls have the procedure ChangeScale(M, D: Integer), which you can override and use for automatic scaling all fonts and other sizes for displays higher 96dpi.
Currently I must change the font height manually in every Chart on hires displays for Titles and Legends etc..

Example: chTaVert.Title.Font.Height:=ScaleDpi(chTaVert.Title.Font.Height);

But this do not work for the default font height (-11), because you use in this case the default font size in 8 or 9 points. And this is automatically scaled on the hires display. I think the correct way is to use -11 as a fix value for the default font height.

Thank you,
Jens Gr.