jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes AttributedCharacterStringIterator and LineBreakMeasurer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "AttributedCharacterStringIterator and LineBreakMeasurer" Watch "AttributedCharacterStringIterator and LineBreakMeasurer" New topic

AttributedCharacterStringIterator and LineBreakMeasurer

John Turtle

Joined: Oct 15, 2010
Posts: 1
I'm playing with some code that will read a text file and then write the text (paragraph) from that text file to a jpeg.

I understand that I need to use LineBreakMeasurer and that it requires (AttributedCharacterStringIterator as a parameter, but I can't wrap my head around how it all works together or what I need to do. I also can't find any very good examples.

Can someone check my understanding? By my reckoning . . .

LineBreakMeasurer requires the interface AttributedCharacterStringIterator because it uses the methods of AttributedCharacterIterator to determine line length, etc. But some of the wording of the methods suggest that AttributedCharacterIterator needs to do some of the work. For instance:

Returns the index of the first character of the run with respect to all attributes containing the current character.

Suggests to me that the "run" is the characters already processed and the "first character of the run" would be the first character in the next line of data to be processed (as opposed to the first character of the string).

Am I over thinking this?

I would greatly appreciate it if someone helped me understand what I need to do to even begin the code.

Thank you.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46397
Don't know, I am afraid, but that question sounds too difficult for "beginning", so I shall move it.

And welcome to the Ranch
I agree. Here's the link: http://aspose.com/file-tools
subject: AttributedCharacterStringIterator and LineBreakMeasurer
It's not a secret anymore!