I am trying to render text (in various languages) within a fixed size rectangle using drawbot. Following the code in this issue: https://github.com/typemytype/drawbot/issues/218, I am able to draw a rectangle around the rendered text (this is the smaller rectangle in the attached image).
Is there anyway to do this the other way around; given a rectangle (the larger one in the image), fit the text in it? With largest possible width or height, whichever comes first?