Alcinoe icon indicating copy to clipboard operation
Alcinoe copied to clipboard

TALButton does not display Anymore when setting the font Size

Open ETSPMeder opened this issue 1 month ago • 3 comments

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

ETSPMeder avatar Dec 03 '25 15:12 ETSPMeder

@ETSPMeder I just try your demo, it's because you didn't activate the Skia on windows. Skia is mandatory on windows (but optional on ios/android). This is because on android/ios we use the OS graphic engine and on windows we use the skia graphic engine

Zeus64 avatar Dec 04 '25 04:12 Zeus64

Do you mean Adding this to the project.dpr? GlobalUseSkia := True;

I Added this, but it does not change anything or do I need to change other things?

ETSPMeder avatar Dec 04 '25 08:12 ETSPMeder

not really, i mean this:

Image

this will add the GlobalUseSkia := True to the project option and will also add the SKIA define to the project

Zeus64 avatar Dec 04 '25 10:12 Zeus64