-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
generic
-
generic
There are lots of places internally in Swing's painting code that uses
JComponent.getFontMetrics() (which in turn uses SwingUtilities2.getFontMetrics())
to determine the bounds of some text. In an environment where the Swing application
is scaled (i.e. a scale factor is applied to the Graphics2D used in paintComponent())
these metrics are incorrect because the aforementioned methods are using an
unscaled FontRenderContext. We need to either use the FRC from the Graphics used
for painting (by calling g.getFontRenderContext() on a scaled Graphics object) or
we need to manually construct an FRC that is scaled according the the current
Swing scale factor (see 6486815).
testcase attached
JComponent.getFontMetrics() (which in turn uses SwingUtilities2.getFontMetrics())
to determine the bounds of some text. In an environment where the Swing application
is scaled (i.e. a scale factor is applied to the Graphics2D used in paintComponent())
these metrics are incorrect because the aforementioned methods are using an
unscaled FontRenderContext. We need to either use the FRC from the Graphics used
for painting (by calling g.getFontRenderContext() on a scaled Graphics object) or
we need to manually construct an FRC that is scaled according the the current
Swing scale factor (see 6486815).
testcase attached
- relates to
-
JDK-6899434 Add affine transform support to JLayer
-
- Closed
-
-
JDK-6486815 RFE: initial Swing support for resolution independence
-
- Closed
-