[OpenJDK 2D-Dev] Font rendering issue

Mario Torre neugens at limasoftware.net
Tue May 18 21:33:34 UTC 2010

Il giorno mar, 18/05/2010 alle 21.07 +0200, Roman Kennke ha scritto:
> Hi Mario,
> > > > ly = (jfloat) ROUND(FT26Dot6ToFloat(
> > > >               scalerInfo->face->size->metrics.height +
> > > >               bmodifier) + ay - dy);
> > > > 

> To be honest, I don't like that. It's (yet another) workaround for
> problems in other areas of JDK. We already have plenty of workarounds
> and adjustments on the metrics, and adding more of it doesn't seem
> right.

Hi Roman,

Thanks for commenting.

I totally agree on that, I don't want to add other workarounds, but I
think this is still part of the fix (actually, it's a fix for a separate
issue than the one I opened initially, even if they are related).

> So what is the actual problem that leads to 'g' and '_' beeing cut off?
> In my opinion, it is a problem in how Swing renders and lays out text.
> In many places (for example, in PlainView) it assumes that font height
> is the space that a single line of text needs to fully contain all its
> glyphs. 

I've seen this code, and did some tests, my target component was the
text editor because this is what I though NetBeans was using, perhaps
with some fancy addition. It turned out that fixing it didn't have any
effect on NetBeans.

Anyway, I think it makes sense to fix our stuff and let other people fix
their own, and I agree that we should fix Swing now, because it's not so
complicated either. I prepared a patch to let pass the height of the
font from the scaler when it instantiates the StrikeMetrics, so that
this value is the correct one calculated by FreeType:


(need to prepare a webrev and double check the code, but you get the

I don't think it's a big issue for perennial backward compatibility
though, the closed JDK wrongly report a size one pixel higher, and this
accidentally hides the bug, everybody is happy there. If we fix the
FreeType scaler, we only fix the open code, which already render
incorrectly *every* application anyway, so it can't be worse than that.

> Would like to hear other's (Phil, Igor,..) opinions on that, I might be
> missing important points.

Yes, please!


pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA  FC7C 4086 63E3 80F2 40CF

Proud GNU Classpath developer: http://www.classpath.org/
Read About us at: http://planet.classpath.org
OpenJDK: http://openjdk.java.net/projects/caciocavallo/

Please, support open standards:

More information about the 2d-dev mailing list