glitchy text render from matrix using [jit.gl.text2d] ?

Hector MacInnes's icon

Hi everyone, I wonder if some can help with what I'm doing wrong here (if I am doing something wrong).

Below is the basis of a patch I'm starting which will render a few lines of text to a jitter context using jit.gl.text2d.

I want to store the lines of text in a char matrix, rather than as text because later on I'm going to want to use jitter noise to scramble the letters in a variable way.

The big message box at the top contains the lines of text as ASCII integers with a 32 (space) for empty cells, which I have used to fill the matrix.

My problem is that specific integers from the matrix aren't rendering as text. Basically, the last letter from lines 2, 3, 4 and 5 are missing. "memories" becomes "memorie", and "trust" becomes "trus" etc.

The integers are definitely there in the message box at the top, and if you get the integer from the same matrix using getcell then it's there too - e.g. [getcell 17 2] recalls the "y" from the end of "joyful rediscovery", but in jitter it always renders as "joyful rediscover" with the last "y" missing.

Any ideas? Bug?

Many thanks for any help,

Hector.

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

Rob Ramirez's icon

Thanks for the patch and the report. I can reproduce and will investigate.

Hector MacInnes's icon

Thanks Rob! Looking forward to hearing if you come up with anything :) H

Rob Ramirez's icon

for the time being, is there any reason you can't use jit.textfile, or jit.str.* ?

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

Rob Ramirez's icon

It looks like you simply need to use 0 as padding rather than 32. Please let me know if this gets you going, as I don't think we're going to want to change the whitespace trimming logic in jit.gl.text

But do check out the previous patch showing the use of jit.str.fromsymbol, as that seems much easier then dealing with raw ascii.

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

Hector MacInnes's icon

Thanks so much for this Rob, and sorry for the slow reply I've been on other projects. Weirdly, if I download your patch with 0s it works perfectly, but if I copy it over into my patch then [jit.gl.text2d] only renders the first word of each line.

Which makes me think something I've sent to [jit.gl.text2d] has messed things up previously in my patching.

I'll look into that, but in the meantime 0s works if starting from scratch so I'm back up and running.

Many thanks!
H.