Here's the problem. I want to measure the space available for text on a page.
Imagine a page with floated images etc. that looks like this:
Respecting margins, padding, etc., the lengths of those lines are (approximately): 544, 352, 352, 352, 165, 165, 360, 360, 360, 544, 544.
The challenge: to write a function that returns the maximum possible (i.e. as if the text is justified, not ragged right) lengths of each line of flowed text (not the bounding container) and makes no assumptions about the number or position of objects that it's flowing around. Correctly handle shortened lines due to text-indent.
I have one, but it's s-l-o-w on Internet Explorer and Firefox, adequate in Chrome.
Imagine a page with floated images etc. that looks like this:
Respecting margins, padding, etc., the lengths of those lines are (approximately): 544, 352, 352, 352, 165, 165, 360, 360, 360, 544, 544.
The challenge: to write a function that returns the maximum possible (i.e. as if the text is justified, not ragged right) lengths of each line of flowed text (not the bounding container) and makes no assumptions about the number or position of objects that it's flowing around. Correctly handle shortened lines due to text-indent.
I have one, but it's s-l-o-w on Internet Explorer and Firefox, adequate in Chrome.