<Swing Dev> [10] RFR JDK-8178025:HiDPI with non-integer scale factor - SPANs in HTML are rendered overlapping each other
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Fri Oct 27 06:38:59 UTC 2017
The main/default graphicsconfiguration should be used when the component
is created but still not added to the window and/or has null GConfig.
When the GConfig is changed then the component hierarchy should be
invalidated/validated somehow. We already update the size of the window
based on the default transform/scale of the screen->this will revalidate
the components. The problem is that in some cases the components or
ui-delegates uses default(or incorrect) screen instead of the screen
where the component is located.
On 13/10/2017 18:31, Alan Snyder wrote:
> Having run into similar problems, I believe this is an area where Swing has a serious design flaw. When a component is created, it has no idea which window it will be displayed in, and even when the window is known, the window could be moved to a different screen at any time. In addition, it seems the antialiasing and fractional metrics options are sometimes obtained from the Look and Feel, the rationale for which puzzles me. If these are not actual problems, please point me to appropriate documentation or supply an explanation.
>
> Alan
>
>
>
>
>
>
>> On Oct 13, 2017, at 6:10 PM, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:
>>
>> Hi, Prasanta.
>>
>> On 11/10/2017 02:43, Prasanta Sadhukhan wrote:
>>> Issue was, when a JLabel with an html text is created, the GlyphPainter1.getSpan() uses a FontrenderedContext with transform scale 1
>>> and also the obtained width is converted to int and not to float.
>>
>> Probably this is a root cause of the bug? FontrenderedContext is an abstraction which encapsulate information about text attributes for some specific surface such as screen, window, etc. If the label or any other components will use some FRC for rendering then the same FRC should be used for font size measurement. So why the scale is 1?
>>
>>> Proposed fix is to use correct transform while calculating the string width and also use floating point API to get floating point width.
>>
>> It will apply the screens scale to the FRC even if the component is located on some other screen.
>>
>>
>> --
>> Best regards, Sergey.
>
--
Best regards, Sergey.
More information about the swing-dev
mailing list