Example #1
0
  /**
   * Checks if the text has more words to print.
   *
   * @param g graphics reference
   * @return true if the text has more words
   */
  private boolean more(final Graphics g) {
    // no more words found; quit
    if (!text.moreWords()) return false;

    // calculate word width
    int ww = 0;
    final int p = text.pos();
    while (text.more()) {
      final int ch = text.next();
      // internal special codes...
      if (ch == 0x02) {
        font(bfont);
      } else if (ch == 0x03) {
        font(dfont);
      } else {
        ww += charW(g, ch);
      }
    }
    text.pos(p);

    // jump to new line
    if (x + ww > w) {
      x = off;
      y += fontH;
    }
    wordW = ww;

    // check if word has been found, and word is still visible
    return y < h;
  }