*/
hyphenElements.add
(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new LeafPosition(this, -1), true));
hyphenElements.add
(new KnuthGlue(lineEndBAP, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
new LeafPosition(this, -1), true));
hyphenElements.add
(new KnuthPenalty(hyphIPD,
unflagged ? SOFT_HYPHEN_PENALTY : KnuthPenalty.FLAGGED_PENALTY, !unflagged,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthGlue(-(lineEndBAP + lineStartBAP),
-6 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthInlineBox(0, null,
notifyPos(new LeafPosition(this, -1)), true));
hyphenElements.add
(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new LeafPosition(this, -1), true));
hyphenElements.add
(new KnuthGlue(lineStartBAP, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
new LeafPosition(this, -1), true));
break;
case EN_START : // fall through
case EN_END :
// left- or right-aligned text:
/*
hyphenElements.add
(new KnuthGlue(0, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthPenalty(widthIfBreakOccurs,
KnuthPenalty.FLAGGED_PENALTY, true,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthGlue(widthIfNoBreakOccurs.opt,
- 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
new LeafPosition(this, -1), false));
*/
if (lineStartBAP != 0 || lineEndBAP != 0) {
hyphenElements.add
(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new LeafPosition(this, -1), true));
hyphenElements.add
(new KnuthGlue(lineEndBAP, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthPenalty(widthIfBreakOccurs,
unflagged ? SOFT_HYPHEN_PENALTY : KnuthPenalty.FLAGGED_PENALTY, !unflagged,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthGlue(widthIfNoBreakOccurs.opt - (lineStartBAP + lineEndBAP),
-3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthInlineBox(0, null,
notifyPos(new LeafPosition(this, -1)), false));
hyphenElements.add
(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthGlue(lineStartBAP, 0, 0,
new LeafPosition(this, -1), false));
} else {
hyphenElements.add
(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new LeafPosition(this, -1), true));
hyphenElements.add
(new KnuthGlue(0, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthPenalty(widthIfBreakOccurs,
unflagged ? SOFT_HYPHEN_PENALTY : KnuthPenalty.FLAGGED_PENALTY, !unflagged,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthGlue(widthIfNoBreakOccurs.opt,
-3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0,
new LeafPosition(this, -1), false));
}
break;
default:
// justified text, or last line justified:
// just a flagged penalty
/*
hyphenElements.add
(new KnuthPenalty(widthIfBreakOccurs,
KnuthPenalty.FLAGGED_PENALTY, true,
new LeafPosition(this, -1), false));
*/
if (lineStartBAP != 0 || lineEndBAP != 0) {
hyphenElements.add
(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new LeafPosition(this, -1), true));
hyphenElements.add
(new KnuthGlue(lineEndBAP, 0, 0,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthPenalty(widthIfBreakOccurs,
unflagged ? SOFT_HYPHEN_PENALTY : KnuthPenalty.FLAGGED_PENALTY, !unflagged,
new LeafPosition(this, -1), false));
// extra elements representing a letter space that is suppressed
// if a break occurs
if (widthIfNoBreakOccurs.min != 0
|| widthIfNoBreakOccurs.max != 0) {
hyphenElements.add
(new KnuthGlue(widthIfNoBreakOccurs.opt - (lineStartBAP + lineEndBAP),
widthIfNoBreakOccurs.max - widthIfNoBreakOccurs.opt,
widthIfNoBreakOccurs.opt - widthIfNoBreakOccurs.min,
new LeafPosition(this, -1), false));
} else {
hyphenElements.add
(new KnuthGlue(-(lineStartBAP + lineEndBAP), 0, 0,
new LeafPosition(this, -1), false));
}
hyphenElements.add
(new KnuthInlineBox(0, null,
notifyPos(new LeafPosition(this, -1)), false));
hyphenElements.add
(new KnuthPenalty(0, KnuthElement.INFINITE, false,
new LeafPosition(this, -1), false));
hyphenElements.add
(new KnuthGlue(lineStartBAP, 0, 0,
new LeafPosition(this, -1), false));
} else {
hyphenElements.add
(new KnuthPenalty(widthIfBreakOccurs,
unflagged ? SOFT_HYPHEN_PENALTY : KnuthPenalty.FLAGGED_PENALTY, !unflagged,
new LeafPosition(this, -1), false));
// extra elements representing a letter space that is suppressed
// if a break occurs
if (widthIfNoBreakOccurs.min != 0
|| widthIfNoBreakOccurs.max != 0) {
hyphenElements.add
(new KnuthGlue(widthIfNoBreakOccurs.opt,
widthIfNoBreakOccurs.max - widthIfNoBreakOccurs.opt,
widthIfNoBreakOccurs.opt - widthIfNoBreakOccurs.min,
new LeafPosition(this, -1), false));
}
}