Well, I realized that my problem was dealing with word-wrapped TEXT strings so I wrote a function to calculate how many lines would a string take given a fixed width. In case anyone needs it, here it is:

Code:
int CountLines(STRING* str, FONT* font, var width)
{
	if(str == NULL) return 0;
	if(str_width(str, font) < width)return 1;
	
	var chr = str_chr(str, -str_len(str), 0x20);
	if(chr == 0) 
	{
		chr = str_len(str) - 1;
		while(str_width(str_cut(NULL, str, 0, chr), font) > width)
			chr -= 1;
	}
	
	STRING* rest = str_cut(NULL, str, chr + 1, 0);
	return 1 + CountLines(rest, font, width);
}