fully justified text ?
I’m looking for a way to display fully justified text (flush left and right) in Max / Jitter.
ideally, I would want to display my text with gl objects (jit.gl.text2D / 3D) , but any solution to display justified text in Max (LCD, jit.lcd, jit.Mgraphic, JSUI, …) would be really helpful.
in fact, I’m very surprised by the lack of solution, documentation & post about it ;
any decent text editor or any software that can produce image containing text can do that very easily.
Programming full text justification in Max would really be a pain ; you’ll need to know the width of each char depending of font style & size, and adjust "tracking" (intra-character spacing) accordingly, to fill a "page" width…
I can’t believe that everybody who needs to display dynamic text in a Max / Jitter installation is content with only left/center/right text aligned…
any thought ?
many thanks in advance…
does anybody have any tips on how to produce fully justified text in Jitter ?
Maybe using Syphon and another external program?
I also thought there was some simple way to do this, but if Mathieu cries for help, this is hopeless for me !
Thanks for the advice, Alersito
but I don’t think that syphon is an option for what I want to do ;
all my text are stored / generated in Max, and I would need to generate several blocks of justified text at once, in real time. Using Syphon + another software would imply sending my raw text via OSC to another software that would render my texts to texture -> send back to max (on several syphon channels ?) …
I’ve checked the list of syphon-enabled softs, I can see only 2 candidates that *may* be able to make justified text : Quartz Composer & Processing
But I would then have to dig into one of these tools to do what I need…
!! that sounds a bit complicated to simply align a couple of words !!
I’m still thinking that there’s something missing in Max/Jitter about text layout… isn’t it ?
or am I missing something obvious that would let me display nice texts in Jitter ?
(and I’m just talking of simply text justification… I dare not even dream of things like that :
A good full justification is a few steps harder than left/right/centered. I did all of these as a CS undergrad, working with monospace text (it was the 80s, so that’s all had on the university terminal pool:-) and getting a reasonable full justification was something not everybody got "right". So l/r/c tends to get implemented by more basic text tools, and justification tends to be in the domain of more "advanced" tools.
It ain’t a rose garden, but might get you through the night. Let me know if I should try to dig up that JScript.
Hi Peter, thanks for replying.
I couldn’t find the thread you’re talking about. but I’m sure your js / patch would be helpful :-) could you post a link, please ?
exploring the new features of Max6, I’ve just discovered that jit.mgraphics has a very useful "text_measure" function, that could be a good starting point as well :
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 436.3ocyTFsSBCCEF95smhlFuDWVKiAy6L9.3cdiZHksiPIasKsEE036tzSY JpyHFCFtoYmy+Om82uU5ywQzY50fkRNibMIJ543nHrkuQz15HZiXcYsvh1nM f0JlCzAAMGr1g8ugd4i.4Bcilbk3FZmtrBU0yVdJuq2cZkSIZ.T4biTT2onV 0HU0fCeU7crakOg1Y7jz28pW45Ly11Mzx8XKD1TTJ41sRsBW4BoZ9TCT5Bpr b+7HY490hQ9U1jjTxs9ewKww9kA+Qvr.pq08fi7IGg7fU7NOFleP3g+goMfv tx.jSX8QlhiVxLFOuvRYGdzLdbxjQC4YLBKKoOJM53iRYCQtvQVwS4+IJofG 1rO+BjVJcIMyMh1ExRKIimS3Yo8ccCO6WBH1uAP7uCPax2zFgyHWSGreGpJl DnVdfZeBW3.n0R0mumFGnu+GYnUuxT1El2.Ag8VPp.qSpDNoVsiK+wocLsPV UAnd21uRZEypADvo894beCj+lOR5OkmhOX5flmh8HOAJ9+DH9gjOgySh116A ic6Lwjr4eeK0FeY9.rTpBk3DoF3dYm+Qw9o8R7q.kxx4OC -----------end_max5_patcher-----------
maybe it would be easier (at least in my case) to render the text with jit.mgraphics and display it as a texture in my gl context..
I’ll give it a try.
Using jit.mgraphics.text_measure() is probably more elegant. It might have better performance, too (jit.gl.text2d and text3d both ate up a lot of CPU).
waking this thread again, as I have the same needs…
Mathieu, did your come up with a satisfying solution ? And if so, would you share it ? :)
In case this is useful to anyone, Max6 has a "bounds" attribute to most jitter object (including jit.text3d) that ease (both man and CPU wise) a little bit the task, compared to jit.findbounds !
But if there exist any ready-made solution, I’d be glad not to re-invent the wheel.
C74 fellows ? Any advice / promise on this topic ?
Forums > Jitter