Preference screen font size change after play-through

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
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Preference screen font size change after play-through

#1 Post by Kinmoku »

Hi all,

I've been trying to adjust my preferences screen depending on which language is active. I thought I'd cracked it, albeit messily, but after you've finished the game and switch the language (from French to English, for example), the font sizes are incorrect. In French, they are smaller than English, so when I go back to the English pref screen after a French play-through, the font is small like in French. I don't understand why it'd be doing this, but here's my code:

Preferences code in screens.rpy:

Code: Select all

screen preferences():

    tag menu

    use navigation_small
    
    add "images/prefs.png" xalign 0.5 yanchor 0 ypos 14
    
    vbox:
        xanchor 0.5
        spacing 30    
        
        if _preferences.language == "french":
            xpos 0.5
            ypos 20
            
        elif _preferences.language == "brazilian":
            xpos 0.475
            ypos 28
            
        else:
            xpos 0.5
            ypos 40

        text _("General Settings"):
            style "titles"
            
            if _preferences.language == "french":
                xpos 480
                
            elif _preferences.language == "brazilian":
                xpos 415

            else:
                xpos 470

        hbox:
            style_group "pref"
            
            if _preferences.language == "brazilian":
                spacing 45
                
            else:
                spacing 55     
            
            text _("Display") ypos 40 xpos 8
            
            button:
                action Preference("display", "window")
                style "mainmenu_choice_button"
                text _("Window") style "mainmenu_choice"
                
            button:
                action Preference("display", "fullscreen")
                style "mainmenu_choice_button"
                text _("Fullscreen") style "mainmenu_choice"
                
            text _("Text") xpos 80 ypos 40

            button:
                xpos 75
                
                action Preference("auto-forward", "toggle")
                style "mainmenu_choice_button"
                text _("Auto-play") style "mainmenu_choice"
                
        hbox:
            style_group "pref"
            spacing 50
            xalign 0.5
            
            text _("Music Volume") ypos 10
            
            bar value Preference("music volume") ypos 12
            
        hbox:
            style_group "pref"
            spacing 50
            xalign 0.5
            
            text _("Sound Volume") ypos 35

            bar value Preference("sound volume") ypos 35
            
        hbox:    
            style_group "pref"
            spacing 53
            xalign 0.5
            ypos 52
            
            vbox:
                text _("Fast-Forward Settings"):
                    style "titles"
                    
                    if _preferences.language == "brazilian":
                        xpos 20
                        
                    else:
                        xpos 200

                hbox:
                    style_group "pref"
                    xalign 0.5
                    ypos 20
                    
                    if _preferences.language == "brazilian":
                        spacing 45
                        
                    else:
                        spacing 55
                    
                    text _("Fast-Forward") ypos 40 xpos 8
                    
                    button:
                        action Preference("skip", "seen")
                        style "mainmenu_choice_button"
                        text _("Seen Text") style "mainmenu_choice"
                        
                    button:
                        action Preference("skip", "all")
                        style "mainmenu_choice_button"
                        text _("All Text") style "mainmenu_choice"
                        
                hbox:
                    style_group "pref"
                    xalign 0.5
                    ypos 48
                    
                    if _preferences.language == "brazilian":
                        spacing 35
                        
                    else:
                        spacing 55
                    
                    text _("After Choices") yalign 0.5 xpos 8
                    
                    button:
                        action Preference("after choices", "stop")
                        style "mainmenu_choice_button"
                        text _("Stop FF") style "mainmenu_choice"
                        
                    button:
                        action Preference("after choices", "skip")
                        style "mainmenu_choice_button"
                        text _("Continue FF") style "mainmenu_choice"

            vbox:
                text _("Progress Settings"):
                    style "titles"
                    
                    if _preferences.language == "brazilian":
                        xpos 130
                
                button:
                    xalign 0.5
                    ypos 85
                    
                    if _preferences.language == "brazilian":
                        xpos 250
                    
                    action Show("reset_popup")
                    style "mainmenu_choice_button"
                    text _("Reset Game") style "mainmenu_choice"
                    
init -2:
    style titles:
        size 60
        line_leading 0
                    
And font adjustments in script.rpy:

Code: Select all

translate None python:
    style.default.font = "IHATCS__.TTF"

translate russian python:
    style.default.font = "neucha.otf"
    
translate french python:
    style.default.size = 38
    style.menu_choice.size = 34
    style.mainmenu_choice.size = 34
    style.mainmenu_choice.line_leading = -8
    style.grey_choice.size = 34
    style.file_picker.size = 24
    style.gallery_ui.size = 24
    style.yesno_label_text.size = 38
    style.titles.size = 46
    style.titles.line_leading = 35
    style.default.font = "Bromine.ttf"
    
translate brazilian python:
    style.default.size = 38
    style.menu_choice.size = 34
    style.mainmenu_choice.size = 34
    style.mainmenu_choice.line_leading = -8
    style.grey_choice.size = 34
    style.file_picker.size = 24
    style.gallery_ui.size = 24
    style.yesno_label_text.size = 38
    style.titles.size = 54
    style.titles.line_leading = 25
    style.default.font = "Bromine.ttf"
So after playing, it stays with the above "translate french python" settings.

My default font settings are in options.rpy and pretty standard:

Code: Select all

    # Fonts

    style.default.size = 44
    style.default.color = "#6c544b"
    style.default.font = "IHATCS__.TTF"
    # etc
Any ideas?

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Preference screen font size change after play-through

#2 Post by kivik »

I'm going to make the guess that since the translate None python: doesn't have any size declarations, that once you switch away from English you'll end up with whatever language's sizes it is.

So try copying and pasting the styles into the None block and set the default English sizes?

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Preference screen font size change after play-through

#3 Post by Kinmoku »

This certainly solves the problem :) I guess I'm just wondering why it wouldn't go back to the default settings from options.rpy. I've just repeated the default for English (None) and Russian, which seems odd to me... But it works, so I'm happy! :lol:

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Preference screen font size change after play-through

#4 Post by kivik »

Perhaps it's worth reporting to PyTom? I'm not familiar with translations so I don't know if it somehow has some persistence thing going on behind the scene?

Post Reply

Who is online

Users browsing this forum: 3N16M4, Google [Bot], MisterPinetree, Ocelot