[SOLVED] Textbox window location bug when changing fonts

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:

[SOLVED] Textbox window location bug when changing fonts

#1 Post by Kinmoku »

Hi all,

I'm using a clear/ dyslexia friendly font in my game. 99% of the time, the windows display correctly, but I have one character (fan) whose window location changes depending on which font is active. If default, it's fine, but if clear/ dyslexia friendly, it's too low/ partially off the screen. It doesn't do this with other windows, and I can't see any difference (apart from top_padding, which I removed and didn't solve the problem). However, "fan" is the only character to use the graphic window_background="gui speechhuge".

Here is the character (compared to one that works):

Code: Select all

define fan = Character("Hardcore Fan", what_style="emmett_what", window_right_padding=80, window_left_padding=40, window_top_padding=30, window_xpos=1500, window_ypos=500, window_xmaximum=660, window_ymaximum=970, window_background="gui speechhuge")
define bm = Character("Crowd", what_style="emmett_what", window_right_padding=40, window_left_padding=40, window_xpos=1000, window_ypos=880, window_xmaximum=600, window_ymaximum=260, window_background="gui speechbottom")
And here is the code for the font:

Code: Select all

init python:
    gui.init(1920, 1080)

    config.ftfont_scale["DejaVuSans.ttf"] = .78
    config.ftfont_vertical_extent_scale["DejaVuSans.ttf"] = 1.08
My game is already released on Steam, so I'm looking to what I can do to fix it. I don't want to remove the clear font option but I don't understand why switching between fonts changes the window location (ypos) in this one case.

Thank you in advance :)
Last edited by Kinmoku on Fri Sep 08, 2023 5:04 am, edited 1 time in total.

User avatar
timepatches
Regular
Posts: 91
Joined: Sun Aug 14, 2016 1:52 am
Completed: When Aster Falls; Were|House; DemiDato: Monster Dating Show; Grand-Nya
Projects: The Bat-Chelor
Organization: Sad Ghost Studios
Tumblr: sadghoststudios
itch: Sad Ghost Studios
Location: Australia
Contact:

Re: Textbox window location bug when changing fonts

#2 Post by timepatches »

I'm not sure if this is helpful, but I do know that Open Dyslexic has some weird sizing stuff - it has a TON of headroom that is actually built into the font and could be throwing off your measurements. Have you considered swapping to a different font like Atkinson Hyperlegible to see if it's only Open Dyslexic giving you issues?
ImageImage Image

★☆ currently: DEMIDATO RELEASED MARCH 14 \ *°▽°* /
i appreciate honest critique!

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: Textbox window location bug when changing fonts

#3 Post by Kinmoku »

timepatches wrote: Thu Sep 07, 2023 12:35 pm I'm not sure if this is helpful, but I do know that Open Dyslexic has some weird sizing stuff - it has a TON of headroom that is actually built into the font and could be throwing off your measurements. Have you considered swapping to a different font like Atkinson Hyperlegible to see if it's only Open Dyslexic giving you issues?
Yeah, that's what this block is for:

Code: Select all

init python:
    gui.init(1920, 1080)

    config.ftfont_scale["DejaVuSans.ttf"] = .78
    config.ftfont_vertical_extent_scale["DejaVuSans.ttf"] = 1.08
I had to adjust the scale quite a lot! But it doesn't cause issues with any of the other windows in the game, just this one.

The "fan" character has the largest text box in the game (1000px high) so I think it may be something to do with that. I'm going to try making it smaller and see if it helps.

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: Textbox window location bug when changing fonts

#4 Post by Kinmoku »

In case anyone else has this trouble, for some reason it was affected because of a transform applied to the window in the say screen, specifically:

Code: Select all

transform irlbubble_huge:
    xanchor 0.5 yanchor 0.5
I had to change it to:

Code: Select all

transform irlbubble_huge:
    xanchor 0.0 yanchor 0.0
And then manually position it. The height different of the string when switching fonts was shifting it around.

Post Reply

Who is online

Users browsing this forum: barsunduk, Google [Bot], Lacha