[OpenJDK 2D-Dev] Thoughts about font implementation

Roman Kennke roman.kennke at aicas.com
Tue Aug 12 21:22:34 UTC 2008

Hi Igor,

> Anyway, i promise i'll look into this in more detail as i get some
> spare 
> time (that is really rare these days :()

Thanks alot.

> >> From the top of the head i'd sugegst to check impact of such change
> on 
> >> performance and perceived
> >> footprint scanning large set of large fonts.
> >> 
> >
> > I can do that. Any suggestions on how to do that easily? I'm not
> sure
> > how that (FreeType) implementation works, but I know at least one
> font
> > implementation that doesn't actually load anything until the
> > corresponding glyphs are needed (also mmap-based, very handy... this
> is
> > the code in Classpath, all Java, all nice :-D ).
> > 
> Both freetype and t2k do not read everything explicitly too.
> However, to build list of all available fonts we have to scan some 
> tables in all files.
> And it will be unfortunate if process size will grew by total size of 
> all fonts.

> Quick tests are: run Font2DTest on system that has some really large 
> ttf/ttc files.
> Write simple test that iterates through all available fonts and draw
> one 
> or all glyphs to bufferedimage.

I wrote a simple test program that gets an array of all fonts and gets
the baseline for all 0-0xffff characters. (Drawing stuff to BI didn't
work due to NPE, see stacktrace below. BTW, this makes everything, e.g.
SwingSet2, kindof unstable, is this a known bug?)

10 runs of this program with my patch take: 4338ms
10 runs of this program w/o  my patch take: 4492ms

And I can say from the output that the jitter is not very big here. (The
values of the runs with and w/o my patch do not overlap). Seems like a
small but noticable performance improvement. This is on Linux though.

One interesting note here: Everytime this program is run, it shows a
different number of fonts (around 285-302 fonts). On an OpenJDK6 system
it constantly shows 360 fonts.

> >> I likely be mistaken here 
> >> but on some platforms
> >> (Windows) this might have noticeable negative consequences.
> >> 
> >
> > Unfortunately, I don't have a Windows box around, and can't setup
> one
> > easily. Windows licenses and VS licenses are too costly for my
> taste.
> > Also, at work, some people tried to setup a build of OpenJDK on
> Windows
> > and failed (or at least, did not succeed after 16 hours of work or
> so).
> > 
> It will be nice to hear why it does not build on Windows.
> I am quite sure OpenJDK is buildable with commercial VS and
> i know that some people were building it with VS Express too (with
> minor 
> tweaks).

I can ask.

Cheers, Roman

Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-48
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt

More information about the 2d-dev mailing list