Using a different font for the navigation 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
User avatar
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Using a different font for the navigation menu

#1 Post by thirstyoctopus » Mon Apr 22, 2019 8:16 am

Hi guys

I've been struggling with this one - I want to make the font for the main menu completely different to the font used in the interface font used within the game, but I cannot figure out how as it seems to be that these need to be one and the same.

So, I declared a new gui font variable in gui.rpy alongside the interface font:

Code: Select all

## The font used for out-of-game text.
define gui.interface_text_font = "Fonts/PoetsenOne-Regular.ttf"

## The font used for the main menu??
define gui.menu_text_font = "Fonts/JandaEverydayCasual.ttf"
I found that in the navigation screen it inherited the interface text gui so I changed it here in the button declarations:

Code: Select all

## The font used by the button.
define gui.button_text_font = gui.interface_text_font

define gui.menu_button_text_font = gui.menu_text_font
This doesn't seem to affect anything.

I'm a little confused about how the GUI and Screen settings work to be honest, as a lot of the time the styles they seem to stipulate inheriting don't seem to exist. For example in screen.rpy there's this line:

Code: Select all

style main_menu_text:
    properties gui.text_properties("main_menu", accent=True)
I don't get what "main_menu" means in terms of the text properties. It doesn't seem to exist as a style only a variable to determine if the user is on the main menu or not. If someone could shed some light on this I would be very grateful as the font I'm using for the name box for example doesn't suit the main menu at all.

Thank you!

User avatar
Matalla
Veteran
Posts: 202
Joined: Wed Mar 06, 2019 6:22 pm
Completed: The Lost Smile
itch: matalla-interactive
Location: Spain
Contact:

Re: Using a different font for the navigation menu

#2 Post by Matalla » Mon Apr 22, 2019 3:00 pm

Most of the time, is better to redefine the styles in the styles definition in the screens.rpy. The definitions in gui.rpy are usually too generic and affect a great number of different elements. Unless you want to make a deep remodelation of the design, it's better to left gui definitions alone, and use them just for reference.

In your case, if I understand you correctly, you want to change the font on the textbuttons used for navigation, so you look for this in screens.rpy

Code: Select all

style navigation_button_text is gui_button_text
That says that the style in those buttons will be the one defined in gui_button_text in gui.rpy. Note that if you change the properties of gui_button_text in gui.rpy, it will change all the buttons that use that definitions, not only the ones for navigation (that's why usually it's not a good idea to change it).
Now, some lines below should be this

Code: Select all

style navigation_button_text:
    properties gui.button_text_properties("navigation_button")
This is more or less the same, but defines a particular kind of buttons with the name "navigation", which are the ones used in this case. Look at the code where the buttons are, there should be a line there like this (it's the same as the "main_menu" you talked about, a prefix):

Code: Select all

style_prefix "navigation"
Well, get back to the style definition. Below you can add whatever properties you want, and those will overwrite the default ones. So in this case, you should add the font you want (and any other change you may want).

Code: Select all

style navigation_button_text:
    properties gui.button_text_properties("navigation_button")
    font "WhateverFont.ttf"
I use imagebuttons, so I never did exactly that, but it should work like in any other style.
Comunidad Ren'Py en español (Discord)
Honest Critique

User avatar
thirstyoctopus
Regular
Posts: 72
Joined: Mon Aug 27, 2018 12:04 pm
Projects: Romance Visual Novel story
Organization: Thirsty Octopus
Contact:

Re: Using a different font for the navigation menu

#3 Post by thirstyoctopus » Mon Apr 22, 2019 7:19 pm

That's perfect, thank you! I was thinking that maybe it'd be something I would need to explicitly state somewhere but wasn't sure.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]