freetype-devel
[Top][All Lists]
Advanced

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

Resource leak?


From: Niels A. Moseley
Subject: Resource leak?
Date: Mon, 10 Jan 2000 13:02:13 +0100

Hi!

I think I discovered a resource leak when using .FNT/.FON windows files.
When the current face
is a .TTF the following (see code) works fine. But when I use a .FNT/.FON
file, there seems to be no deallocation
of a bitmap structure somewhere (FT_Glyph_Copy??). I must admit I don't
fully understand what is
going on.. Excuse my ignorance! ;-)

I use a recent CVS snapshot, last update was a little more than a week ago.


Cheers, Niels.

----------------------------------------------------------------------------
------------

// CODE START HERE..

S32 TextRenderer::GetTextHeight(S32 num_glyphs)
{
        S32 ymin, ymax;
        PGlyph glyph = glyphs;
        FT_Error error;
        
        ymin = 0x7FFFFFFFl;
        ymax = 0x80000000l;
        for(int i=0; i<num_glyphs; i++, glyph++)
        {
                FT_Glyph image;
                FT_Vector vec;
                FT_BBox bbox;
                
                if (glyph->image==NULL) continue;
                error = FT_Glyph_Copy(glyph->image, &image);
                if (error) continue;
                vec = glyph->pos;
                error = FT_Glyph_Transform(image, NULL, &vec);
                if (error) continue;
                FT_Glyph_Get_CBox(image, ft_glyph_bbox_pixels, &bbox);
                if (ymin>bbox.yMin) ymin = bbox.yMin;
                if (ymax<bbox.yMax) ymax = bbox.yMax;
                FT_Done_Glyph(image);                
        }
        return ymax;
}

// CODE ENDS




reply via email to

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