charsFitted and linesFitted output paramters values are 0 in case of text fitted in provided area and graphics's PageUnit is Point. The issue is reproducible under linux, but not reproducible under Windows.
Run the following code under linux
var bmp = new Bitmap(200, 50);
using (var graphics = Graphics.FromImage(bmp))
using(var font = new Font("Arial", 10))
{
graphics.PageUnit = GraphicsUnit.Point;
graphics.MeasureString("HELLO", font, new SizeF(float.MaxValue, float.MaxValue),
StringFormat.GenericTypographic, out var chars, out var lines);
Console.WriteLine($"Chars fitted: {chars}");
Console.WriteLine($"Lines fitted: {lines}");
}
Observed: Console output is
Chars fitted: 0
Lines fitted: 0
Expected: Console output is
Chars fitted: 5
Lines fitted: 1
charsFitted and linesFitted output paramters values are 0 in case of text fitted in provided area and graphics's PageUnit is Point. The issue is reproducible under linux, but not reproducible under Windows.
Run the following code under linux
Observed: Console output is Chars fitted: 0 Lines fitted: 0
Expected: Console output is Chars fitted: 5 Lines fitted: 1
Moved from: https://github.com/dotnet/corefx/issues/27312