Hi All,
I see from the archive that there was some discussion in 2015 about coding
in the ability for OpenSCAD users to place line breaks in the text() module.
I am running OpenSCAD version 2017.01.20 on a Windows 7 platform.
A quick look at the MCAD library in my OpenSCAD directory reveals that no
text.scad resides there.
I wish to be able to insert line breaks in long text strings.
Is this now possible?
Do I need a file or library I don't have?
A reply is always appreciated.
Thanks
Still Learning
On 04/13/2018 08:59 PM, John Sprockets wrote:
Is this now possible?
The built-in text() does not support that and it's probably
not going to do that very soon. It's basically another layer
in the text processing stack that is quite a big topic.
I guess the document http://behdad.org/text/ still describes
the current state of the text rendering and right now OpenSCAD
does not support the top-level part which is the layouting.
Note that OpenSCAD does support even scripting languages thanks
to the use of the harfbuzz library. Just looking at newlines is
unlikely to work in the general case unfortunately.
Do I need a file or library I don't have?
I'm not are of any text libraries which help with that, but
there are examples for simple multi-line handling, e.g. in
that reddit post:
https://www.reddit.com/r/openscad/comments/3jwobs/line_feed_in_openscad_text/
ciao,
Torsten.
You would be able to write a module, probably with a recursive function too,
to do that.
By either detecting a /"\n"/ or by number of chars/line.
You would need to calculate a rule of thumb for line advance [for
translate()] from the font size.
If you're fiddling with text() also see
https://github.com/brodykenrick/text_on_OpenSCAD
Admin - PM me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
Sent from: http://forum.openscad.org/
Thanks for the link on reedit Torsten.
That helped.
Like many others, I guess I'm going to have to create multiple lines as
separate objects and merge them, transfer and reuse them via modules.
Still stuck, but Learning
Sent from: http://forum.openscad.org/
Downloaded the zip from github and will see what is up.
Sent from: http://forum.openscad.org/