If you change the Label.FontSize by a tiny coeficient (eg you multiply it by 0.99d), the very different font size is actually produced on Android when the system is set to use large font size.
This is because:
default font Size of Label is taken from Device.GetNamedSize(NamedSize.Default, (Label)this)
In Android LabelRenderer the font size is updated by calling ToScaledPixel() which returns some predefined constants for named fonts, or the FontSize provided, if the font is not a named one
if you set the FontSize = Device.GetNamedSize(NamedSize.Default, (Label)this) * 0.99f, the font is no longer a named font, and thus in ToScaledPixel(), it returns the FontSize value.
Although the desired font size is almost the same, the larger the system font size is, the bigger is the difference. In my case GetNamedSize(NamedSize.Default, (Label)this) returns 18, but value for the named one is 14
Seems that the issue is in ToScaledPixel() when it returns the FontSize, because FontSize is not supposed to be a scaled pixel, it is a device - independent size, and thus it gets scaled twice
Steps to Reproduce
Set Android to use the largest font possible
Create a Label, do not specify font size
Create a second Label, with FontSize *= 0.99d
Expected Behavior
the label size to be the same (or, to be precise, differ by 0.01dp)
Description
If you change the Label.FontSize by a tiny coeficient (eg you multiply it by 0.99d), the very different font size is actually produced on Android when the system is set to use large font size. This is because:
default font Size of Label is taken from
Device.GetNamedSize(NamedSize.Default, (Label)this)
In Android LabelRenderer the font size is updated by calling ToScaledPixel() which returns some predefined constants for named fonts, or the FontSize provided, if the font is not a named one
if you set the
FontSize = Device.GetNamedSize(NamedSize.Default, (Label)this) * 0.99f
, the font is no longer a named font, and thus in ToScaledPixel(), it returns the FontSize value.Although the desired font size is almost the same, the larger the system font size is, the bigger is the difference. In my case
GetNamedSize(NamedSize.Default, (Label)this)
returns 18, but value for the named one is 14Seems that the issue is in ToScaledPixel() when it returns the FontSize, because FontSize is not supposed to be a scaled pixel, it is a device - independent size, and thus it gets scaled twice
Steps to Reproduce
Expected Behavior
the label size to be the same (or, to be precise, differ by 0.01dp)
Actual Behavior
the Label size is different
Basic Information
Environment
Show/Hide Visual Studio info
``` ```Build Logs
Screenshots
Reproduction Link
Workaround
FontSizeTest.zip