[OpenJDK 2D-Dev] fixing OpenJDK font rendering

Jim Graham james.graham at oracle.com
Tue Oct 11 17:25:18 UTC 2011


Hi Johnson,

Here is my big question...

On 10/11/2011 12:01 AM, Zhongcheng Lao wrote:
> Hi, Jim
>
> It's never a good idea to scale fonts in L&F to conform system DPI setting.
>
> - Johnson

Why is that?

Isn't it a property of the L&F how the font sizes will track (or not 
track) the screen DPI?  It's a nice feature for the fonts to scale up 
with the DPI when it keeps them readable on extreme cases of hi-DPI, but 
some users may actually not want that to happen and they may express 
that desire differently among the different L&Fs.

Also, a L&F may have some text that it wants to scale via the DPI of the 
screen and others (say logos, or full-screen text, or large animated 
strings) that it does not want to scale.  Typically the only text it 
does want to scale are the smaller fonts that are meant for presenting 
information.

Also, graphics objects are both handed to a L&F object and also to the 
client program who may have carefully decided that they want text that 
is 48 pixels tall (yes, pixels, and they do *NOT* want that to be 
automatically adjusted because it isn't necessarily meant for "reading" 
and 48 pixels is tall enough that they aren't worried about 96 vs 72 
DPI) and if you decide that, for the sake of the L&F, you will 
automatically scale any font request on a given Graphics then you may 
piss off the custom code in some of the Canvas objects.

Given that the font family choices and the relative sizing of the 
various fonts are up to the L&F, I think DPI adjustments are also in 
their ballpark...

			...jim



More information about the 2d-dev mailing list