BUG with text_overflow.txt triggering on xmaximum

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
Keul
Regular
Posts: 49
Joined: Wed May 06, 2009 3:42 am
Location: France - Strasbourg
Contact:

BUG with text_overflow.txt triggering on xmaximum

#1 Post by Keul » Sun Feb 02, 2014 7:25 pm

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

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: BUG with text_overflow.txt triggering on xmaximum

#2 Post by PyTom » Mon Feb 03, 2014 9:06 pm

This will be fixed in the next 6.17 prerelease.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Keul
Regular
Posts: 49
Joined: Wed May 06, 2009 3:42 am
Location: France - Strasbourg
Contact:

Re: BUG with text_overflow.txt triggering on xmaximum

#3 Post by Keul » Wed Feb 05, 2014 4:58 pm

Thanks!

meticulo
Newbie
Posts: 8
Joined: Fri Feb 14, 2014 3:03 pm
Contact:

Re: BUG with text_overflow.txt triggering on xmaximum

#4 Post by meticulo » Sat Mar 01, 2014 8:26 pm

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?
Attachments
Screen Shot 2014-03-01 at 7.17.35 PM.png
here is what happens on a very long string
Screen Shot 2014-03-01 at 7.16.58 PM.png
Here is how it should and normally operates

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: BUG with text_overflow.txt triggering on xmaximum

#5 Post by PyTom » Sat Mar 01, 2014 9:03 pm

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.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

meticulo
Newbie
Posts: 8
Joined: Fri Feb 14, 2014 3:03 pm
Contact:

Re: BUG with text_overflow.txt triggering on xmaximum

#6 Post by meticulo » Sun Mar 02, 2014 6:45 pm

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?

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: BUG with text_overflow.txt triggering on xmaximum

#7 Post by PyTom » Sun Mar 02, 2014 11:29 pm

You could insert a U+200B (ZERO WIDTH SPACE) ("\u200b") after every character, and then let Ren'Py figure out where to break things.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

meticulo
Newbie
Posts: 8
Joined: Fri Feb 14, 2014 3:03 pm
Contact:

Re: BUG with text_overflow.txt triggering on xmaximum

#8 Post by meticulo » Mon Mar 03, 2014 12:09 am

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!

meticulo
Newbie
Posts: 8
Joined: Fri Feb 14, 2014 3:03 pm
Contact:

Re: BUG with text_overflow.txt triggering on xmaximum

#9 Post by meticulo » Mon Mar 03, 2014 3:17 am

it appears that the '\u200b' character is always visible, there is no way to hide it right?
Attachments
Screen Shot 2014-03-03 at 2.07.10 AM.png
\u200b not hidden

User avatar
Asceai
Eileen-Class Veteran
Posts: 1258
Joined: Fri Sep 21, 2007 7:13 am
Projects: a battle engine
Contact:

Re: BUG with text_overflow.txt triggering on xmaximum

#10 Post by Asceai » Mon Mar 03, 2014 6:38 am

newstr = newstr + u'\u200b'

Post Reply

Who is online

Users browsing this forum: No registered users