freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] External stream


From: Sander van der Wal
Subject: Re: [Freetype] External stream
Date: Mon, 17 Sep 2001 10:05:33 +0200

----- Original Message -----
From: "Michael Jansson" <address@hidden>
To: <address@hidden>
Sent: Sunday, September 16, 2001 7:21 PM
Subject: [Freetype] External stream


> Hi,
>
> I'm trying to use FT_Open_Face() to open a font with a home brewed
stream
> and am having a problem. The docs states that I'm not supposed to
poke at
> the 'memory' field of my custom 'FT_Stream_Rec_' structure, as it is
> supposed to be set by the lib. However, I'm getting a crash (null
point
> reference when stream->memory is used) if I don't. Is this a know
problem?
>
> Adding these lines to src/base/ftobjs.c (from the current stable
build
> 2.0.4) would be one solution:
> 204a205,208
> >
> >         /* Use default memory pool from the library if none is
provided.
> */
> >         if (stream->memory==NULL)
> >                 stream->memory = memory;
>
> Another approach would be to lift the FT_Memory structure from
> /internal/ftobjs.h, which currently seems to suggest that this is
private
> stuff. If so, then FT_New_Memory() could be used. However, there is
no
> FT_Done_Memory as far as I can tell. Simply calling free() on the
struct
> would not work, if the client may use a different memory manager
than what
> was used when the FreeType lib was compiled.  Anyway, I prefer
adding the
> lines above to ftobjs.c as this is a cleaner solution.
>
> Am I missing something? Am I the only one trying to use my own
stream
> implementation?

I had the same problem when implementing my own stream. I am
suggesting that in ftobjs.c, function ft_new_inoput_stream this line
must be added:

else if ( ( args->flags & ft_open_stream ) && args->stream )
    {
      /* in this case, we do not need to allocate a new stream object
*/
      /* since the caller is responsible for closing it himself
*/
      FREE( stream );
      stream = args->stream;
>>>stream->memory = memory;

Freetype currently behaves in such a way that *not* making this
assignment looks like a bug.

To give some perspective on things:

The reason I am implementing my own stream is because I can only pass
*one* parameter (the file name) to my own FT_New_Stream() etc
implementation in ftsystem. If I could pass more parameters I wouldn't
use an external stream.
I am also happy with one memory manager,

Sander van der Wal









reply via email to

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