現在、境界を決定する必要があるテキスト オブジェクトがあります。グラフィックス オブジェクトを使用して、描画しようとしているテキストのフォント メトリックを取得していましたが、オブジェクトを回転させる機能を追加したため (さらに多くの機能も)、このオブジェクトの境界を取得するためのより良い方法が必要です。私は複数の場所を見てきましたが、まだ何もうまくいきませんでした. これが私の最新の試みです:
//This is the bounding box edges 0: left, 1: right 2: top 3: bottom
int toReturn[] = new int[4];
//this.transform is the AffineTransform for the text Object(currently only
//rotated)
FontRenderContext frc = new FontRenderContext(this.transform,true,false);
TextLayout tl = new TextLayout(this.typedText,this.font,frc);
Rectangle2D bb = tl.getBounds();
toReturn[0] = (int)(bb.getX());
toReturn[1] = (int)(bb.getX()+bb.getWidth());
toReturn[2] = (int)(bb.getY());
toReturn[3] = (int)(bb.getY()+bb.getHeight());
これは、変換されたテキストの境界ボックスを取得する適切な方法ですか?