Jump to content
happySuzhou

Supporting iOS Dynamic Type (accessibility font size) in Delphi FMX apps

Recommended Posts

As I advance in age, I'm finding small text size in apps is becoming quite annoying and I'm realizing I should be doing a bit more to improve accessibility features in my own Delphi apps, particularly for iOS.

I've been reading about the Dynamic Type settings in Apple iOS (I have my own device set on a larger text size too).  

I want my own app to show larger text across the whole app if a user has set this up on their device.

But I'm struggling to see how to implement this in a Delphi FMX app.

One solution seems to be to dip into the (brilliant!) Kastri library and pull out TUITraitEnvironment and LTraitCollection and read preferredContentSizeCategory.

Kastri already has functions/properties for accessibility features.

I could then set my main form's layout scale accordingly.

Something like the attached (trying to follow and learn from other functions in Kastri units).

Another alternative might be to change some setting (?) or the plist or something so that FireMonkey automatically adjusts the default font size in my StyleBook(s).

Could anyone advise me?

I must admit I'm finding it really hard to find relevant web pages on Delphi and Dynamic Type without the search engine showing information about RTTI instead of the similarly named Apple iOS feature.

I could add a scale button on the app, of course, but I was hoping to help users like myself who don't like to reach for their reading glasses every time they launch a small font sized app.

 

Also, if there's an obvious cross-platform setting I'm missing, please do point out the obvious!

 

Best wishes and thanks in advance! 

supportinglargertext.txt

Share this post


Link to post

Well, I've just come up with a solution.

 

My problem was that I hadn't noticed there's Large and AccessibilityLarge to contend with.

Using units from Kastri (thank you again!) I've cobbled together something that seems to work.

I don't know if there is official conversion to a scale, but I worked it out by taking screenshots and then resizing the images to work out the percentages.

Hope others find this useful.

(Again, if there's a more obvious solution, please comment!)

roughtextsizetoscaleconverter.txt

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×