Page 1 of 1

[Solved] Say Text Window Has Inconsistent Width

Posted: Tue Oct 16, 2018 6:40 pm
by majike
I seem to have encountered a rather vexing situation. As attachments V1 and V2 show, I have carefully designed the say window for text to be positioned exactly 12 pixels (using integers) from each of the internal borders. However, if there is too much text (as V3 shows), the right side of the text ends up extending almost to the edge of the right border.

V1.png
(8.63 KiB) Not downloaded yet
V2.png
V3.png

I've tried extending window sizes, turning off Justify, adding margins, but nothing I do seems to work and it is starting to leave me really disheartened. Below is what I believe to be the relevant code. If anyone is able to solve this dilemma, I will be eternally grateful. <3

#########################################
## These settings let you customize the window containing the
## dialogue and narration, by replacing it with an image.

## The background of the window. In a Frame, the two numbers
## are the size of the left/right and top/bottom borders,
## respectively.

style.window.background = Frame("transparent.png", 0, 0)

## Margin is space surrounding the window, where the background
## is not drawn.

style.window.left_margin = 0
style.window.right_margin = 0
style.window.top_margin = 0
style.window.bottom_margin = 0

## Padding is space inside the window, where the background is
## drawn.

style.window.left_padding = 0
style.window.right_padding = 0
style.window.top_padding = 0
style.window.bottom_padding = 0

## This is the minimum height of the window, including the margins
## and padding.

style.window.xpos = 0.235
style.window.ypos = 0.136
style.window.xsize = 0.62
style.window.ysize = 0.3
style.window.xminimum = 0.621
style.window.xmaximum = 0.621
style.window.yminimum = 0.3
style.window.ymaximum = 0.3


##############################################################################
# Say
#
# Screen that's used to display adv-mode dialogue.
# http://www.renpy.org/doc/html/screen_special.html#say
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"

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"

window:
id "window"
pos 0.03
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.5 yalign 0.5

# Use the quick menu.
use quick_menu

style nvl_dialogue:
justify True
xpos (0.07)

style say_dialogue:
justify True
xpos (0.07)

Re: Say Text Window Has Inconsistent Width

Posted: Thu Oct 25, 2018 7:23 pm
by majike
Does no-one have any solution? My entire project cannot advance without a solution to this problem. :(

Re: Say Text Window Has Inconsistent Width

Posted: Thu Oct 25, 2018 8:57 pm
by Imperf3kt
What resolution is your game.?

Re: Say Text Window Has Inconsistent Width

Posted: Fri Oct 26, 2018 1:00 am
by majike
Imperf3kt wrote: Thu Oct 25, 2018 8:57 pm What resolution is your game.?
1024x768.

Re: Say Text Window Has Inconsistent Width

Posted: Fri Dec 07, 2018 12:03 am
by majike
Does anyone have any idea how to fix this? I've spent several hours at a time trying to fix it, but no matter what I try, I can't fix this issue. It's really driving me nuts, especially as every other engine I've experimented with just isn't right (TWINE might be okay if it wasn't for its interface and lack of undo functionality, various others require players to download an interpreter [which most wouldn't be bothered to do}, etc.).

Re: Say Text Window Has Inconsistent Width

Posted: Mon Dec 17, 2018 11:22 pm
by majike
I've uploaded a paired-down version of the game that highlights the text width discrepancies, in hopes that it might help someone figure out what is wrong with the coding, as I remain completely lost.

Hopefully, this will help. :|

Re: Say Text Window Has Inconsistent Width

Posted: Tue Dec 18, 2018 2:39 am
by philat
There are a lot of issues in general, but suffice it to say that, as you uploaded, the text window is actually nothing like what you think it is. (Add background Solid("#FFF5") to your window style if you don't believe me and look at where the window is.)

That said:

1. Delete ALL of your window styles in options. (Or comment them out, doesn't matter which.)

2. Use the following window style.

Code: Select all

style window:
    xsize 635
    ysize 420
    xalign 0.0
    yalign 0.0
    xoffset 40
    yoffset 40
    padding (0, 0)
    margin (0, 0)
3. Add min_width 633 to your text style. (The simplest option is to just hardcode it into the screen.)

Code: Select all

            text what id "what":
                min_width 633 # here. this is line 29 in the screens.rpy file you uploaded

Re: Say Text Window Has Inconsistent Width

Posted: Tue Dec 18, 2018 2:03 pm
by majike
philat wrote: Tue Dec 18, 2018 2:39 am There are a lot of issues in general, but suffice it to say that, as you uploaded, the text window is actually nothing like what you think it is. (Add background Solid("#FFF5") to your window style if you don't believe me and look at where the window is.)

That said:

1. Delete ALL of your window styles in options. (Or comment them out, doesn't matter which.)

2. Use the following window style.

Code: Select all

style window:
    xsize 635
    ysize 420
    xalign 0.0
    yalign 0.0
    xoffset 40
    yoffset 40
    padding (0, 0)
    margin (0, 0)
3. Add min_width 633 to your text style. (The simplest option is to just hardcode it into the screen.)

Code: Select all

            text what id "what":
                min_width 633 # here. this is line 29 in the screens.rpy file you uploaded
A thousand thank yous! This problem has been giving me SO much stress for months; no matter how many hours I spent trying to fix it, nothing worked, but this works like a dream!

Thank you SO so much! <3