It looks kind of messy to fix. Copying the properties from the label to the span is easy in theory, but it looks like there is no easy way to see if the span has had it's font size explicitly set.
And it has existed long enough it might be a compatibility issue.
I originally posted this as comments here: https://github.com/xamarin/Xamarin.Forms/issues/2168 , based on one of the other comments. I now think this is separate to the original issue there.
Description
Setting
FontAttribute
on aSpan
makes the span ignoreFontSize
on the parentLabel
.Steps to Reproduce
Create a label like the following:
Expected Behavior
The bold text has font size 30.
Actual Behavior
The bold text has default font size.
Basic Information
Tested explicitly on
3.1.0.697729
,3.2.0.839982
and3.3.0.840541-pre1
on Android and iOS, but I think it has always been this way.Screenshots
Reproduction Link
https://github.com/GalaxiaGuy/XF-FormattedText-Bug https://github.com/GalaxiaGuy/XF-FormattedText-Bug/archive/master.zip
Copied from my comments on #2168
I assume the problem is to do with font properties sometimes being separate things and sometimes not. Here for instance: https://github.com/xamarin/Xamarin.Forms/blob/bd31e1e9fc8b2f9ad94cc99e0c7ab058174821f3/Xamarin.Forms.Platform.Android/Renderers/FormattedStringExtensions.cs#L63) The Android spannable gets the
Font
of theSpan
, which obviously doesn't consider any properties of theLabel
.It looks kind of messy to fix. Copying the properties from the label to the span is easy in theory, but it looks like there is no easy way to see if the span has had it's font size explicitly set.
And it has existed long enough it might be a compatibility issue.