Or...you could work with a designer whose training and experience it is to make things like this look nice and work well. Instead of trying to have an formula or algorithm for everything, just because that's what you know.
I just get sad for the designers who have to battle this stuff every day. No programmer would take "input" on their code from a nurse (say), but designers face "input" on their decisions and their craft at every turn. I've yet to meet a designer who was longing for a web form to input a bunch of numbers to generate some type sizes.
But I could be wrong. It happens a lot.