<Swing Dev> [13] RFR JDK-8213535:Windows HiDPI html lightweight tooltips are truncated

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Mon Apr 15 18:06:10 UTC 2019


On 14/04/2019 22:24, Prasanta Sadhukhan wrote:
>> Currently this rectangle is created based on the size of the component, so this rectangle is smaller that the size.
>> But it looks like after the fix the rectangle will be bigger. Probably the bug exists in getPreferredSize() where we return small size?
>>
>> Can you please confirm that this check will always work as expected:
>> 176             if (!font.getTransform().equals(((Graphics2D)g).getTransform())) {
>> 177                 AffineTransform tx = ((Graphics2D) g).getTransform();
>> 178                 double scaleX = tx.getScaleX();
>> 179                 double scaleY = tx.getScaleY();
>> 180                 paintTextR.width = (int) Math.ceil(paintTextR.width * scaleX);
>> 181                 paintTextR.height = (int) Math.ceil(paintTextR.height * scaleY);
>> 182             }
>> 183             v.paint(g, paintTextR);
>>
> I have checked the regression tests for JToolTip with this fix without any issue.
>> In what coordinate space the final paintTextR will be? I assume that that the v.paint() expects coordinate in the users space.
>>
> Iguess the paintTextR will be in user space as BasicHTML.paint() says the rectangle as the region to render to.

But your conversion "size*scale" will convert the size of the component to the device space.
It is still unclear how we will draw the text in the v.paint() in the rectangle, which is bigger than the size of the related component?



-- 
Best regards, Sergey.


More information about the swing-dev mailing list