freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] Re: Untangling relationship with fontconfig


From: Alan Chandler
Subject: Re: [Freetype] Re: Untangling relationship with fontconfig
Date: Mon, 17 Feb 2003 21:47:23 +0000
User-agent: KMail/1.5

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 17 Feb 2003 12:11 pm, Mike FABIAN wrote:
> Alan Chandler <address@hidden> さんは書きました:
> > On Sunday 16 Feb 2003 3:09 pm, ismail (cartman) donmez wrote:
> >> Hi,
> >>
> >> On Sunday 16 February 2003 17:04, Alan Chandler wrote:
> >> > name for /usr/share/fonts/console8x16.pcf.gz to put into the font
> >> > cache.
> >>
> >> try gunzip  /usr/share/fonts/console8x16.pcf.gz . Freetype does not
> >> transparently ( afaik ) handle gzip files.
> >
> > A year ago there is discussion on the address@hidden mailing list
> > about just this.  It appears that compression was being added at that
> > point but it is not very clear.
>
> Yes, this works with the current version of freetype (2.1.3) and Xft2
> (from XFree86 4.3.0 CVS).

Actually I got xft2 from the fontconfig package - but the fontconfig web site 
implies its been gathered up from the Xfree stuff.

HOWEVER - The following code (line numbers from gvd) seems to my reading to be 
a bit strange - can someone please confirm whether I am bonkers or not (I am 
not a fluent C programmer). This is from ftgzip.c in the freetype library.

The variable "error" which is used as the return value from the 
ft_gzip_check_header is never initialised unless the first error exit is 
taken.  In particular the correct path through leaves error undefined. I am 
finding that I exit this routine with error set to 85 even though I pass the 
test for invalid file format in lines 167 to 174). Because of this 85 error 
return this means that this is not a recognized format for the file (this is 
testing for a gzipped pcf file).


  154  /* check and skip .gz header - we don't support "transparent" 
compression */
  155   static FT_Error
  156   ft_gzip_check_header( FT_Stream  stream )
  157   {
  158     FT_Error  error;
  159     FT_Byte   head[4];
  160 
  161     if ( FT_STREAM_SEEK( 0 )       ||
  162          FT_STREAM_READ( head, 4 ) )
  163       goto Exit;
  164 
  165     /* head[0] && head[1] are the magic numbers     */
  166     /* head[2] is the method, and head[3] the flags */
  167     if ( head[0] != 0x1f              ||
  168          head[1] != 0x8b              ||
  169          head[2] != Z_DEFLATED        ||
  170         (head[3] & FT_GZIP_RESERVED)  )
  171     {
  172       error = FT_Err_Invalid_File_Format;
  173       goto Exit;
  174     }
  175 
  176     /* skip time, xflags and os code */
  177     (void)FT_STREAM_SKIP( 6 );
  178 
  179     /* skip the extra field */
  180     if ( head[3] && FT_GZIP_EXTRA_FIELD )
  181     {
  182       FT_UInt  len;
  183 
  184       if ( FT_READ_USHORT_LE( len ) ||
  185            FT_STREAM_SKIP( len )    )
  186         goto Exit;
  187     }
  188 
  189     /* skip original file name */
  190     if ( head[3] && FT_GZIP_ORIG_NAME )
  191       for (;;)
  192       {
  193         FT_UInt  c;
  194 
  195         if ( FT_READ_BYTE( c) )
  196           goto Exit;
  197 
  198         if ( c == 0 )
  199           break;
  200       }
  201 
  202     /* skip .gz comment */
  203     if ( head[3] & FT_GZIP_COMMENT )
  204       for (;;)
  205       {
  206         FT_UInt  c;
  207 
  208         if ( FT_READ_BYTE( c) )
  209           goto Exit;
  210 
  211         if ( c == 0 )
  212           break;
  213       }
  214 
  215     /* skip CRC */
  216     if ( head[3] & FT_GZIP_HEAD_CRC )
  217       if ( FT_STREAM_SKIP( 2 ) )
  218         goto Exit;
  219 
  220   Exit:
  221     return error;
  222   }
- -- 
Alan Chandler
address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+UVhuuFHxcV2FFoIRAqngAJ0eMdYB97ewcMruN2hx4WWk6q8IsQCcCXOR
QOfZV43POSnHJC00Mw9tuKM=
=o721
-----END PGP SIGNATURE-----




reply via email to

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