generate an imagemagick text label at a certain font size, then pipe it to identify -size , pull the width out of that and then use the result to calculate the required font size which you then use in a second textlabel
edit - or just generate a large text label to start with, then scale it to whatever is required
edit - or just generate a large text label to start with, then scale it to whatever is required