long minimumChunkWidth = 0;
final int lastPos = Math.min(glyphs.length, offset + length);
for (int i = offset; i < lastPos; i++)
{
final Glyph glyph = glyphs[i];
final Spacing spacing = glyph.getSpacing();
// heightAbove = Math.max(glyph.getBaseLine(), heightAbove);
// heightBelow = Math.max(glyph.getHeight() - glyph.getBaseLine(), heightBelow);
final int kerning = glyph.getKerning();
final int width = glyph.getWidth();
if (glyph.getBreakWeight() <= BreakOpportunityProducer.BREAK_CHAR)
{
// for the layouting, we avoid inner-word breaks
// Later, when we have to force breaks, we may take inner-breaks into
// account.
wordMinChunkWidth += width + spacing.getMinimum() - kerning;
wordMinWidth += width + spacing.getMinimum() - kerning;
wordPrefWidth += width + spacing.getOptimum() - kerning;
wordMaxWidth += width + spacing.getMaximum() - kerning;
}
else
{
wordMinChunkWidth += width + spacing.getMinimum() - kerning;
wordMinWidth += width + spacing.getMinimum() - kerning;
wordPrefWidth += width + spacing.getOptimum() - kerning;
wordMaxWidth += width + spacing.getMaximum() - kerning;
minimumChunkWidth = Math.max(minimumChunkWidth, wordMinChunkWidth);
wordMinWidth = 0;
// Paranoid sanity checks: The word- and linebreaks should have been
// replaced by other definitions in the text factory.
if (glyph.getBreakWeight() == BreakOpportunityProducer.BREAK_LINE)
{
throw new IllegalStateException("A renderable text cannot and must " +
"not contain linebreaks.");
}
}