package genbook;
import processing.core.*;
public class TextSizerTest extends PApplet {
	PFont f;
	String tex = "Every so often a slow current of air will carry the scent of faraway smoke past and I am minded of Lapsang Souchong tea.";
	int lengthText;
	float boxW = 800;
	float boxH = 200;
	float area;
	public void setup(){
		size(1000,200);
		noFill();
		background(100);
		smooth();
		f = createFont("../data/pdf/lucon.ttf",46);
		noLoop();
	}
	
	public void draw(){
		//wanna fit n squares in a box of x and y. what should be the size of each square
		lengthText = tex.length();
		area = boxW*boxH;
		float fSize=sqrt(area/lengthText);
		println(fSize);
		
		//textMode(MODEL);
		textFont(f, fSize);
		//textLeading(fSize+(lengthText/boxH));
		
		text(tex,0,0,boxW,boxH);
		//rect(fSize,fSize,fSize,fSize);
		rect(0,0,boxW,boxH);
		
	}

}
