Different fonts for each menu screen.

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
XenoStaR
Newbie
Posts: 8
Joined: Fri Jan 19, 2018 4:08 pm
Contact:

Different fonts for each menu screen.

#1 Post by XenoStaR »

Hello,

I am new to the screen side of renpy and in my current project I need to have different fonts on each of the menu's e.g. preferences/about/help ect.. Basically I would like one font for the main menu and then different fonts for the in game menu and any frame pop ups I need.

Ideally I would like a way to do this without going to image maps.

I have looked at the documentation several times but cannot get my head around how to do what I'm trying to. I'm not the most amazing person at understanding coding so please try to keep answers simple.

Thanks!

User avatar
Empish
Veteran
Posts: 221
Joined: Thu Jan 14, 2016 9:52 pm
Projects: Efemural Hearts, It Ends With Graduation
itch: empish
Contact:

Re: Different fonts for each menu screen.

#2 Post by Empish »

You can change a text's font like so:

Code: Select all

text "sometext"
    font "somefont.ttf"
You can also use styles and style prefixes to reduce the amount of typing you need to do.

XenoStaR
Newbie
Posts: 8
Joined: Fri Jan 19, 2018 4:08 pm
Contact:

Re: Different fonts for each menu screen.

#3 Post by XenoStaR »

The problem is I don't understand the style and style prefix and how to set these up, I have looked at the documentation and looked at people who want similar things but nothing helps.

Below is an example of what I want, at the moment the font for these is the interface font and I want it to be another one, please could you be abit more specific or in depth.

Thanks!

Code: Select all

screen mailbox_commands:
    hbox:
        if available_drafts:
            textbutton "Draft New" action Show("contacts")
        else:
            textbutton "Draft New" action None
        if current_message and current_message.reply_label:
            textbutton "Reply" action current_message.reply
        else:
            textbutton "Reply" action None
        if current_message:
            textbutton "Delete" action [current_message.delete, SetScreenVariable("current_message", None)]
        else:
            textbutton "Delete" action None
        if new_message_count() > 0:
            textbutton "Mark All Read" action mark_all_read
        else:
            textbutton "Mark All Read" action None
        textbutton "Restore All" action restore_all
        textbutton "Exit" action Hide("mailbox")

User avatar
Empish
Veteran
Posts: 221
Joined: Thu Jan 14, 2016 9:52 pm
Projects: Efemural Hearts, It Ends With Graduation
itch: empish
Contact:

Re: Different fonts for each menu screen.

#4 Post by Empish »

Code: Select all

style mailbox_button:
	font "somefont.ttf"
And then on your screen:

Code: Select all

screen mailbox_commands:
	style_prefix "mailbox"
	#rest of the screen goes here
That should work, although buttons are a little bit tricky.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Kocker, piinkpuddiin, Semrush [Bot]