<AWT Dev> Instability of texts in Graphics2D imaging

Herve Girod herve.girod at gmail.com
Wed Mar 14 17:18:58 PDT 2012


I don't know if it's the right place to post this, but in one of our
applications we have a strange problem with texts when drawing Java2D
images. Basically it is an application which draws a Graphics2D image
with a rotation, the rotation quickly changing with time.

There is s strange effect with characters when they rotate: it appears
as if each character "was rotated seperately", there is a small
discrepancy between the various characters of each String (they appear
to lose their alignment during the movement, then they seem to
realign), as if their position were computed separately or at
different times. However, each String is rendered using the standard
drawString method of the Graphics2D class.

First we thought it could have been because of of the rendering hints
we used, but we already used some of them (including antialiasing),
and this effect does  not disappear even after setting various options

The particularity of our use case is that :
- the graphics are updated very quickly,
- we are on Java 6 on a Windows machine (I did not try on Java 7)
- the drawings is in fact performed inside Swing components

My main question is: do I need to check closely our app to hunt for a
problem in our part, or is it possible that this behavior may be
linked to how Java draws Strings?


Herve Girod

More information about the awt-dev mailing list