views:

164

answers:

1

There are thousand articles how to use LineBreakMeasurer to draw multi-line text but there is none about drawing multi-line text taking into account also \n(when you want to force a new line at a specific position in text and not only when the right - or left - margin ends).

The secret seems to lie in BreakIterator, but I couldn't find an implementation which handles \n.

+1  A: 

Tokenize the text first, then just apply the LineBreakMeasureCode to each token.

camickr
This is a possibility, but I would like a solution which uses only LineBreakerMeasurer.
adrian.tarau