[OpenJDK 2D-Dev] Font question

Roman Kennke roman.kennke at aicas.com
Thu Apr 17 19:28:23 UTC 2008


Hi Phil,

> > http://kennke.org/~roman/swingdemo.png
> > 
> > This might be using different fonts, I'm not sure which fonts are used
> > by default for DIALOG, etc. But OTOH, I don't have many fonts on my
> > system and none of them looks good on the cacio pipeline.
> 
> On Ubuntu its using DejaVu Sans. See
> src/solaris/classes/sun/awt/fontconfigs/linux.fontconfig.Ubuntu.properties
> and its clearly anti-aliased.

Anti-aliasing is on by default for the X11 pipeline, right? I wonder,
because I find this code in X11SurfaceData.validatePipe():

                switch (sg2d.textAntialiasHint) {

                case SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT:
                    /* equating to OFF which it is for us */
                case SunHints.INTVAL_TEXT_ANTIALIAS_OFF:


This seems to indicate the opposite. Is there another switch to
determine the default text AA setting?

> > Do you have a quick hint, how I can enable AA rasterization? As I said,
> > I don't get any gray values in my rasterizer, only 0 and 255, even when
> > the rendering hint is set to AA for text.
> 
> I'm not clear what you mean by 'your rasterizer'.

Sorry, wrong terminology. I mean 'text renderer'. My TextRenderer is a
subclass of GlyphListPipe, and I seem to get no gray values there, even
if I use this for AA text. Maybe I did something wrong.

> Ultimately you have to pass the right flags to freetype
> See Java_sun_font_FreetypeFontScaler_getGlyphImageNative in freetypescaler.c
> No matter how little of the following applies, you clearly at least have
> to tell freetype the right thing to do.

Yeah, I guessed so ;-)

> In the OpenJDK architecture this means creating a FileFontStrike with
> a FontStrikeDesc object which has the aa flag on.
> 
> The AA flag is taken from the RenderingHints on the Graphics2D, and
> sun.java2d.SunGraphics2D.java has code in checkFontInfo(..) which
> creates the FontStrikeDesc and FileFontStrike based on that and
> the rest of the appropriate graphics state.

I'm using all of the OpenJDK architecture (at least in this 'branch' of
my work related to the challenge, I'm also working on the other case
which specifically aims at implementing all this without making use of
OpenJDK internal things), so all of the above applies. I think I will
have to do some more experimenting with the setting and pipeline
configurations.

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-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt




More information about the 2d-dev mailing list