You can calculate the font size by approximations but it will still be an iterative approach (although you would probably have to make 3-4 iterations at most).