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.bylok...@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.

Reply via email to