RFR: 8285308: Win: Japanese logical fonts are drawn with wrong size [v2]

Phil Race prr at openjdk.java.net
Tue Apr 26 16:53:53 UTC 2022


On Mon, 25 Apr 2022 08:15:18 GMT, Toshio Nakamura <tnakamura at openjdk.org> wrote:

>> Japanese logical fonts are drawn with wrong size since Java 18.
>> It's triggered by JEP 400, UTF-8 by Default. `sun.awt.FontConfiguration` (and `sun.awt.windows.WFontConfiguration`) seems to expect the native encoding instead of the default encoding. This patch changes to use native encoding.
>> 
>> Tested: jdk_desktop on Windows, Linux, and macOS
>
> Toshio Nakamura has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Moved the fix to WFontConfiguration

Hmm. I'm not sure I'm seeing what you see in the native app. 
There the Latin font is larger than the JDK case, and the Japanese font is smaller than the JDK case,
and they end up about the same size as each other.
Also you have to remember if you select "8 pt" in a windows native app, that (at 100% scale) is at 96dpi, not 72dpi.
So that's 96/72 times the size of the Java  8 pt font. 8 * 96 / 72 will round up to 11 pixels in native, not the 8 pixels in Java.

Also JDK - in theory - controls the exact fonts that are used even in a TextField.

I'd like to see this resolved but I'm still not feeling like I have a sufficient understanding.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8329



More information about the client-libs-dev mailing list