freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] xadvance descrepancy between bitmpats & glyphs?


From: David Turner
Subject: Re: [Devel] xadvance descrepancy between bitmpats & glyphs?
Date: Tue, 13 Jul 2004 00:47:33 +0200
User-agent: Mozilla Thunderbird 0.7.1 (X11/20040626)

Hello Ken,

Ken Hancock wrote:
I'm adding code to cache transformed bitmaps, among them italics and
stretched.

In my iFTFaceRequester I call FT_Set_Transform() to set a global transform
for any Face_ID which should be transformed.

This is sub-optimal, since you're going to create several copies of the same FT_Face, except they'll have distinct transform values.

You could also map each FT_FaceID to a single FT_Face with no transform,
then write custom image and bitmap caches that would call FT_Set_Transform both before and after FT_Load_Glyph to set/unset the transformation matrix.

You certainly know that the cache isn't completely stable, but you can
have a look at src/cache/ftcbasic.c for an inspiration on how to write
these custom caches.

> I then have two routines which use:

FTC_ImageCache_Lookup() to get the glyph->advance.x for line-layout and
FTC_SBitCache_Lookup() to get the sbit->xadvance for blitting

However, it looks like the advances are computed inconsistently:

In FT_Load_Glyph (irrelevant lines omitted):

    slot->advance.x = slot->metrics.horiAdvance;

    if ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) == 0 )
    {
        /* transform advance */
        FT_Vector_Transform( &slot->advance, &internal->transform_matrix );
}
In ftc_snode_load (irrelevant lines omitted):

      xadvance = ( slot->metrics.horiAdvance + 32 ) >> 6;


slot->metrics.horiAdvance is UNTRANSFORMED

Shouldn't ftc_snode_load use:

          xadvance = (slot->advance.x + 32 ) >> 6;
          yadvance = (slot->advance.y + 32 ) >> 6;


That's right, I'll commit the fix to the CVS shortly.

Thanks for everything,

- David Turner
- The FreeType Project  (www.freetype.org)


Thanks in advance!

Ken

_______________________________________________
Devel mailing list
address@hidden
http://www.freetype.org/mailman/listinfo/devel





reply via email to

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