[函數] Firemonkey Android 取得系统参数设定的字型大小

Android 系统参数设定内,可以设定字型大小:

可以透过下面代码来取得字型大小比例:

function FontScale: Single;
var Resources: JResources;
    Configuration: JConfiguration;
begin
     Result := 1;

     if TAndroidHelper.Context <> nil then
     begin
          Resources := TAndroidHelper.Context.getResources;
          if Resources <> nil then
          begin
               Configuration := Resources.getConfiguration;
               if Configuration <> nil then
                  Result := Configuration.fontScale;
          end;
     end;
end;

iOS 请参考:

Delphi 取得 iOS 辅助使用里的字型大小

原文地址:https://www.cnblogs.com/onechen/p/6006392.html