if (sprite instanceof TextSprite) {
bbox = getBBoxText((TextSprite) sprite);
} else {
PathSprite realPath = sprite.getPathSprite();
bbox = realPath.dimensions();
}
if (sprite.getRotation() != null || sprite.getScaling() != null || sprite.getTranslation() != null) {
PathSprite transPath = new PathSprite(new RectangleSprite(bbox));
transPath = transPath.map(sprite.transformMatrix());