Automatically is very hard, cause you need to layout the content, measure and then pick.
Per category is doable though.