Forums > Jitter

text wrapping

October 24, 2010 | 5:38 pm

Dear all,

Is there an efficient way to enable text wrapping in either jit.lcd or jit.gl.text2d? At the moment, any text entered remains on a single line. The jit.gl.text2d example patch shows a jit.noise object generating random values within defined dimensions, but I’m not sure how to carry that over into a straight text situation.

Also, for ‘write [text]‘ and ‘text [text]‘ messages, are there any symbols for paragraph marks, etc.?

Thanks for reading,



efe
October 24, 2010 | 7:30 pm

I am having the issue of lacking multiple lines with text2d, any idea what can be a solution?


November 28, 2010 | 3:08 am

Hello all,

No answer has been given on this. Is it a tough one to solve, or is the answer too obvious? Either way, if anyone has thoughts, I’m all ears – and still looking for a solution.


November 28, 2010 | 10:59 pm

some moves towards a possible solution:

– Pasted Max Patch, click to expand. –

February 1, 2012 | 9:43 pm

Hi,

I know this is an old post, but I’m wondering if anyone has gone further on this issue.

Thank you.


February 2, 2012 | 8:02 am

I hope this’ll help – look at nov. 30th:

http://cycling74.com/2011/11/11/november-patch-a-day/3/


February 2, 2012 | 3:22 pm

Thank you @Wetterberg.

I’m using Max/MSP 5.1.9, and getting the following error: "js: VerySpecialMessage.js: Javascript ReferenceError: select_font_face is not defined, line 86"

Do I need to install a library, or does this only work with Max/MSP 6 ?


February 3, 2012 | 9:47 pm

If you want to wrap text to keep lines at or under a certain number of characters, and you want to be sure to break the line at a white space, here’s a pretty simple algorithm. As you type (or as you scan through some text you want to display), keep track of the index of the most recent white space character (we’ll call that index "lastspace"). When you get to the last character of the line, if the current character is a white space you can simply break there, but if the current character is not a white space then write only characters 0 through lastspace, go to a new line, and start the new line with characters lastspace+1 onward.

I’m attaching a JavaScript object I wrote a while back, and an example patch. It’s a little different from just wrapping and displaying text. It simulates typing. I hope it proves to be of some use to you.


February 3, 2012 | 10:30 pm

maybe this is also interesting for you http://cycling74.com/forums/topic.php?id=36494
there’s some text wrapping and even rewrapping going on..


February 4, 2012 | 9:43 am

Thank you @Dobrian & @11olsen. I’ll look into those solutions and see what fits.


Viewing 10 posts - 1 through 10 (of 10 total)