discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

text() inability to generate newline commands in long text strings

JS
John Sprockets
Fri, Apr 13, 2018 6:59 PM

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

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
TP
Torsten Paul
Fri, Apr 13, 2018 8:20 PM

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.

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.
M
MichaelAtOz
Sat, Apr 14, 2018 5:04 AM

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.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

Sent from: http://forum.openscad.org/

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. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- Sent from: http://forum.openscad.org/
S
Still_learning
Sat, Apr 14, 2018 3:37 PM

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


The more I learn, the more I get curious about.

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 ----- The more I learn, the more I get curious about. -- Sent from: http://forum.openscad.org/
S
Still_learning
Sat, Apr 14, 2018 3:46 PM

Downloaded the zip from github and will see what is up.


The more I learn, the more I get curious about.

Sent from: http://forum.openscad.org/

Downloaded the zip from github and will see what is up. ----- The more I learn, the more I get curious about. -- Sent from: http://forum.openscad.org/