On 05/02/16 23:39, Phil Race wrote:
Two things strike me when I read this

1) Initial surprise at how deep into the font code it goes.
Perhaps there are alternatives.

2) That it changes to using the linear metrics for measuring advance.
Regardless of (1) I do not think (2) is correct. I am fairly sure this
will lead to changes in text advance. It seems like it must throw
away adjusted metrics as a result of glyph hinting.

I don't know what the fix should be, since I have not looked at the
problem top-down, I am just seeing the bottom-up proposed solution.
So all I can say for now is that it needs to be at least somewhat different.

There was the same issue on Mac OS X which has been fixed in the similar way: 8013569 [macosx] JLabel preferred size incorrect on retina displays with non-default font size
    https://bugs.openjdk.java.net/browse/JDK-8013569
    http://cr.openjdk.java.net/~serb/7190349/webrev.04/

The problem is that in many case for UI scale 2 we return to a user an unscaled value. But a value for transformed glyph advance, rounded and descaled can differ from just rounded glyph advance.

 For example, font[dialog, plain, 12] char 'a':
 transform: 12, advance: 7.35,  rounded advance: 8
 transform: 24, advance: 14.70 round advance: 14

 and 8 does not equal 14 / 2.

The solution for Mac OS X was to get the glyph advance using only font transform, round it and then apply the dev transform:

CGGlyphImages.m:
 481     advance = CGSizeApplyAffineTransform(advance, strike->fFontTx);
 482     if (!JRSFontStyleUsesFractionalMetrics(strike->fStyle)) {
 483         advance.width = round(advance.width);
 484         advance.height = round(advance.height);
 485     }
 486     advance = CGSizeApplyAffineTransform(advance, strike->fDevTx);

  Thanks,
  Alexandr.

-phil.

On 01/27/2016 01:26 PM, Alexander 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/webev.00/

The proposed fix rounds a glyph advance first and then scales it if UI scales do not equal to one.

 Thanks,
 Alexandr.



Reply via email to