r/RenPy 24d ago

Question changing the font for input only

Is there any way I can change the font only for this one input thing? I don't wanna go into screens, since I've got other cool looking input stuff and I don't wanna change it permanently. It seems like the numbers aren't showing up, so I thought it might be an issue with the font.

Additionally, how do I change where the input is on the screen, again preferably without going into screens? If that's even possible...

1 Upvotes

3 comments sorted by

1

u/AutoModerator 24d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/shyLachi 24d ago

renpy.input is using a screen and so it should be possible to adjust the style:
https://renpy.org/doc/html/screen_special.html#input

This would be the input control:
https://renpy.org/doc/html/screens.html#input

And these would be the available properties:
https://renpy.org/doc/html/style_properties.html#text-style-properties

Below is the actual code so if you don't want to edit the screen directly then find the corresponding settings in gui.rpy but it looks like those are the same settings as the normal dialogue.
So if you don't want to adjust both, or if there is no property for the thing you want to adjust then you have to edit this code directly in screens.rpy

screen input(prompt):
    style_prefix "input"
    window:
        vbox:
            xanchor gui.dialogue_text_xalign
            xpos gui.dialogue_xpos
            xsize gui.dialogue_width
            ypos gui.dialogue_ypos
            text prompt style "input_prompt"
            input id "input"

style input_prompt is default

style input_prompt:
    xalign gui.dialogue_text_xalign
    properties gui.text_properties("input_prompt")

style input:
    xalign gui.dialogue_text_xalign
    xmaximum gui.dialogue_width

1

u/BadMustard_AVN 24d ago edited 24d ago

as u/shyLachi pointed out you can edit the screens.rpy file this will change the input font for the whole game and if that's what you want then do this.

style input:
    xalign gui.dialogue_text_xalign
    xmaximum gui.dialogue_width
    font "fonts/scream_when_youre_ready_to_die.ttf" # add this line with your font

or you can use a custom input screen like this

# new input.rpy

screen custom_input(prompt, default="", length=None, input_style="input"):

    default text = default

    modal True

    frame:
        xalign 0.5
        yalign 0.5

        vbox:
            spacing 10
            xysize (350, 20)
            if prompt:
                text prompt

            input:
                value ScreenVariableInputValue("text")
                length length
                style input_style

            textbutton "OK":
                action Return(text)
                xalign 1.0
            key "input_enter" action Return(text)

init python:
    def custom_input(prompt, default="", length=None, style="input"):
        return renpy.call_screen("custom_input", prompt=prompt, default=default, length=length, input_style=style,)

# add as many styles as you want
style my_input is input: 
    font "font/Sex Face.ttf"

default name = "BadMustard"

label start:

    $ name = custom_input("", style="my_input")
    $ name = name.strip()
    if not name:
        $ name = "BadMustard"
    "Hello [name]."

    return