I believe I know the cause of this issue, and have a possible fix.
The problem code is the function calculateStringSize in CCImage.mm.
The current code splits the line into separate lines and calculates the height of each line. The individual line heights are then added. The problem is that any empty lines report a height of 0.
Calculating the text height in a single block seems to fix the issue. The following function shows the new code.
<pre>
static CGSizecalculateStringSize(NSString str, id font, CGSizeconstrainSize)
{
CGSize dim = CGSizeZero;
CGSize textRect = CGSizeZero;
textRect.width = constrainSize~~>width > 0 ? constrainSize~~>width
: 0x7fffffff;
textRect.height = constrainSize~~>height > 0 ? constrainSize~~>height
: 0x7fffffff;
dim = [str sizeWithFont:font constrainedToSize:textRect];
return dim;
}
I haven’t found any side effects of this changes yet. Please also note that any trailing empty lines will not be included in the calculated height of the text.