Name box font size? [Solved]

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
TerracottaPie
Regular
Posts: 40
Joined: Wed May 15, 2013 4:28 am
Organization: Hikage Studios, Leveretta dev.
Location: Australia
Contact:

Name box font size? [Solved]

#1 Post by TerracottaPie » Fri Apr 24, 2015 11:30 pm

This probably has some incredibly easy fix, but, try as I might I just can't seem to figure it out.

In short, I'm just trying to adjust the font size of the name box text without affecting the rest of the text Ren'Py displays. I can't seem to figure out whether this would be added to screens file or added to each character in the script file, never mind the fact I can't manage to figure out how to separate the font size from text in the dialogue box as opposed to the name box.
Last edited by TerracottaPie on Sat Apr 25, 2015 5:00 am, edited 1 time in total.

User avatar
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Re: Name box font size?

#2 Post by KairuKyun » Sat Apr 25, 2015 1:04 am

Code: Select all

bold True
in Your say screen under this:

Code: Select all

                    text who:
                        id "who"
So A full screen would look like this:

Code: Select all

screen say:

    # Defaults for side_image and two_window
    default side_image = None
    default two_window = False

    # Decide if we want to use the one-window or two-window variant.
    if not two_window:

        # The one window variant.
        window:
            
            #id "window"

            #has vbox:
                #style "say_vbox"

            if who:
                text who id "who"
                bold True

            text what id "what" xoffset 30 yoffset 20 color "#000000" xmaximum 1200 line_spacing 10
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

TerracottaPie
Regular
Posts: 40
Joined: Wed May 15, 2013 4:28 am
Organization: Hikage Studios, Leveretta dev.
Location: Australia
Contact:

Re: Name box font size?

#3 Post by TerracottaPie » Sat Apr 25, 2015 5:00 am

Hey, thanks for the assistance. I got it working based on the code you provided, however, I did have to make a minor correction to prevent it from simply spitting out an error, so I'll post the findings in case anybody else has the same problem.

It would seem that any modifiers applied to the text must be placed on the same line, so "bold True" should be on the same line as the text it's affecting, as so.

Code: Select all

            if who:
                text who id "who" bold True
Given I wanted to adjust the font size, I just swapped "bold True" for "size 40" and it worked like a charm, thanks.

For those using the two window variant, the application is the same.

For anyone interested, here's the complete say screen with the modifications for reference.

Code: Select all

screen say(who, what, side_image=None, two_window=False):

    # Decide if we want to use the one-window or two-window variant.
    if not two_window:

        # The one window variant.
        window:
            id "window"

            has vbox:
                style "say_vbox"

            if who:
                text who id "who" bold False size 40
                

            text what id "what"

    else:

        # The two window variant.
        vbox:
            style "say_two_window_vbox"

            if who:
                window:
                    style "say_who_window"

                    text who:
                        id "who" bold False size 40

            window:
                id "window"

                has vbox:
                    style "say_vbox"

                text what id "what"

    # If there's a side image, display it above the text.
    if side_image:
        add side_image
    else:
        add SideImage() xalign 0.0 yalign 1.0

    # Use the quick menu.
    use quick_menu

As a final note, by default Ren'Py displays any character names in bold, to disable such a feature just use "bold False" in place of "bold True", using "bold True" is unnecessary as it's the default.

It is also possible to modify the text within the dialogue box this way as well, simply by adding the very same arguments to the following section.

Code: Select all

text what id "what"
So if, for whatever reason, you wanted all text to be bold by default, you could do it in your say screen rather than on each character. Naturally I'm sure this could also be done in the options.rpy, but all the same.

Thanks for your help, KairuKyun, I figured it'd be an easy fix that I'd just been overlooking. You led me straight to what I needed.

Post Reply

Who is online

Users browsing this forum: Google [Bot]