case EN_CENTER:
// centered text:
// if the second element is chosen as a line break these elements
// add a constant amount of stretch at the end of a line and at the
// beginning of the next one, otherwise they don't add any stretch
elements.add(new KnuthGlue(lineEndBAP, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
auxiliaryPosition, false));
elements.add(makeZeroWidthPenalty(0));
elements.add(new KnuthGlue(p2WidthOffset - (lineStartBAP + lineEndBAP), -6
* LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, pos2, false));
elements.add(makeAuxiliaryZeroWidthBox());
elements.add(makeZeroWidthPenalty(KnuthElement.INFINITE));
elements.add(new KnuthGlue(lineStartBAP + p3WidthOffset,
3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, pos3, false));
break;
case EN_START: // fall through
case EN_END:
// left- or right-aligned text:
// if the second element is chosen as a line break these elements
// add a constant amount of stretch at the end of a line, otherwise
// they don't add any stretch
KnuthGlue g;
if (skipZeroCheck || lineStartBAP != 0 || lineEndBAP != 0) {
g = new KnuthGlue
(lineEndBAP,
3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, auxiliaryPosition, false);
elements.add(g);
elements.add(makeZeroWidthPenalty(0));
g = new KnuthGlue
(p2WidthOffset - (lineStartBAP + lineEndBAP),
-3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, pos2, false);
elements.add(g);
elements.add(makeAuxiliaryZeroWidthBox());
elements.add(makeZeroWidthPenalty(KnuthElement.INFINITE));
g = new KnuthGlue(lineStartBAP + p3WidthOffset, 0, 0, pos3, false);
elements.add(g);
} else {
g = new KnuthGlue
(0,
3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, auxiliaryPosition, false);
elements.add(g);
elements.add(makeZeroWidthPenalty(0));
g = new KnuthGlue
(areaInfo.areaIPD.getOpt(),
-3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, pos2, false);
elements.add(g);
}
break;