.NET 5 String Measurement

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Brian Kohrs
Newbie
Newbie
Posts: 3
Joined: Fri Jul 12, 2019 12:00 am

.NET 5 String Measurement

Post by Brian Kohrs » Fri Jul 09, 2021 8:14 pm

I am in the process of converting a .NET Framework 4.7.2 application that uses TeeChart 4.1.2012.2283 to .NET 5. The application has two parts, a WinForms designer, and a backend application that generates documents that include chart images generated by TeeChart. The backend application under .NET 5 is not a WinForms application. Both .NET 5 applications are using the Steema.TeeChart.NET 4.2021.6.23 NuGet package.

The string measurement matches between the old application, and the .NET 5 designer application. However, strings are measured differently in the non-WinForms application.

For example, using the following code, I get a size of {Width=41.84027, Height=17.76041} in both WinForms applications. When I run the code in a .NET 5 console application, it comes up with {Width=27.231447, Height=13.2421875}.

var chart = new TChart();
chart.Graphics3D.Font.Name = "Tahoma";
chart.Graphics3D.Font.SizeFloat = 10.0f;
var size = chart.Graphics3D.MeasureString(chart.Graphics3D.Font, "MWgy");
Console.WriteLine(size.ToString());

Is it expected behavior that the two versions (WinForms vs Server) would have different string measurements? If so, is there a ratio that I can use to account for the difference?

Marc
Site Admin
Site Admin
Posts: 1209
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: .NET 5 String Measurement

Post by Marc » Mon Jul 12, 2021 3:12 pm

Thanks for the bug report.

Logged here:
http://bugs.teechart.net/show_bug.cgi?id=2449

SixLabors uses a different MeasureString technique to MS System.Drawing. The problem may not be resolvable but perhaps we can explain it clearly.

Regards,
Marc
Steema Support

Post Reply