I think this might be a better way than trying random sizes. You could also put this into a function...
PFont font;
void setup() {
size(500, 500);
font = loadFont("SourceSansPro-Regular-50.vlw");
}
void draw() {
background(255);
fill(0);
textFont(font);
float fitWidth = mouseX; // use the mouse as the "width"
String text = "Rabbits"; // text we want to write
// calculate the text width at full size (50px in this case)
float baseWidth = textWidth(text);
float targetSize = fitWidth / baseWidth * font.getSize(); // size to fit
textSize(targetSize);
text(text, 0, height * 0.5);
}