How to send TextEdit object content into a jit.gl context.

Doug MeatLoaf's icon

Hello.
It seems like something that could be easily achieved.
I would like to display the content of a TextEdit object into a jit.gl context and have the exact same formatting has the text shown int the TexteEdit object window.
Basically, I want to write text in a live situation.

I was not able to achieve this with the jit.gl.text since it does not take in consideration the line jump made by the ENTER key.
Is there an object that could do the trick?
Or does anyone has an idea of a method I could try?
Thanks a lot for your help.

Max Patch
Copy patch and select New From Clipboard in Max.

Rob Ramirez's icon

if you want to simply read in and display a text file, then it is quite easy to do with jit.textfile. read it in and bang it out to jit.gl.text

if you want to display what you are typing live, then it's much more complicated. i've found the best way to do this is to use jit.str.fromsymbol to convert a line of text to a 1D matrix (the dim of the matrix equals the number of characters in the line of text) . you then copy this matrix into a 2D matrix (2nd dim represents the number of lines of text), using dstdimstart / dstdimend. this requires you to know the maximum line length and maximum number of lines you will by typing.

Max Patch
Copy patch and select New From Clipboard in Max.

Doug MeatLoaf's icon

Your method (the second one) works perfectly for my purpose Rob!
Again, thank you very much for your support.
Cheers.