static Pt centerTextInRect(FontMetrics fm, S s, Rect r) { int tw = fm.stringWidth(s), th = fm.getHeight(); ret pt(r.x + (r.w-tw)/2, r.y + (r.h-th)/2 + fm.getAscent()); }