Responsive font sizes

469 views
Skip to first unread message
Assigned to andrew.f...@gmail.com by taifu...@gmail.com

Dean Artis

unread,
Jun 24, 2016, 5:14:16 PM6/24/16
to MIT App Inventor Forum
Is there any hope - in the near future - that a responsive mode will be added for font sizes? I want to ceate a text game that will look good on all phones regardless of screen density, number of pixels etc. I have no problem waiting a few months for something like this but I don't want to wait forever.

The releae notes at http://appinventor.mit.edu/ai2/ReleaseNotes.html say " Listview update: font sizes scale properly in responsive mode."

Why can't this be added to font sizes for text in labels and buttons?

Does anyone know if this feature is likely to be implemented any time soon for buttons and labels?

TheJupiter732

unread,
Jun 24, 2016, 6:10:11 PM6/24/16
to MIT App Inventor Forum
You can get the screen size and change the font size of buttons depending on the screen size.

Dean Artis

unread,
Jun 24, 2016, 6:40:10 PM6/24/16
to MIT App Inventor Forum
Ummm, how?

TheJupiter732

unread,
Jun 24, 2016, 6:43:35 PM6/24/16
to MIT App Inventor Forum
The component Screen1 (or whatever you named your screen) has width and height.

Every button has fontsize.

So, set fontsize of button to Screen1[width] / 50, for example.

Dean Artis

unread,
Jun 24, 2016, 6:49:28 PM6/24/16
to MIT App Inventor Forum
But a font size is calculated diagonally.

TheJupiter732

unread,
Jun 24, 2016, 6:51:37 PM6/24/16
to MIT App Inventor Forum
Well either i do misunderstand your request, but i dont understand what you mean with
"But a font size is calculated diagonally."

If you try out what i suggested, does it do, what you want?

Dean Artis

unread,
Jun 24, 2016, 7:13:22 PM6/24/16
to MIT App Inventor Forum
It kind of works bu not very well.

Italo

unread,
Jun 24, 2016, 7:43:09 PM6/24/16
to MIT App Inventor Forum
Then use the screen width and height to get a diagonal value and use it to do what TheJupiter732 said.

Dean Artis

unread,
Jun 25, 2016, 1:44:49 AM6/25/16
to MIT App Inventor Forum
It doesn't work like that. You ned to know the screen's physical size too.

Does anyone know the answer to my questions in my first post?

Italo

unread,
Jun 25, 2016, 3:20:25 AM6/25/16
to MIT App Inventor Forum
I know it doesn't work like that. I'm just proposing a workaround, since there's no real solution for what you need.
Probably one of the developers will let you know if that's on the to do list.

TheJupiter732

unread,
Jun 25, 2016, 10:08:23 AM6/25/16
to MIT App Inventor Forum
Physical screen size?
Does your app scale?
Usually a app fills the whole screen.
You seem to do something wrong

Dean Artis

unread,
Jun 25, 2016, 3:31:30 PM6/25/16
to MIT App Inventor Forum
TEXT in labels and buttons does not scale. The SIZE of a button scales in responsive mode.

Say you have a button that is 25% of screen width and 10% of screen height and it has text in it font size 16. The phone resolution that AI2 is optimised for is 320x480. This is the phone you see on the desiner view.

In real life if you have a phone with a resolution of, for example, 1080x1920 the SIZE of the button will scale perfectly. However, the text in it will be tiny as size 16 on the AI2 phone is good but on a higher resolution phone it will be much smaller. This happens because button size is a function of the number of pixels. Font size is calculaed by physical size. Font size 1 is 1/72 of an inch.

Hence, buttons scale up, text does not.

What I want to know from the developers is whether they will implement a feature that will allow font sizes to scale on higher resolution phones. If you program using java there is a feature where you can set font in "dp". My understanding is this allows fonts to scale regardless of screen size as they are pixel density independent.

Can the developers do this in AI2? If it is impossible I would like to know as I can then learn java to make my text games. I would prefer AI2 but I don't want to wait too long for a feature that will never come.

Abraham Getzler

unread,
Jun 25, 2016, 4:26:21 PM6/25/16
to MIT App Inventor Forum
See Boban's Javascript - Webviewer trick in https://groups.google.com/d/msg/mitappinventortest/_b6jmQGNugI/zBOZzuA_BAAJ

Copies attached.

ABG
density.html
ListView2.aia

Dean Artis

unread,
Jun 25, 2016, 4:33:38 PM6/25/16
to MIT App Inventor Forum
This is an offline game I'm developing. I just want to know if there will a true feature rather than workarounds.

Italo

