Do you have HiDPI scaling activated? (Check "Scale and Layout" in the windows 
Display control panel.)

To make things like this work well on HiDPI screens, it's best not to go 
through a BufferedImage, but rather draw directly on the supplied Graphics2D.

If you want to use a BufferedImage, you would need to detect the supplied 
Graphics2D's scaling level from its current transform, create a correspondingly 
larger BufferedImage, and then apply a transform to scale it back down to the 
logical dimensions before painting the BufferedImage to the original 
Graphics2D. It's generally much easier to just just draw to the originally 
supplied Graphics2D. Also, if you want to use a backbuffer, beware that text 
rendering can end up looking different on BufferedImage vs. VolatileImage (on 
Windows or MacOS--can't remember which one).

-- Eirik

From: Peter Hull <[email protected]>
Sent: Monday, February 3, 2020 9:27 AM
To: [email protected]
Subject: Re: Memory usage text rendering issue

I made a simple example, 
https://gist.github.com/pedro-w/b089e23db7aca037266b41cfc9c2ec2f
On windows, I see this:
[Annotation 2020-02-03 142402.jpg]
I think the unpleasant rendering in the 'Rendered via Image' sample accounts 
for what you can see in the Memory usage widget (it's worse for smaller text)
I suppose there is some RenderingHints which can fix this, unfortunately I 
haven't time to google just now!
Pete


Reply via email to