createLayoutWithBalancedLineLengths ignores line spacing


I am creating a TextLayout using createLayoutWithBalancedLineLengths(). For the AttributedString that is passed to that function I have used setLineSpacing() to set the line spacing that should be greater than the default 0.

It seems that TextLayout is completely igonring the lineSpacing value of the attributed string. Is there any special reason for this or is it just missing?

Is there a better way to create a TextLayout that uses a custom line spacing?




Hmm, looks like it's only used by the CoreText implementation. I'll have a look at how easy it is to support it in the other ones. Which OS are you using?


I use this on Windows. You are right that it works well on OS X.

For Windows, the following modifications seems to work, but I don't know, if that might have influence on other platforms:


In juce_TextLayout.cpp, class TokenList, function createLayout after this line (2 times: line 399 and 420 in latest JUCE)

currentLine->stringRange = Range<int> (lineStartPosition, charPosition);

I have added this line:

currentLine->lineOrigin.y += layout.getNumLines()*text.getLineSpacing();


What do you think?



I've already fixed it for all platforms - grab the latest version..


I can not find that fix in the latest version. Where has this been fixed?

Still the only place where getLineSpacing() is used is in






OK, thanks!

It seems there was some delay until I could see it in Github.