Dimension dim = txt.calculateTextSize();
int imgWidth = (int) (dim.getWidth() + 2 * font_size);
int imgHeight = (int) (dim.getHeight() + 2 * font_size);
SimpleImage imgMap = new SimpleImage(imgWidth, imgHeight);
txt.transformImage(imgMap);
_points = new ArrayList<Point>();
double w2 = (double) imgMap.getImageWidth() / 2.0;
double h2 = (double) imgMap.getImageHeight() / 2.0;
for (int i = 0; i < imgMap.getImageHeight(); i++) {
for (int j = 0; j < imgMap.getImageWidth(); j++) {