[Solved] Dialogue font scaling slider in preferences menu?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Another_Tom
Regular
Posts: 61
Joined: Mon Apr 24, 2023 9:06 am
Completed: Harold And The Witches
Projects: Steven On The Run
itch: dantom
Location: Germany
Contact:

[Solved] Dialogue font scaling slider in preferences menu?

#1 Post by Another_Tom »

Hi guys, I don't know if this question has already been asked and I apologize if it has.
I want to be able to increase/decrease the font size of the dialog box with a slider in the Preferences menu, but I have no idea how to do it, since the fontsize is set with "define" and is therefore a constant non-variable.
If you press Shift+A in the game an "Accesibility Menu" appears and there is a corresponding slider to scale the text, I would like to have this option in the Preferences, because it makes much more sense there, imho.

Is this possible? If yes, how do I do that?
Last edited by Another_Tom on Mon Jul 17, 2023 10:38 am, edited 1 time in total.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Dialogue font scaling slider in preferences menu?

#2 Post by _ticlock_ »

Another_Tom wrote: Sat Jun 10, 2023 9:13 am Is this possible? If yes, how do I do that?

Code: Select all

bar value Preference("font size")

Another_Tom
Regular
Posts: 61
Joined: Mon Apr 24, 2023 9:06 am
Completed: Harold And The Witches
Projects: Steven On The Run
itch: dantom
Location: Germany
Contact:

Re: Dialogue font scaling slider in preferences menu?

#3 Post by Another_Tom »

Thank you very much for your reply, _ticlock! I am on vacation this weekend, will test it in the following days and report later. I can't believe it's that simple (Preference("font size")) but am happy if it is!

recreation
Regular
Posts: 52
Joined: Sun Jul 01, 2018 8:32 am
Contact:

Re: Dialogue font scaling slider in preferences menu?

#4 Post by recreation »

It's sadly not that simple if you don't want the whole UI to scale with the font.
A better solution is to make your own slider instead.

Since I was searching for something like that myself a while ago (and it took a lot of googling to find something that simple):
in screens.rpy add:

Code: Select all

default persistent.textsize = 45 #put somewhere at the beginning of the script

	#and this goes into the screen preferences() with all the other bars:
	bar value FieldValue(persistent, "textsize", 31.0, offset=30, style="slider") #higher offset means smaller text, the 31 is is max text size here
in gui.rpy replace the line:

Code: Select all

define gui.text_size = 45 #or whatever the original font size was
with:

Code: Select all

define gui.text_size = persistent.text_size
edit: almost forgot:
you also need to add the variable to the dialogue:
replace:

Code: Select all

text what id "what"
with:

Code: Select all

text what id "what" size persistent.textsize
in: screen say(who, what)
Last edited by recreation on Thu Jun 15, 2023 7:41 am, edited 1 time in total.

Another_Tom
Regular
Posts: 61
Joined: Mon Apr 24, 2023 9:06 am
Completed: Harold And The Witches
Projects: Steven On The Run
itch: dantom
Location: Germany
Contact:

Re: Dialogue font scaling slider in preferences menu?

#5 Post by Another_Tom »

recreation wrote: Mon Jun 12, 2023 5:52 am It's sadly not that simple if you don't want the whole UI to scale with the font.
A better solution is to make your own slider instead.
Thank you very much! That worked and is much better than scaling the whole UI.

Post Reply

Who is online

Users browsing this forum: No registered users