Button: Auto font size

Discussion and feedback on Construct 2

Post » Tue Mar 08, 2016 4:08 pm

Hi all

Just checking if anyone on scirra has a workaround for setting the button font size to a large font and have it scale with the layout size.

- when Auto font size set to "Yes" it overrides the set button font size using CSS to a very small text
- when Auto font size set to "No" button text is larger but it doesn't auto-scale

I have searched in the forums and people are suggesting using sprite fonts and not button text.
This would mean creating more objects for mobile app and I would prefer not to do that.

Does anyone have a workaround?

ManyThanks
B
24
S
8
Posts: 46
Reputation: 1,894

Post » Tue Mar 08, 2016 9:07 pm

You could use a CSS style setting for it at the start of the layout. Also, you can calculate a suitable font size using the expessions Construct 2 provides of the game window size.
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,717

Post » Tue Mar 08, 2016 9:22 pm

Hi Glerkud

That is a nice workaround.
If I understand what you are saying is that I would load multiple CSS for the button font size and active them as needed when the screen size changes.

Man that is a lot of tweaking and testing, I will give it a go.

Thanks

Below is image of my project (personal spelling) that I forget to load
Image
https://www.dropbox.com/s/e6jttro0o9w4p2n/button%20auto%20font%20size.jpg?dl=0
B
24
S
8
Posts: 46
Reputation: 1,894

Post » Wed Mar 09, 2016 8:04 am

I just did a quick capx on this:
https://dl.dropboxusercontent.com/u/166 ... izing.capx

Hope you find it useful.
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,717

Post » Wed Mar 09, 2016 10:55 am

Thanks for capx

That is a genius way in how to resize the font size.

I have chosen to use sprite base buttons with a sprint font attached to them as this would allow me to create none standard button shapes.

Thanks again for the support
B
24
S
8
Posts: 46
Reputation: 1,894

Post » Wed Mar 09, 2016 1:12 pm

No problem :) I'm glad you found it useful.
B
135
S
33
G
17
Posts: 1,557
Reputation: 20,717


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 19 guests