You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
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?
The text was updated successfully, but these errors were encountered:
Yes we are. I’m planning for a feasible replacement. Ms seems determined to
block usage of libgdiplus at some point. Aspose has a fully managed
system.drawing library but the oem license is unworkable for us.
Another option is to simply take over libgdiplus code for our needs (which
are very modest). The c code is relatively small and well written and easy
to maintain for c/c++ developers. Cairo seems to work well too.
Otherwise I’d have to dig into chromium’s usage of skia to see how it
measures text blocks (with horizontal constraints, etc) since it seems not
to be implemented in skia by itself. But I may be wrong since I haven’t
spent time on this part yet.
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 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?
The text was updated successfully, but these errors were encountered: