Skip to content
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

[Android] Incorrect text measurements #4414

Closed
1 of 12 tasks
carldebilly opened this issue Oct 28, 2020 · 2 comments · Fixed by #4448
Closed
1 of 12 tasks

[Android] Incorrect text measurements #4414

carldebilly opened this issue Oct 28, 2020 · 2 comments · Fixed by #4448
Assignees
Labels
kind/bug Something isn't working platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) project/text 🔤 Categorizes an issue or PR as relevant to text (TextBox, PasswordBox, TextBlock, Fonts, …)
Milestone

Comments

@carldebilly
Copy link
Member

carldebilly commented Oct 28, 2020

Incorrect Android's implementation of TextBlock's .Measure()

The layout engine is relying to the desired size of a control to know if this one should be clipped. That means the control should return its actual desiredSize.

This bug has been identified by the automated visual tests on PR #4178.

Current behavior

Take this XAML:

<Border Width="35" Background="LightBlue">
  <TextBlock FontSize="15">This is a very long text, which should take more than 35px horizontally</TextBlock>
</Border>

The correct result to a call to .Measure() should be something like (510, 20), but the current implementation will cap its measurement to availableSize, giving a result like (35, 20) in this case.

Impact of this bug

This bug will prevent the layout from applying clipping when it's required.

Expect result

(for the XAML provided)
image

Current result on Android

(for the XAML provided)
image

Affected platform(s)

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates
@carldebilly carldebilly added kind/bug Something isn't working platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) project/text 🔤 Categorizes an issue or PR as relevant to text (TextBox, PasswordBox, TextBlock, Fonts, …) labels Oct 28, 2020
@robloo
Copy link
Contributor

robloo commented Oct 29, 2020

I discovered another text measurement issue on Android. I have a TextBlock with multi-line content inside a ScrollViewer. All content can be displayed without scrollbars and none are shown. However, horizontally, it is still possible to scroll a small amount left/right causing the text to clip.

Note that if the text is long enough to vertically scroll the same issue still occurs.

Is this the same issue or should I file a new report?

ex

@carldebilly carldebilly modified the milestones: 3.1, 3.2 Oct 29, 2020
@carldebilly
Copy link
Member Author

@robloo That's another problem, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) project/text 🔤 Categorizes an issue or PR as relevant to text (TextBox, PasswordBox, TextBlock, Fonts, …)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants