Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[Semi-Solved] The Tale of the Dissapearing String(s)

edited March 2014 in Bugs Posts: 182

Hello fellow Codeans,
I, Dalorbi, has discovered (or rediscovered) a bug that has perplexed me for a whole 2 hours,
A bug of which a temporary solution has been conceived but a permanent solution for from achieved.

The problem is: displaying enough text on screen through text() to go off screen causes the text to disappear

The program was:

-- Urls Save Lives

function setup()
    parameter.integer("textsize", 0, 50, 11)
    http.request("", getPageSource)
    source = "Loading..."

function draw()
    background(40, 40, 50)
    fill(255, 255, 255)
    text(source, WIDTH/2, HEIGHT/2)

function getPageSource(data, status, headers)
    source = data

As you can see increasing the size of text size greater than 13 causes it to disappear


The solution Drum Roll
Don't go over the size limit for that piece of text

Jokes Aside, does anyone know how to solve this?


  • dave1707dave1707 Mod
    edited March 2014 Posts: 9,444

    @Dalorbi It's not a bug. It's based on the width of the screen and the font size. On my IPad 1 I can display 2 times more text before it disappears than on my iPad air because of the retina display on the air.

    EDIT:You can use textWrapWidth maybe.

    Here's a response I got from Simeon when I asked the same question.

    @dave1707 it seems to be related to the screen width in landscape mode, and so relates to the maximum texture resolution supported by your device. For example, when you use a smaller font you can see much more before the string disappears. I expect that on your non-retina iPad 1 you can get to double the width before it disappears.

  • Posts: 182

    @dave1707 I had a feeling it wasn't a bug, thanks

  • Posts: 2,820

    use string.sub to split up the string. As for making it easier to display the text, you might try finding line breaks ("/n", incase you didn't know) and splitting up the string between line breaks.
    Hope that helps!

  • Posts: 1,976

    I was getting this problem a long time ago. Using textWrapWidth() fixed it.

Sign In or Register to comment.