コード例 #1
0
ファイル: INFont.java プロジェクト: Metric/ion2d
  /**
   * Gets the bounding rect for the string based on the font
   *
   * @param string
   * @return Rectangle
   */
  public Rectangle2D getBounds(String string) {
    Rectangle2D rect;

    String[] rows = string.split("\n");

    float height = rows.length * this.size;
    float width = this.longestString(rows) * this.size;

    rect = new Rectangle.Float(0, 0, width, height);

    return rect.getBounds2D();
  }