freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Segfault with otf and face_index == -1


From: David Turner
Subject: Re: [ft-devel] Segfault with otf and face_index == -1
Date: Tue, 18 Oct 2005 00:36:57 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Hi Again,

no, this is on purpose. If you call FT_New_Face with face_index < 0, it
should return an empty FT_Face object to indicate that the format is supported
(otherwise, an error is returned).

Moreover, the face->num_faces field can be used to determine the number
of faces within the font file.

After that, the caller must destroy the FT_Face normally with FT_Done_Face

Regards,

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


Ville Syrjälä a écrit :

On Tue, Oct 18, 2005 at 12:58:41AM +0300, Ville Syrjälä wrote:
On Mon, Oct 17, 2005 at 11:18:35PM +0200, David Turner wrote:
Hello,

thanks, I've commited a fix, which is to never call FT_New_GlyphSlot and FT_New_Size
within FT_Open_Face when face_index is < 0.

Hope this helps,
It works. Thanks.

It looks like the current code will leak memory though. AFAICS it needs something like this:

--- ftobjs.c.orig       2005-10-18 01:20:51.000000000 +0300
+++ ftobjs.c    2005-10-18 01:20:38.000000000 +0300
@@ -1751,8 +1751,11 @@
      internal->transform_delta.y = 0;
    }

-    if ( aface )
+    if ( face_index >= 0 )
      *aface = face;
+    else
+      FT_Done_Face( face );
+
    goto Exit;

  Fail:






reply via email to

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