<Swing Dev> RFR: 8231286: HTML font size too large with high-DPI scaling and W3C_LENGTH_UNITS [v2]
Matthias Perktold
github.com+7334069+mperktold at openjdk.java.net
Mon Feb 1 11:37:47 UTC 2021
On Fri, 29 Jan 2021 18:14:59 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Matthias Perktold has updated the pull request incrementally with three additional commits since the last revision:
>>
>> - Move StyleSheet rule into body tag
>> - Measure preferredSize of htmlPane instead of frame bounds
>> - Fix ratio formatting
>
> test/jdk/javax/swing/text/html/HtmlFontSizeTest.java line 94:
>
>> 92:
>> 93: float ratio = (float)w3cFrameSize.width / (float)stdFrameSize.width;
>> 94: System.out.println("w3cFrameSize.width/stdFrameSize.width " + ratio);
>
> Shall the ratio be `(float)w3cFrameSize.height / (float)stdFrameSize.height`?
> You measure the font size so height seems a better candidate. However, the width does change as well.
The problem with height is that the values are much smaller so they lead to higher rounding errors, and we do not achieve a 1.3 ratio. To account for that, we would need to either accept a wider range of ratios (e.g. everything between 1.15 and 1.45) or increase the font size.
I went with width for now, but I can change to height and, say, double the font size if you prefer.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2256
More information about the swing-dev
mailing list