when to apply paragraphBottomSpacing
jo last edited by jo
I tried to use
paragraphBottomSpacingand was hoping that drawbot would interpret
\nas still the same paragraph and only apply the extra white space once I use a
So there should only be extra white space after the line 'with new lines' but not after the other newlines.
txt = 'Some Text\nwith new lines\rIs a return\na new line\ror a new paragraph?' fstr = FormattedString(txt, paragraphBottomSpacing=3) newPage(150, 150) text(fstr, (20, 110))
hope that makes sense, thanks
I guess this is a coreText thing. When composing the same text with hard returns and soft returns (shift + enter) in TextEdit, there is no difference between soft and hard returns.
I guess you'll need to script it and change the the bottom spacing for text-runs with soft returns.
jo last edited by
I had some small hope but thanks for testing and clarifying!
not very elegant but kind of working:
txt = 'Some Text\nwith new lines\rIs a return\na new line\ror a new paragraph?' paras = [[l + '\n' for l in p.split('\n')] for p in txt.split('\r')] newPage(150, 150) fstr = FormattedString() for para in paras: for l in para: extra_space = 5 if l == para[-1] else 0 fstr.append(l, paragraphBottomSpacing = extra_space) text(fstr, (20, 110))