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

Autofit Width Not Respecting Android Font Size OS Setting #108

Open
tpitman opened this issue Aug 22, 2022 · 1 comment
Open

Autofit Width Not Respecting Android Font Size OS Setting #108

tpitman opened this issue Aug 22, 2022 · 1 comment

Comments

@tpitman
Copy link

tpitman commented Aug 22, 2022

Description

Autofit Width works great on iOS and on some Android phones that have a OS font size setting of certain defaults. If you change the OS font size setting the text doesn't size down the font enough to still fit.

Steps to Reproduce

  1. Set a label to autofit = width.
  2. Test this works on iOS and many Android phones with their default setting.
  3. Change the Android OS font size setting to be higher than default.
  4. Notice that the text doesn't fit anymore.

Expected Behavior

Text should auto size to fit the width of the control no matter what the OS font size setting is.

Actual Behavior

Text is not being down sized small enough to fit the control width.

Basic Information

  • Version with issue: 2.4.9
  • Last known good version: ?
  • IDE: Visual Studio 2022
  • Platform Target Frameworks:
    • iOS: 11 and later
    • Android: 5.x and later
  • Affected Devices:

Reproduction Link - a link to a small demo project that reproduces this issue

Any default project will exhibit this behavior. Just change the OS font size to a larger size and it will not automatically fit the width anymore.

Workaround

None

@smalgin
Copy link
Contributor

smalgin commented Aug 23, 2022

Meanwhile... why you should not use auto-fit in the F9P:Label unless you desperately need to.

  1. Autofit, when triggered, causes several successive layout recalculations. It is VERY expensive and can, for example, make your Collection view stutter when scrolling when you have about 10 of auto-fit labels.
  2. It has some layout issues, including (but not limited to) the issue above.

I still use F9P:Label when (1) It is not in a Collection View (2) I need HtmlText rendering.

Based on my journey, I am able to avoid need for a dynamic font size by doing one of the following:
A) For long texts of variable length: Make grid row that contains label to have Auto-height and add ScrollView.
B) For most of static labels: Test on various emulators with different screen dimensions and find the font size that fits. If you are localizing, best of luck to you.
C) For single-line labels of variable length (in a Collection View item grid) - Either make a grid row to have Auto height OR use derived label class that makes text like this: "This is long labe..." with a tooltip that shows entire text. The implementation is not entirely trivial, but it doesn't require entire page to invalidate its layout 3-4 times (maybe even per label? I forgot, it was a while since I last looked into the source.)

The auto-fit is an ingenious solution for a flaw in the system, but it's a hack and as every hack it has its drawbacks. Still, kudos to @baskren for inventing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants