def fit_text(text, font, length, height = 10_000_000)
      size = 100_000
      size_array = [size]
      metrics = Fonts.dimensions_of text, font, size
      size_array << size * length / metrics[0] if metrics[0] > length
      size_array << size * height / metrics[1] if metrics[1] > height
      size_array.min
    end
def fit_text(text, font, length, height = 10_000_000)
      size = 100_000
      size_array = [size]
      metrics = Fonts.dimensions_of text, font, size
      size_array << size * length / metrics[0] if metrics[0] > length
      size_array << size * height / metrics[1] if metrics[1] > height
      size_array.min
    end
this method returns the size for which the text fits the requested metrices
 the size is type Float and is rather exact
 if the text cannot fit such a small place, returns zero (0).
 maximum font size possible is set to 100,000 - which should be big enough for anything
 text:: the text to fit
 font:: the font name. @see font
 length:: the length to fit
 height:: the height to fit (optional - normally length is the issue)