freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] Spacing and rounding of truetype fonts


From: James Blanford
Subject: [Devel] Spacing and rounding of truetype fonts
Date: Sun, 9 Mar 2003 10:39:58 -0700 (MST)

This concerns the occasional bizarre spacing and distortion introduced
recently by changes to freetype6.  While most of my fonts look
beautiful, some smaller sizes have serious problems.

I looked at the cvs versions of src/truetype/ttdriver.c and now I think
that some comments were misinterpreted:

First all truetype fonts are converted from point to pixel sizes (in
units of 1/64 of a pixel) and rounded to the nearest whole pixel using
the function FT_SET_CHAR_SIZE in src/base/ftobjs.c. Later, if the
"round me" bit is NOT SET, the conversion is redone by Set_Char_Sizes in
src/truetype/ttdriver.c.  I guess that this is in case it wasn't rounded
the first time.  But I don't see that flag being checked at all, so I
don't know if that SET_CHAR_SIZES is needed.

Going from cvs version 1.59 to 1.60 of src/truetype/ttdriver.c, the
commenting that explains this was removed and the sense of the
comparison was reversed.  Now Set_Char_Sizes is called if the "round me"
bit IS SET.

I'm not sure what the intent is here.  If you want to fiddle with the
rounding adjust the rounding parameter around line 1394 and 1395 in
src/base/ftobjs.c:

    metrics->x_ppem = (FT_UShort)( (dim_x+32) >> 6 );
    metrics->y_ppem = (FT_UShort)( (dim_y+32) >> 6 );

I changed the 32 to 84 in the y (vertical) direction which rounds UP
the vertical size.  This has a greater proportional effect on small font
sizes that I like.  It opens up the top of the small "e" and the bottom
of the small "a".  It is also incorrect and so I don't recommend anybody
doing this as it can really screw up larger sizes.  It's just an example
of ways to fiddle with rendering. I do, however, strongly recommend,
reverting Set_Char_Sizes in src/truetype/ttdriver.c to the cvs 1.59
version, especially reverting the sense of the "if" comparison from
"!=" to the original "==".  Or just remove the function entirely.

     -  Jim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]