public boolean addWord(WordInfo wi) { double nlh = wi.getLineHeight(); if (nlh <= lineHeight) return insertWord(wi); fr.newLineHeight(nlh); if (!updateRangeInfo()) { if (lineHeight > 0) // restore old LH fr.newLineHeight(lineHeight); return false; } if (!insertWord(wi)) { if (lineHeight > 0) // Failure, restore old line Height. setLineHeight(lineHeight); return false; } // Success, word fits on line. lineHeight = nlh; if (wi.getAscent() > ascent) ascent = wi.getAscent(); if (wi.getDescent() > descent) descent = wi.getDescent(); hLeading = (nlh - (ascent + descent)) / 2; baseline = (float) (fr.getCurrentY() + hLeading + ascent); return true; }