freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] [Doubt] Error with STREAM_FILE function.


From: Werner LEMBERG
Subject: Re: [ft-devel] [Doubt] Error with STREAM_FILE function.
Date: Fri, 15 Jun 2018 22:50:49 +0200 (CEST)

> When the gf driver enters the gf_load_font in gflib.c, if we use
> stream->descriptor.pointer to get the file pointer and comment out
> the fopen I get a segmentation fault.  And if the fopen is used it
> works fine.
> 
> Like here:
>
>     FT_FILE*  fp = (FT_FILE*)stream->descriptor.pointer;
>
>     /* Errors with STREAM_FILE( stream )            */
>     /* stream->descriptor.pointer is not allocating */
>     /* the file pointer properly                    */
> 
>     char* st = (char*)stream->pathname.pointer;
>     fp       = fopen ( st, "rb" );

There is not a single font driver in FreeType that uses `FT_FILE'.
It's definitely the wrong interface.  FreeType either accepts font
files or fonts that are preloaded into a memory buffer.  For the
latter you can't use `fopen' and friends; this is another reason for
being the wrong interface.

Function `gf_load_font' gets an `FT_Stream' object; this means you can
use the FT_STREAM_XXX macros, for example `FT_STREAM_SEEK'.

I suggest that you have a look (again :-) into `winfnt.c'.


    Werner



reply via email to

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