Example #1
0
  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;
  }
Example #2
0
 public LineInfo(FlowRegions fr, BlockInfo bi, boolean paraStart) {
   this.fr = fr;
   this.bi = bi;
   this.lineHeight = bi.getLineHeight();
   this.ascent = bi.getAscent();
   this.descent = bi.getDescent();
   this.hLeading = (lineHeight - (ascent + descent)) / 2;
   this.baseline = (float) (fr.getCurrentY() + hLeading + ascent);
   this.paraStart = paraStart;
   this.paraEnd = false;
   if (lineHeight > 0) {
     fr.newLineHeight(lineHeight);
     updateRangeInfo();
   }
 }
Example #3
0
 public boolean gotoY(double y) {
   if (fr.gotoY(y)) return true;
   if (lineHeight > 0) updateRangeInfo();
   this.baseline = (float) (fr.getCurrentY() + hLeading + ascent);
   return false;
 }
Example #4
0
 public double getCurrentY() {
   return fr.getCurrentY();
 }