New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Label sometimes displays hugely wrong font size and spacing #6801
Comments
verified repro on android 11 with above project. |
I fixed a bug like this a while back, could we check again with RC 3? |
@kristinx0211 could you check again please? |
@jfversluis sure, I can repro it on android 11 and 12 with vs 17.3.0 Preview 2.0 [32511.531.main]. |
OK, so I am looking at this and I see the issue. The initial text is wrong as it is small font, but the FontSize was 35. When the text changes, then it gets the correct size. |
This initial value of Nan (or could be 0) indicates to the layout engine that the size must come from the Label. If we set it here, then there is no way of knowing that the size was not actually set so uses the size. If the size is Nan, it falls back to the "default font size" which is not really default but actually the font size of the label.
* Reduce line length so we can work * Set initial Span.FontSize => double.NaN Fixes #6801 This initial value of Nan (or could be 0) indicates to the layout engine that the size must come from the Label. If we set it here, then there is no way of knowing that the size was not actually set so uses the size. If the size is Nan, it falls back to the "default font size" which is not really default but actually the font size of the label. * Correctly apply span values to spans Fixes #7220 All: - set the default parameter values for line height to be -1 as that is what is the default currently Android: - don't capture the TextView.Paint as that is always wrong initially since none of the other properties are set - don't fall back to the Label.LineHeight to the spans as that is always applied - regardless of span values - pass the Label.CharacterSpacing down to be consistent - pass the Label.TextDecorations down as well - for text decorations, use the platform spans - split a LetterSpacingSpan out of the FontSpan so that they can be individually applied * Update src/Controls/src/Core/Platform/Android/Extensions/FormattedStringExtensions.cs Co-authored-by: campersau <buchholz.bastian@googlemail.com>
Description
As shown in the attached repro sample, "theLabel.FormattedText" is set twice; once after init and then again after 2 seconds.
Even though the Label font size settings is not changed and even though the same FormattedText is used, after 2 seconds the label text changes significantly when it should not. This is a regression (XF did not have this issue) and manifests in many different ways. The repro just shows one such example.
layoutbug8.zip
Steps to Reproduce
Version with bug
Release Candidate 2 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android, I was not able test on other platforms
Affected platform versions
Android 11
Did you find any workaround?
no, and similar strange things happen using different layouts.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: