How to measure custom boxes