{
// This is a forced linebreak, caused by a \n somewhere at the beginning of the text or after a whitespace.
// If there is a preservable whitespace, the leading margin will be non-zero.
if (leadingMargin > 0)
{
final SpacerRenderNode spacer = new SpacerRenderNode(RenderableText.convert(leadingMargin), 0, true, spaceCount);
words.add(spacer);
}
if (forceLinebreak)
{
final ExtendedBaselineInfo info = getBaselineInfo('\n');
/// TextUtility.createBaselineInfo('\n', fontMetrics, baselineInfo);
final RenderableText text = new RenderableText(layoutContext, elementType, instanceId, attributeMap,
info, DefaultRenderableTextFactory.EMPTY_GLYPHS, 0, 0, lastLanguage, true);
words.add(text);
}
leadingMargin = 0;
spaceCount = 0;
return;
}
//final DefaultGlyph[] glyphs = (DefaultGlyph[]) glyphList.toArray(new DefaultGlyph[glyphList.size()]);
if (leadingMargin > 0)// && words.isEmpty() == false)
{
final SpacerRenderNode spacer = new SpacerRenderNode(RenderableText.convert(leadingMargin), 0, true, spaceCount);
words.add(spacer);
}
// Compute a suitable text-metrics object for this text. We simply assume that the first character is representive
// for all characters of the text chunk. This may be a wrong assumption in complex-text environments but will work