jason wrote:This is difficult to do: you need to have a "layout engine" which mimic's Word's, like we have in the commercial PDF Converter. One open source approach might be to piggy-back off FOP: convert the line or partial line to XSL FO, then ask FOP for its layout. You might need to hack FOP to do this. Bear in mind that for a proportional font, you can fit "llllll" in similar space to "www", so if your question is "how much of this font can i fit?" you'll need to make assumptions about the distribution of characters.
Dear Jason, I came up with a solution and it is accurate upto 5 decimal places as to location (for my purposes).
I will share with the community even though my solution is not very extensible, unfortunately, right now, I guess.
It only works for the time being for a font of size 9 , calibri and narrow margins.
I have not thought about how I may extend this but this is just a quick work around approach.