Adjust font size on mobile

Forum to discuss the new web client version of Servoy.

Adjust font size on mobile

Postby dfernandez » Thu Dec 22, 2022 12:20 am

Hi,

I am adapting an existing NG application to also run on mobile.

css positioning is great to put every element in the right place, but is it also possible to adjust the font size when running on mobile? Something like 16px or 20px is fine for a desktop but on mobile is invisible. I am rebuilding some forms and using fonts with 60px size in order to be visible on Safari under iphone.

Is there something like the css positioning to also adjust or change the font size?

Thanks and Happy Holidays to all!!!
dfernandez
 
Posts: 87
Joined: Wed Feb 29, 2012 4:04 pm

Re: Adjust font size on mobile

Postby mboegem » Thu Dec 22, 2022 3:36 pm

On launch of the solution you can check the browseragent.
When you detect a mobile device execute these lines:
Code: Select all
plugins.ngclientutils.setViewportMetaDefaultForMobileAwareSites();
   plugins.ngclientutils.setViewportMetaForMobileAwareSites(plugins.ngclientutils.VIEWPORT_MOBILE_DENY_ZOOM);


Hope that helps.
Last edited by mboegem on Thu Dec 22, 2022 4:58 pm, edited 1 time in total.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Adjust font size on mobile

Postby dfernandez » Thu Dec 22, 2022 4:25 pm

Great! Thank you Mark

Using the first line works great
dfernandez
 
Posts: 87
Joined: Wed Feb 29, 2012 4:04 pm

Re: Adjust font size on mobile

Postby huber » Tue Dec 27, 2022 5:54 pm

Thanks Marc, I am also a user of your tip :-)

I noticed when using this code:

Code: Select all
      if (scopes.svySystem.isIOSPlatform()) {
         plugins.ngclientutils.setViewportMetaDefaultForMobileAwareSites();
         plugins.ngclientutils.setViewportMetaForMobileAwareSites(plugins.ngclientutils.VIEWPORT_MOBILE_DENY_ZOOM);
      }


and connect an iPad to the Servoy Developer (application server), scopes.svySystem.isIOSPlatform() returns false. I was expecting it to return true. I did not yet try with a Tomcat server.

Am I missing something?

Best regards,
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 516
Joined: Mon May 14, 2012 11:31 pm

Re: Adjust font size on mobile

Postby mboegem » Wed Dec 28, 2022 12:28 am

Hi Robert,

Since a couple of years Safari on iPad does not return 'iOS' in the userAgent info by default, forcing it to show the desktop version of websites.
It is still possible to switch to the iOS version by clicking the 'aA' symbol in the address bar and choose 'request mobile website'.

Apart from missing the above info, you're not missing something in Servoy ;-) and this is expected behaviour.

Hope this helps
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Adjust font size on mobile

Postby huber » Thu Dec 29, 2022 11:53 am

Hi Marc

Thanks for the info and hint at the aA menu to request the Mobile Website. If I understand it correctly, any code in a selection like the code snippet above is useless, as the if condition is never true.

Best regards and I wish you a Happy New Year!
Robert
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 516
Joined: Mon May 14, 2012 11:31 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 6 guests