Rectangle () { if (myTextBounds == null && myFont != null && myText != null && !myText.isEmpty()) { myContext = createContext(); Font fnt = myFontTransform == null ? myFont : myFont.deriveFont(myFontTransform); myTextBounds = getPixelBounds(fnt, myText, myContext); if (myFontTransform != null) { try { AffineTransform reverseTransform = myFontTransform.createInverse(); myTextBounds = applyTransform(myTextBounds, reverseTransform); } catch (NoninvertibleTransformException e) { LOG.error(e); } } } return myTextBounds; }