// if the LineArea has already been added to the area tree,
// call finalize(); otherwise, wait for the LineLM to call it
if (adjustingInfo.bAddedToAreaTree) {
- finalize();
+ finalise();
}
break;
default:
* and destroy the AdjustingInfo object if there are
* no UnresolvedAreas left
*/
- public void finalize() {
+ public void finalise() {
if (adjustingInfo.lineAlignment == Constants.EN_JUSTIFY) {
// justified line: apply the variation factor
boolean bUnresolvedAreasPresent = false;
}
public void addALetterSpace() {
- KnuthBox prevBox = (KnuthBox) removeLast();
+ KnuthBox prevBox = (KnuthBox) getLast();
+ if (prevBox.isAuxiliary()
+ && (size() < 4
+ || !getElement(size()-2).isGlue()
+ || !getElement(size()-3).isPenalty()
+ || !getElement(size()-4).isBox()
+ )
+ ) {
+ // Not the sequence we are expecting
+ return;
+ }
+ removeLast();
LinkedList oldList = new LinkedList();
// if there are two consecutive KnuthBoxes the
// first one does not represent a whole word,