Hello,
In an old game of mine I use a lot of text labels.
A player of this game told me that her eyes aren't what they use to be anymore and she increased the font size so that text messages etc are a bit better to read.
This caused that most things in the game look blown up.
The original method that I used for text size and works fine on Android & IOS is
This is the method that I use now and works fine aswell
for those who don't get the weird math...
the userFontScale values are like this:
small 0.85
normal 1
large 1.15
huge 1.29999
extra huge 1.30000
the (2 - [one of the above values]) give you the up/down scaling multiplier factor
so if the setting is set to extra huge (30% bigger fonts) the calculated size gets multipled by 0.70 (2-1.30) so it shrinks the size by 30%
now that this works fine from small to extra huge font sizes in the devices setting I wonder if this is the most elegant way to do this?
there's no general setting to ignore font scaling?
In an old game of mine I use a lot of text labels.
A player of this game told me that her eyes aren't what they use to be anymore and she increased the font size so that text messages etc are a bit better to read.
This caused that most things in the game look blown up.
The original method that I used for text size and works fine on Android & IOS is
B4X:
'---common---
Dim scale As Double
lv.TextSize=(7.5%y/scale)
This is the method that I use now and works fine aswell
B4X:
'---common---
Dim scale As Double
Dim userFontScale As Float
Dim access As Accessibility
userFontScale=access.GetUserFontScale
lv.TextSize=(7.5%y/scale)*(2-userFontScale)
for those who don't get the weird math...
the userFontScale values are like this:
small 0.85
normal 1
large 1.15
huge 1.29999
extra huge 1.30000
the (2 - [one of the above values]) give you the up/down scaling multiplier factor
so if the setting is set to extra huge (30% bigger fonts) the calculated size gets multipled by 0.70 (2-1.30) so it shrinks the size by 30%
now that this works fine from small to extra huge font sizes in the devices setting I wonder if this is the most elegant way to do this?
there's no general setting to ignore font scaling?