Page 1 of 1

BUG with text_overflow.txt triggering on xmaximum

Posted: Sun Feb 02, 2014 7:25 pm
by Keul
Step to reproduce:

Code: Select all

==============================================================================
Mon Feb 03 00:14:48 2014
Windows-7-6.1.7601-SP1
Ren'Py 6.16.5.525
testoverflow2 0.0


File "game/script.rpy", line 14, text overflow:
     Available: (590, 492) Laid-out: (607, 160)
     Text: [u'Je regarde le ciel, il me parait trop haut alors je plonge, non, je crois que je coule. Il n\u2019y a personne, le monde continue de tourner.']

File "game/script.rpy", line 15, text overflow:
     Available: (590, 492) Laid-out: (602, 160)
     Text: [u'Je n\u2019ai pourtant qu\u2019\xe0 ouvrir les yeux pour vivre de nouveau. Mais rien \xe0 faire. Le monde pourrait crever\u2026']
The text should line-break instead of triggering an x-overflow.

Content of the buggy script.rpy file:
init -3 python:
config.debug_text_overflow = True
style.window.left_margin = 0
style.window.right_margin = 0
style.window.left_padding = 105
style.window.right_padding = 105
style.window.xminimum = 800
style.window.xmaximum = 800
style.window.yminimum = 504
style.window.ymaximum = 504
style.default.size = 34
# The game starts here.
label start:
"Je regarde le ciel, il me parait trop haut alors je plonge, non, je crois que je coule. Il n’y a personne, le monde continue de tourner."
"Je n’ai pourtant qu’à ouvrir les yeux pour vivre de nouveau. Mais rien à faire. Le monde pourrait crever…"
return

Re: BUG with text_overflow.txt triggering on xmaximum

Posted: Mon Feb 03, 2014 9:06 pm
by PyTom
This will be fixed in the next 6.17 prerelease.

Re: BUG with text_overflow.txt triggering on xmaximum

Posted: Wed Feb 05, 2014 4:58 pm
by Keul
Thanks!

Re: BUG with text_overflow.txt triggering on xmaximum

Posted: Sat Mar 01, 2014 8:26 pm
by meticulo
I am still running into this issue on the latest build, or maybe I just configured things improperly. I modified the renpy input like this:

Code: Select all

##############################################################################
# Input
#
# Screen that's used to display renpy.input()
# http://www.renpy.org/doc/html/screen_special.html#input

init python:
    def get_input_widget_contents():
        renpy.sound.play("button21.wav")
        return renpy.get_widget("input", "input").content
    def keystrokesound(nothing):
        renpy.sound.play("typewriter.wav")

screen input:

    #text prompt 
         input id "input" area (0.20,0.2,1050,800) layout "greedy" color "#000000" size 58 antialias True changed keystrokesound
         imagebutton idle "Page 4 Button.png" hover "Page 4 Button.png" action get_input_widget_contents xpos 0.75 ypos 0.80

see the attached picture to see the problem

I tried all the layout options but nothing seems to fix it. I also tried xmaximum as well. Any ideas?

Re: BUG with text_overflow.txt triggering on xmaximum

Posted: Sat Mar 01, 2014 9:03 pm
by PyTom
Ren'Py won't insert breaks into text that doesn't contain them. You'll have to add spaces in your text to prevent it from overflowing the box.

Re: BUG with text_overflow.txt triggering on xmaximum

Posted: Sun Mar 02, 2014 6:45 pm
by meticulo
So i created code to insert a whitespace every 23 characters, however, the solution is fairly buggy as it can break a word mid sentence. I need to figure out a way to insert a line space with the user input character is at the x limit and then insert a new line. Any ideas?

Re: BUG with text_overflow.txt triggering on xmaximum

Posted: Sun Mar 02, 2014 11:29 pm
by PyTom
You could insert a U+200B (ZERO WIDTH SPACE) ("\u200b") after every character, and then let Ren'Py figure out where to break things.

Re: BUG with text_overflow.txt triggering on xmaximum

Posted: Mon Mar 03, 2014 12:09 am
by meticulo
How would i add the character successfully on every character stroke? I tried what is below and it did not work.

Code: Select all

init python:

    def keystrokesound(nothing):
        newstr = nothing + '\u200b'
        renpy.sound.play("typewriter.wav")
        return newstr

screen input:
         input id "input" area (0.20,0.2,900,800) color "#000000" size 48 antialias True changed keystrokesound

I also tried this below, which does wrap the text perfectly, however, you see the '\u200b' character on every key stroke:

Code: Select all


def keystrokesound(nothing):
        newstr = ''
        count = 0
        f1=open("bingo.txt", 'w+')
        for i in current:
            newstr = newstr + current[count]
            newstr = newstr + '\u200b'
            count = count + 1
        renpy.get_widget("input", "input").set_text(newstr,True)'''
        renpy.sound.play("typewriter.wav")
        return newstr

screen input:
         input id "input" area (0.20,0.2,900,800) color "#000000" size 48 antialias True changed keystrokesound

I think we are super close to a solution, thank you so much so far!

Re: BUG with text_overflow.txt triggering on xmaximum

Posted: Mon Mar 03, 2014 3:17 am
by meticulo
it appears that the '\u200b' character is always visible, there is no way to hide it right?

Re: BUG with text_overflow.txt triggering on xmaximum

Posted: Mon Mar 03, 2014 6:38 am
by Asceai
newstr = newstr + u'\u200b'