Imported Upstream version 2.13.2
[platform/upstream/freetype2.git] / include / freetype / ftlzw.h
1 /****************************************************************************
2  *
3  * ftlzw.h
4  *
5  *   LZW-compressed stream support.
6  *
7  * Copyright (C) 2004-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 FTLZW_H_
20 #define FTLZW_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    *   lzw
37    *
38    * @title:
39    *   LZW Streams
40    *
41    * @abstract:
42    *   Using LZW-compressed font files.
43    *
44    * @description:
45    *   In certain builds of the library, LZW 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 LZW stream from it and
49    *   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 LZW-specific functions.
56    *
57    */
58
59   /**************************************************************************
60    *
61    * @function:
62    *   FT_Stream_OpenLZW
63    *
64    * @description:
65    *   Open a new stream to parse LZW-compressed font files.  This is mainly
66    *   used to support the compressed `*.pcf.Z` fonts that come with XFree86.
67    *
68    * @input:
69    *   stream ::
70    *     The target embedding stream.
71    *
72    *   source ::
73    *     The source stream.
74    *
75    * @return:
76    *   FreeType error code.  0~means success.
77    *
78    * @note:
79    *   The source stream must be opened _before_ calling this function.
80    *
81    *   Calling the internal function `FT_Stream_Close` on the new stream will
82    *   **not** call `FT_Stream_Close` on the source stream.  None of the
83    *   stream objects will be released to the heap.
84    *
85    *   This function may return `FT_Err_Unimplemented_Feature` if your build
86    *   of FreeType was not compiled with LZW support.
87    */
88   FT_EXPORT( FT_Error )
89   FT_Stream_OpenLZW( FT_Stream  stream,
90                      FT_Stream  source );
91
92   /* */
93
94
95 FT_END_HEADER
96
97 #endif /* FTLZW_H_ */
98
99
100 /* END */