Douglas,

Thanks *very* much for this.  I had formed the (obviously false)
impression that TextMeasurer had been superseded by LineBreakMeasurer,
and and had proceeded on that basis. This is going to make my layout
much faster.

Ligature re-processing at line breaks was always going to be a problem,
but I can take snapshots of the word at a line break and create a new
TextMeasurer on a variation of the word.

I have a related question about the font applying to these operations
which I will post later, but I may I assume that setting the FONT
attribute in the attributes map will be treated as described in the
documentation on that attribute?

Thanks again.

Peter


> On Tue, 2006-06-20 at 19:14 -0700, douglas felt wrote:
> Not sure if my earlier post ever made it out.
>
> You can use TextMeasurer instead of LineBreakMeasurer in order to do
> custom line break.  TextMeasurer lets you measure the graphical distance
> between two points in the text, or find the offset of the last character
> before a given graphical advance.  It 'knows' about things like
> ligatures and local reorderings in that it will treat all such
> 'clusters' as single units for the purpose of measurement (in
> particular, the first character of the cluster gets all the advance and
> subsequent characters in the cluster have zero advance, so you can
> handle them the same as you would combining marks).  TextMeasurer also
> knows about styles, since it works on AttributedCharacterIterator, and
> so will take into account some other odd things like numeric
> substitution, bidirectional styles, etc.
>
> TextMeasurer and LineBreakMeasurer use GlyphVectors internally.
> GlyphVector is the lowest-level java interface to the layout code
> (OpenType, etc.) and only supports a subset of the styles (those
> directly affecting metrics, i.e. no colors, strikethrough, etc.)  As a
> low-level API it expects that you've dealt with these things at a higher
> level (or know you can ignore them).  This is either 'more power' or
> 'less power' depending on your point of view :-)
>
> Since TextMeasurer lets you make multiple measurements without
> committing to a TextLayout up front, it's  much better suited to
> multipass line-breaking algorithms. There are still issues, of course--
> you can't form/unform ligatures on the fly to fine-tune your
> measurements, for example, you'd have to insert/remove a non-joiner or
> restyle the text, and then remeasure.  But if you're doing full layout
> then you might already be expecting to take a bit of additional time, so
> perhaps that's not an issue.
>
> If you find things that you absolutely can't do with the API, please
> file RFEs.  It always helps to have actual client requests.
>
> Doug

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to