(root)/
freetype-2.13.2/
include/
freetype/
ftgzip.h
       1  /****************************************************************************
       2   *
       3   * ftgzip.h
       4   *
       5   *   Gzip-compressed stream support.
       6   *
       7   * Copyright (C) 2002-2023 by
       8   * David Turner, Robert Wilhelm, and Werner Lemberg.
       9   *
      10   * This file is part of the FreeType project, and may only be used,
      11   * modified, and distributed under the terms of the FreeType project
      12   * license, LICENSE.TXT.  By continuing to use, modify, or distribute
      13   * this file you indicate that you have read the license and
      14   * understand and accept it fully.
      15   *
      16   */
      17  
      18  
      19  #ifndef FTGZIP_H_
      20  #define FTGZIP_H_
      21  
      22  #include <freetype/freetype.h>
      23  
      24  #ifdef FREETYPE_H
      25  #error "freetype.h of FreeType 1 has been loaded!"
      26  #error "Please fix the directory search order for header files"
      27  #error "so that freetype.h of FreeType 2 is found first."
      28  #endif
      29  
      30  
      31  FT_BEGIN_HEADER
      32  
      33    /**************************************************************************
      34     *
      35     * @section:
      36     *   gzip
      37     *
      38     * @title:
      39     *   GZIP Streams
      40     *
      41     * @abstract:
      42     *   Using gzip-compressed font files.
      43     *
      44     * @description:
      45     *   In certain builds of the library, gzip compression recognition is
      46     *   automatically handled when calling @FT_New_Face or @FT_Open_Face.
      47     *   This means that if no font driver is capable of handling the raw
      48     *   compressed file, the library will try to open a gzipped stream from it
      49     *   and re-open the face with it.
      50     *
      51     *   The stream implementation is very basic and resets the decompression
      52     *   process each time seeking backwards is needed within the stream,
      53     *   which significantly undermines the performance.
      54     *
      55     *   This section contains the declaration of Gzip-specific functions.
      56     *
      57     */
      58  
      59  
      60    /**************************************************************************
      61     *
      62     * @function:
      63     *   FT_Stream_OpenGzip
      64     *
      65     * @description:
      66     *   Open a new stream to parse gzip-compressed font files.  This is mainly
      67     *   used to support the compressed `*.pcf.gz` fonts that come with
      68     *   XFree86.
      69     *
      70     * @input:
      71     *   stream ::
      72     *     The target embedding stream.
      73     *
      74     *   source ::
      75     *     The source stream.
      76     *
      77     * @return:
      78     *   FreeType error code.  0~means success.
      79     *
      80     * @note:
      81     *   The source stream must be opened _before_ calling this function.
      82     *
      83     *   Calling the internal function `FT_Stream_Close` on the new stream will
      84     *   **not** call `FT_Stream_Close` on the source stream.  None of the
      85     *   stream objects will be released to the heap.
      86     *
      87     *   This function may return `FT_Err_Unimplemented_Feature` if your build
      88     *   of FreeType was not compiled with zlib support.
      89     */
      90    FT_EXPORT( FT_Error )
      91    FT_Stream_OpenGzip( FT_Stream  stream,
      92                        FT_Stream  source );
      93  
      94  
      95    /**************************************************************************
      96     *
      97     * @function:
      98     *   FT_Gzip_Uncompress
      99     *
     100     * @description:
     101     *   Decompress a zipped input buffer into an output buffer.  This function
     102     *   is modeled after zlib's `uncompress` function.
     103     *
     104     * @input:
     105     *   memory ::
     106     *     A FreeType memory handle.
     107     *
     108     *   input ::
     109     *     The input buffer.
     110     *
     111     *   input_len ::
     112     *     The length of the input buffer.
     113     *
     114     * @output:
     115     *   output ::
     116     *     The output buffer.
     117     *
     118     * @inout:
     119     *   output_len ::
     120     *     Before calling the function, this is the total size of the output
     121     *     buffer, which must be large enough to hold the entire uncompressed
     122     *     data (so the size of the uncompressed data must be known in
     123     *     advance).  After calling the function, `output_len` is the size of
     124     *     the used data in `output`.
     125     *
     126     * @return:
     127     *   FreeType error code.  0~means success.
     128     *
     129     * @note:
     130     *   This function may return `FT_Err_Unimplemented_Feature` if your build
     131     *   of FreeType was not compiled with zlib support.
     132     *
     133     * @since:
     134     *   2.5.1
     135     */
     136    FT_EXPORT( FT_Error )
     137    FT_Gzip_Uncompress( FT_Memory       memory,
     138                        FT_Byte*        output,
     139                        FT_ULong*       output_len,
     140                        const FT_Byte*  input,
     141                        FT_ULong        input_len );
     142  
     143    /* */
     144  
     145  
     146  FT_END_HEADER
     147  
     148  #endif /* FTGZIP_H_ */
     149  
     150  
     151  /* END */