Skip to content

TALButton does not display Anymore when setting the font Size #474

@ETSPMeder

Description

@ETSPMeder

Hi,

I am trying to implement accessibility support in my apps to respect the system text settings.
This is just some off-topic information: I use this code to get the multiplier:

function GetFontScale: Single;
{$IF DEFINED(ANDROID)}
  function GetFontSizeMultiplier: Single;
  var
    Configuration: JConfiguration;
  begin
    Configuration := TAndroidHelper.Context.getResources.getConfiguration;
    Result := Configuration.fontScale;
  end;
{$ELSEIF DEFINED(IOS)}
  function GetFontSizeMultiplier: Single;
  var
    App: UIApplication;
    Category: NSString;
  begin
    App := TUIApplication.Wrap(TUIApplication.OCClass.sharedApplication);
    Category := App.preferredContentSizeCategory;

    if Category.isEqualToString(UIContentSizeCategoryExtraSmall) then
      Exit(0.8);
    if Category.isEqualToString(UIContentSizeCategorySmall) then
      Exit(0.9);
    if Category.isEqualToString(UIContentSizeCategoryMedium) then
      Exit(0.95);
    if Category.isEqualToString(UIContentSizeCategoryLarge) then
      Exit(1.0);
    if Category.isEqualToString(UIContentSizeCategoryExtraLarge) then
      Exit(1.1);
    if Category.isEqualToString(UIContentSizeCategoryExtraExtraLarge) then
      Exit(1.2);
    if Category.isEqualToString(UIContentSizeCategoryExtraExtraExtraLarge) then
      Exit(1.3);
    if (Category.rangeOfString(StrToNSStr('Accessibility')).location <> NSNotFound) then
      Exit(1.5);

    Result := 1.0;
  end;
{$ELSE}
  function GetFontSizeMultiplier: Single;
  begin
    Result := 1.0;
  end;
{$ENDIF}
begin
  Result := GetFontSizeMultiplier;
end;

When I change the size of the text settings inside a button or other components, they disappear.
Here is a sample to reproduce the problem.

ALSizingProblem.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions