I've been messing around with TextLayout for a while now and have
become increasingly annoyed with the semantics of TextLayout in that
it doesn't operate like the rest of the stuff in Java2D.

Graphics2D has the ability to draw everything else I've thrown at it
except a TextLayout. TextLayout for some reason that just escapes me
lives in its own coordinate space and must be translated into place in
order to be drawn. Then you have to translate back to where you were
so you don't screw up the rest of your drawings. My code is full of
stuff like

g2d.translate( textX, textY );

textA.draw( g2d, 0, 0 );

bounds = textA.getBounds();

g2d.translate( -textX, - textY );

g2d.setColor( textBFontColor );

// compute textBX, textBY

g2d.translate( textBX, textBY );

textB.draw( g2d, 0, 0 );

g2d.translate( -textBX, -textBY );


Seems to be a lot of work as opposed to:

g2d.draw( textA, textX, textY );
g2d.setColor( textBFontColor );
g2d.draw( textB, textBX, textBY );


Maybe I'm missing the reason for having TextLayout live off on its
own. The problem becomes more compounded when you want to do hit
testing on characters or draw the carets that would result from the
hit test. Am I missing something, or is this a piece of API that needs
to be 'updated' to be more in line with the rest of Graphics2D.

===========================================================================
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