(Solved) Trouble Setting Navigation Menu Font

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
SwashbucklerXX
Newbie
Posts: 18
Joined: Tue Sep 03, 2019 6:37 pm
Projects: Made Marion: A Robin Hood Romance
Contact:

(Solved) Trouble Setting Navigation Menu Font

#1 Post by SwashbucklerXX »

Hiya! I'm a newbie coder and am trying to take things a step at a time, modifying the default Renpy UI. I changed the format of the navigation menu to match my text buttons up with my background image, but now I can't seem to set the font on those buttons. I want a different font from the button default, but no matter what I do, the button default font remains.

Here's my code in screens.rpy:

Code: Select all

screen navigation():

    style_prefix "navigation"

    if main_menu:

        textbutton _("Start") xpos 10 ypos 143 action Start()
            
        textbutton _("About") xpos 10 ypos 255 action ShowMenu("about")
            
        textbutton _("Load") xpos 10 ypos 383  action ShowMenu("load")

        textbutton _("Prefs") xpos 10 ypos 506  action ShowMenu("preferences")
            
        textbutton _("Help") xpos 10 ypos 625 action ShowMenu("help")
            
        textbutton _("Quit") xpos 10 ypos 746 action Quit(confirm=not main_menu)

    else:

        textbutton _("History") xpos 10 ypos 143 action ShowMenu("history")

        textbutton _("Save") xpos 10 ypos 265  action ShowMenu("save")

        textbutton _("Load") xpos 10 ypos 383 action ShowMenu("load")

        textbutton _("Prefs") xpos 10 ypos 506 action ShowMenu("preferences")
            
        textbutton _("Main Menu") xpos 10 ypos 625 action MainMenu()
            
        textbutton _("Help") xpos 10 ypos 746 action ShowMenu("help")
            
        textbutton _("Quit") xpos 10 ypos 868 action Quit(confirm=not main_menu)


style navigation_button is gui_button
style navigation_button_text is gui_label_text

style navigation_button:
    size_group "navigation"
    properties gui.button_properties("navigation_button")

style navigation_button_text:
    properties gui.button_text_properties("navigation_button")
In gui.rpy, I have
define gui.label_text_font = "thefontiwant.otf"
define gui.navigation_button_text_font = "thefontiwant.otf"

Trying to cover all my bases. label_text_font is showing the correct font everywhere else I want it working, like on my menu labels and the Return button.
I assume something about the style code is wrong, but I can't figure out what it is. The docs say that I should be able to set specific navigation button properties via define gui.navigation_button, but no matter where I try to put the code to define the navigation button font, it doesn't pick up and just uses the general button default font. Any ideas of what's going wrong for me?
Last edited by SwashbucklerXX on Wed Feb 19, 2020 2:19 am, edited 2 times in total.

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Trouble Setting Navigation Menu Font

#2 Post by gas »

define gui.navigation_button_text_font = "thefontIwant.otf"
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
SwashbucklerXX
Newbie
Posts: 18
Joined: Tue Sep 03, 2019 6:37 pm
Projects: Made Marion: A Robin Hood Romance
Contact:

Re: Trouble Setting Navigation Menu Font

#3 Post by SwashbucklerXX »

Yep, thanks, that was a mis-type in my original question. I have that line in the code. It's not working.

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Trouble Setting Navigation Menu Font

#4 Post by gas »

Try this, then I'm out of any possible solutions (I usually don't use GUI and rewrite the thing from scratch).
define gui.interface_text_font = "whatever.otf"
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
SwashbucklerXX
Newbie
Posts: 18
Joined: Tue Sep 03, 2019 6:37 pm
Projects: Made Marion: A Robin Hood Romance
Contact:

Re: Trouble Setting Navigation Menu Font

#5 Post by SwashbucklerXX »

That'll change the font on a bunch of text I don't want changed, but thanks for replying!

User avatar
SwashbucklerXX
Newbie
Posts: 18
Joined: Tue Sep 03, 2019 6:37 pm
Projects: Made Marion: A Robin Hood Romance
Contact:

Re: Trouble Setting Navigation Menu Font

#6 Post by SwashbucklerXX »

OK, after some experimentation I managed to solve this myself. I had a suspicion that my problem was that the navigation_button style wasn't being applied to my text buttons after I removed the buttons from their original vbox in order to place them manually (I could have kept the vbox and fudged around with padding, but the math was way easier this way). For the curious, I applied the darn style manually to every button like so:

Code: Select all

        
        textbutton _("Start"): 
            style "navigation_button"
            xpos 10 ypos 143 
            action Start()
Is it pretty? No. Does it work? Yes.

Post Reply

Who is online

Users browsing this forum: AWizardWithWords