Exemplo n.º 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;
  }
Exemplo n.º 2
0
  /**
   * This method updates the line height and recalculates the available flow ranges for the line.
   */
  public boolean setLineHeight(double lh) {
    fr.newLineHeight(lh);

    if (updateRangeInfo()) {
      lineHeight = lh;
      return true;
    }

    // restore line height.
    if (lineHeight > 0) fr.newLineHeight(lineHeight);
    return false;
  }
Exemplo n.º 3
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();
   }
 }