Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic 3 application - how to make font size independent of native settings?

I am developing an Ionic 3 application, I recently published it and in production, where phones of all kinds and sizes were used, I noticed that there is an android native setting called "font-size" where you can make the size of texts in your phone bigger or smaller.

Some people (among others many older people) choose 'big' or even 'huge' text size. This unfortunately affects texts in my application on their phones and completely ruins the layout.

The way I am defining font sizes in my css files is with em values, but I also tried px. Do you know if there is any way to prevent my application from adhering to this native android text-size setting? Or any other ways to fix it? Please help, Cheers

like image 689
furry12 Avatar asked Oct 17 '22 07:10

furry12


1 Answers

I found the solution! I used this phonegap plugin:

https://ionicframework.com/docs/v3/native/mobile-accessibility/

and used the method this.mobileAccessibility.usePreferredTextZoom(false);

This way, my app ignores the android font size settings!

like image 80
furry12 Avatar answered Oct 20 '22 22:10

furry12