1

StyledText.setLineSpacing() allows line spacing, where each line (whether wrapped or following a carriage return) is separated from its predecessor.

Is there a way to set paragraph spacing, where wrapped lines sit together normally, but a carriage return inserts extra space?

(I want the final result to look much like this question, but without pressing enter twice between paragraphs.)

I am using both a StyledTextContent and a LineStyleListener. Ideally, I'd like to set paragraph spacing on each paragraph via the LineStyleListener, but I would settle for a document-wide solution...

1 Answer 1

1

I think you're going to have to modify the text itself as you write it to and read it from the StyledText.

Basically, you want to replace a single line feed with a double line feed when you setText, and replace a double line feed with a single line feed when you getText.

You'll also have to write a VerifyKeyListener, that replaces a single line feed with a double line feed.

System.getProperty("line.separator") will be helpful, although your file line feed might not match your system line separator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.