ftlzw.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. #ifndef FTLZW_H_
  18. #define FTLZW_H_
  19. #include <freetype/freetype.h>
  20. #ifdef FREETYPE_H
  21. #error "freetype.h of FreeType 1 has been loaded!"
  22. #error "Please fix the directory search order for header files"
  23. #error "so that freetype.h of FreeType 2 is found first."
  24. #endif
  25. FT_BEGIN_HEADER
  26. /**************************************************************************
  27. *
  28. * @section:
  29. * lzw
  30. *
  31. * @title:
  32. * LZW Streams
  33. *
  34. * @abstract:
  35. * Using LZW-compressed font files.
  36. *
  37. * @description:
  38. * In certain builds of the library, LZW compression recognition is
  39. * automatically handled when calling @FT_New_Face or @FT_Open_Face.
  40. * This means that if no font driver is capable of handling the raw
  41. * compressed file, the library will try to open a LZW stream from it and
  42. * re-open the face with it.
  43. *
  44. * The stream implementation is very basic and resets the decompression
  45. * process each time seeking backwards is needed within the stream,
  46. * which significantly undermines the performance.
  47. *
  48. * This section contains the declaration of LZW-specific functions.
  49. *
  50. */
  51. /**************************************************************************
  52. *
  53. * @function:
  54. * FT_Stream_OpenLZW
  55. *
  56. * @description:
  57. * Open a new stream to parse LZW-compressed font files. This is mainly
  58. * used to support the compressed `*.pcf.Z` fonts that come with XFree86.
  59. *
  60. * @input:
  61. * stream ::
  62. * The target embedding stream.
  63. *
  64. * source ::
  65. * The source stream.
  66. *
  67. * @return:
  68. * FreeType error code. 0~means success.
  69. *
  70. * @note:
  71. * The source stream must be opened _before_ calling this function.
  72. *
  73. * Calling the internal function `FT_Stream_Close` on the new stream will
  74. * **not** call `FT_Stream_Close` on the source stream. None of the
  75. * stream objects will be released to the heap.
  76. *
  77. * This function may return `FT_Err_Unimplemented_Feature` if your build
  78. * of FreeType was not compiled with LZW support.
  79. */
  80. FT_EXPORT( FT_Error )
  81. FT_Stream_OpenLZW( FT_Stream stream,
  82. FT_Stream source );
  83. /* */
  84. FT_END_HEADER
  85. #endif /* FTLZW_H_ */
  86. /* END */