SkiaStringSizeService and measuring strings in general seems off.
lucapivato opened this issue · 2 comments
Apparently Skia is used in Chrome as well. However, it seems that the measuring of strings in Microsoft.Maui.Graphics.Skia.SkiaStringSizeService incorrectly uses the passed in font size as the height.
In Chrome or Edge
var el = document.createElement("div");
document.body.append(el);
el.innerText = "Hello, Maui.Graphics!"
el.style.fontFamily="Arial"
el.style.fontSize="13px"
el.clientHeight
15
15 is the correct height of the text when setting the font size to 13px for Arial. This value is returned by Chrome and Edge, both apparently using Skia.
I get the same correct value the good old gdi+ and libgdiplus setting the font size to 13 pixels, the height is 15.
But Microsoft.Maui.Graphics.Skia.SkiaStringSizeService always returns the incorrect height simply returning the size.
Is there a settings I'm missing or an additional way to measure a string correctly?
Use libgdiplus. this library is broken and incomplete