unread,
Jun 25, 2016, 7:08:55 PM6/25/16
to MIT App Inventor Forum
In the case the developers are not working on adding this feature, you can program it yourself and  add it to App Inventor, since it is open source.

Dean Artis

unread,
Jun 25, 2016, 7:14:05 PM6/25/16
to MIT App Inventor Forum
I'd need to learn java to do that. In which case I could just program the whole game in java.

Italo

unread,
Jun 25, 2016, 7:44:43 PM6/25/16
to MIT App Inventor Forum
I guess you got your answer there, then.

Dean Artis

unread,
Jun 26, 2016, 4:55:57 PM6/26/16
to MIT App Inventor Forum
I have not got any answer yet. I would like an AI2 developer to tell me if this feature will be implemented any time soon. I'm sorry if I've come across as rude, that was not my intention.

Dean Artis

unread,
Jun 27, 2016, 4:07:51 PM6/27/16
to MIT App Inventor Forum
Bumping this in the hope a developer sees it and can answer me.

Dean Artis

unread,
Jun 28, 2016, 4:16:23 PM6/28/16
to MIT App Inventor Forum
Daily bump

Ghica

unread,
Jun 29, 2016, 9:38:09 AM6/29/16
to MIT App Inventor Forum
You can bump as many times as you like, but I am not sure that will speed things up.

Yes it is on a list, this problems has come up several times before, and yes, there is a workaround, looking at the screen size you can guess what the font size would be, or using the suggested work-around, for which you do not need an internet connection.

If you would have clicked on the link, you would have seen that Hal Abelson himself has added a comment to that thread, so for sure the problem has the attention of the developers, but everything has a priority...
Cheers, Ghica.

Dean Artis

unread,
Jun 29, 2016, 2:03:28 PM6/29/16
to MIT App Inventor Forum
I did click the link and saw Hal Abelson's comment. However, unless he is a developer - and he does not say he is - his words mean nothing.

Also the trick on that link is for ListView. It is irrelevant now as the problem has been fixed, as I clearly state in my first post.

My problem is with labels and buttons.

Hopefully the developers will sort out font sizes for them.

Italo

unread,
Jun 29, 2016, 2:22:03 PM6/29/16
to mitappinv...@googlegroups.com
If you see this symbol next to the name, it means he/she is part of the App Inventor team (developer).


Ghica

unread,
Jun 29, 2016, 2:30:57 PM6/29/16
to MIT App Inventor Forum
Professor Hal Abelson is the head of the MIT App Inventor group, he started the project. Without him there is no App Inventor.
I think you have no imagination, you could use the trick in the he same way to set the font size for buttons and labels.
Cheers, Ghica.

Dean Artis

unread,
Jun 29, 2016, 2:51:13 PM6/29/16
to MIT App Inventor Forum
Oh. I see. So you can confirm the team is looking at a way of having font sizes scale on any phone regardless of resolution without resorting to tricks?

Dean Artis

unread,
Jun 29, 2016, 2:54:47 PM6/29/16
to MIT App Inventor Forum
I want to use AI2 so I don't need to resort to tricks etc. Imagination has nothing to do with it. All I want to know is if a feature will ever be implemented to allow fonts to scale on any phone. That's all I am asking. This thread is full of workarounds, and while I'm grateful for everyone's suggestions no one is actually answering the question posed. I don't mean to offend anyone or anything, but I just need a simple question answered.

Ghica

unread,
Jun 30, 2016, 4:43:04 AM6/30/16
to MIT App Inventor Forum
Hi Dean,
I admire your tenacity in this matter. There is a list of bugs, but I can never find it, I will ask.
In the meantime, if you want this solved, you will need to prepare a testcase (.aia) with the smallest possible app that shows the problem.
Cheers, Ghica.

Ghica

unread,
Jun 30, 2016, 8:11:16 AM6/30/16
to MIT App Inventor Forum
This is the reply from Hal Abelson:
=========================================================================================
It would be useful for someone to do some experimentation and explore how this might work before we try to build it into App Inventor.   As an approach, see what happens if you set font sizes based on screen size.  But that might not be sufficient, because of density.

Can someone make a concrete suggestion?

Ghica: I did not see this issue filed either.   We can file an issue once there's a clearer idea what to do.

Note:  One of the things that makes this difficult with App Inventor is that in a lot of Android development, the developer specifies separate screen layouts for different size devices.  We do not do that in App Inventor and it would be a large change to switch to that.  But it's worth thinking about.
===================================================================================

Therefore, you can help to solve this issue by contributing some examples.
Cheers, Ghica.


Reply all
Reply to author
Forward
0 new messages