static Pair textLayoutToOutlineAndSize(S text, Font font, Component c) { TextLayout tl = newTextLayout(text, font, c); Rectangle2D r = tl.getBounds(); new AffineTransform tx; tx.translate(0, r.getHeight()); Shape outline = tl.getOutline(tx); ret pair(outline, toRect(r)); }