Re: How to make a multi-line Text3D?
Posted by
basti on
Jul 12, 2023; 10:21am
URL: https://forum.jogamp.org/How-to-make-a-multi-line-Text3D-tp4042759p4042768.html
philjord,
thanks. Glad you like it.
You're right i wanted to make the class independent of J3DGraphics2D or even Canvas3D, which it shouldn't know anything about.
I actually tried using just the String length approach until i realized that i tested it only with "Courier New"
(for which all the characters have the same width). For some reason i was unable to find a good solution for getting the width of a String without a Graphics instance.
The downside of course is, that now the class is dependent on java-1.8 or higher ;)
About the TransformGroup: I think i had an issue with aligning the lines properly after updating a line and for some reason it worked with the TransformGroup.
Initially i tried to set the alignment for each line individually but abandoned that idea. But you're right it should work without the TransformGroup.
If i find the time i work on it some more tonight.
@Sven Gothel
Thank you, i haven't looked into this
I see: left_glyph is set to null on white space characters
Looking at TypecastFont alone, i must say i can't begin to imagine all the work you guys put into this project...
*UPDATE*
@philjord
I implemented a version without the use of TransformGroup and called setPosition(Point3f p) on Text3D directly.
There's a small misalignment after updating the line, which i can't explain. I put it all in a zip file for comparison.
MultiLineText3D_test_without_TransformGroup.zipbest regards,
basti