<Swing Dev> [9] Review request for 8142966 Wrong cursor position in text components on HiDPI display
Phil Race
philip.race at oracle.com
Tue May 31 19:54:33 UTC 2016
This looks reasonable except I am not sure when gc would be null here :-
1062 private static FontRenderContext getFRCProperty(JComponent c) {
1063 if (c != null) {
1064
1065 GraphicsConfiguration gc = c.getGraphicsConfiguration();
1066 AffineTransform tx = (gc == null) ? null :
gc.getDefaultTransform();
if it is only in some case such as where Swing is rendering in headless
mode that should be OK
-phil.
On 05/04/2016 10:42 PM, Alexandr Scherbatiy wrote:
>
> Hello,
>
> Could you review the fix:
> bug: https://bugs.openjdk.java.net/browse/JDK-8142966
> webrev: http://cr.openjdk.java.net/~alexsch/8142966/webrev.02
>
> Swing uses a font rendering context which does not take the graphics
> configuration transform into account.
> This lead to the situation when text size is measured by one font
> rendering context and drawn by another. As the result the calculated
> text size can differ from the drawn text size.
>
> For this issue it means that a cursor position can be farther away
> from the char position.
>
> This is the initial fix where graphics configuration transform is
> included into the Swing font rendering context.
>
> There is one more issue related to the fact that glyph advances are
> calculated in dev space and then transformed to the user space. Char
> width can have fractional value in user space if dev transform is not
> identity.
> It means that Swing should be able to draw a cursor at or select a
> text from a fractional position.
> These issues will be considered in separated fixes.
>
> Thanks,
> Alexandr.
>
More information about the swing-dev
mailing list