title: Draw text fitting in some specified Rectangle
body: <p>Using a canvas, I want to draw some short label text (1-2 characters) which fits into some specified rectangle.
  For some other reasons, the scaling I use is such that the dimensions of this recangle are small, i.e. about 1. </p>
  
  <p>The problem I'm facing is to calculate the optimal (as large as possible so that the text still fits) text size to use with <code>Paint.setTextSize</code> prior to drawing the text (which I do using <code>Canva.drawText()</code>).
  For that I can either use the <code>Paint.Fontmetrics</code> object to get some general font dimensions as floats or <code>getTextBounds(String text, int start, int end, Rect bounds)</code> to get the bounding box of the text as an integer rectangle. Due to the scaling I use, the integer bounding box from the latter is to imprecise to calculate the optimal text size for my purpose.</p>
  
  <p>What I would need is some method to get the bounding box of the text with higher precision (i.e. like <code>getStringBounds(String str, Graphics context)</code> in <code>java.awt.FontMetrics</code>), but I found no suitable method.</p>