JDK-6925760 : Scaled graphics can cause overlapped LCD mode strings on Windows for pixel size > 48
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows,windows_vista
  • CPU: generic,x86
  • Submitted: 2010-02-11
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u21Fixed 7 b128Fixed
Related Reports
Duplicate :  
Relates :  
Description
A bug in JDK code means that sometimes we store the
user space advance on the glyph image, so when blitting
the glyphs are overlapped. Because we may also subsequently
access this value to retrieve advance, then metrics
may also be incorrect.

It is a specific case of 6685312 which was not covered
in that fix, the scenario being :

- The app is running on Windows
- it is displaying LCD text
- the graphics transform is a scaling transform
- the resulting device text is scaled to > 48 pixels
- getGlyphMetrics() is called before getGlyphAdvance or any rendering.
  I believe GlyphVector and TextLayout are the most usual
  cases where the latter occurs.

The reason behind is as follows. When we use the windows native
rasteriser for LCD glyphs, we also "fix up" the glyph device
advance to be compatible with T2K. This may be an abundance of
caution, but some glyph advances were marginally different.
[[Likely this is due to Windows consulting the hdmx table,
whereas JDK instead consults the rasteriser. We should revisit
this but too, but that's an issue for another day]].

Since advance is returned to the app scaled back to user space
coordinates, we can't store that in the glyph, we need the
device advance. This can be reproduced when
glyphs are > 48 pixels because we then store that in an
advances array without at the same time creating the image,
unless it was also requested.
So when the image is subsequently created it consults that
array which will have user advance, not device advance.

One fix is to make accesses to those advance arrays
- be consistent in storing user advance
- re-apply device transform as needed.

However this is making that code unduly complex for what
for a single caller. I think it may be safer to up front
identify the case when there's a scale and skip looking
or updating the advances arrays.

Comments
EVALUATION As per description
11-02-2010