/** {@inheritDoc} */
@Override
public List getNextKnuthElements(LayoutContext context, int alignment) {
MinOptMax ipd;
curArea = get(context);
KnuthSequence seq = new InlineKnuthSequence();
if (curArea == null) {
setFinished(true);
return null;
}
Character fobj = (Character)this.fobj;
ipd = MinOptMax.getInstance(curArea.getIPD());
curArea.setBPD(font.getAscender() - font.getDescender());
TraitSetter.addFontTraits(curArea, font);
curArea.addTrait(Trait.COLOR, fobj.getColor());
// TODO: may need some special handling for fo:character
alignmentContext = new AlignmentContext(font
, font.getFontSize()
, fobj.getAlignmentAdjust()
, fobj.getAlignmentBaseline()
, fobj.getBaselineShift()
, fobj.getDominantBaseline()
, context.getAlignmentContext());
addKnuthElementsForBorderPaddingStart(seq);
// create the AreaInfo object to store the computed values
areaInfo = new AreaInfo((short) 0, ipd, false, alignmentContext);
// node is a fo:Character
if (letterSpaceIPD.isStiff()) {
// constant letter space, only return a box
seq.add(new KnuthInlineBox(areaInfo.ipdArea.getOpt(), areaInfo.alignmentContext,
notifyPos(new LeafPosition(this, 0)), false));
} else {
// adjustable letter space, return a sequence of elements;
// at the moment the character is supposed to have no letter spaces,
// but returning this sequence allows us to change only one element
// if addALetterSpaceTo() is called
seq.add(new KnuthInlineBox(areaInfo.ipdArea.getOpt(), areaInfo.alignmentContext,
notifyPos(new LeafPosition(this, 0)), false));
seq.add(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new LeafPosition(this, -1), true));
seq.add(new KnuthGlue(0, 0, 0,
new LeafPosition(this, -1), true));
seq.add(new KnuthInlineBox(0, null,
notifyPos(new LeafPosition(this, -1)), true));
}
addKnuthElementsForBorderPaddingEnd(seq);