if (_shape.getWordWrap() == TextShape.WrapNone) {
wrappingWidth = _shape.getSheet().getSlideShow().getPageSize().width;
}
TextLayout textLayout = measurer.nextLayout(wrappingWidth + 1,
nextBreak == -1 ? paragraphEnd : nextBreak, true);
if (textLayout == null) {
textLayout = measurer.nextLayout(textWidth,
nextBreak == -1 ? paragraphEnd : nextBreak, false);
}
if(textLayout == null){
logger.log(POILogger.WARN, "Failed to break text into lines: wrappingWidth: "+wrappingWidth+
"; text: " + rt.getText());
measurer.setPosition(rt.getEndIndex());
continue;
}
int endIndex = measurer.getPosition();
float lineHeight = (float)textLayout.getBounds().getHeight();
int linespacing = rt.getLineSpacing();
if(linespacing == 0) linespacing = 100;
TextElement el = new TextElement();
if(linespacing >= 0){
el.ascent = textLayout.getAscent()*linespacing/100;
} else {
el.ascent = -linespacing*Shape.POINT_DPI/Shape.MASTER_DPI;
}
el._align = rt.getAlignment();
el.advance = textLayout.getAdvance();
el._textOffset = textOffset;
el._text = new AttributedString(it, startIndex, endIndex);
el.textStartIndex = startIndex;
el.textEndIndex = endIndex;
if (prStart){
int sp = rt.getSpaceBefore();
float spaceBefore;
if(sp >= 0){
spaceBefore = lineHeight * sp/100;
} else {
spaceBefore = -sp*Shape.POINT_DPI/Shape.MASTER_DPI;
}
el.ascent += spaceBefore;
}
float descent;
if(linespacing >= 0){
descent = (textLayout.getDescent() + textLayout.getLeading())*linespacing/100;
} else {
descent = -linespacing*Shape.POINT_DPI/Shape.MASTER_DPI;
}
if (prStart){
int sp = rt.getSpaceAfter();