/**************************************************************************** * * ftlzw.c * * FreeType support for .Z compressed files. * * This optional component relies on NetBSD's zopen(). It should mainly * be used to parse compressed PCF fonts, as found with many X11 server * distributions. * * Copyright (C) 2004-2023 by * Albert Chin-A-Young. * * based on code in `src/gzip/ftgzip.c' * * This file is part of the FreeType project, and may only be used, * modified, and distributed under the terms of the FreeType project * license, LICENSE.TXT. By continuing to use, modify, or distribute * this file you indicate that you have read the license and * understand and accept it fully. * */ #include <freetype/internal/ftmemory.h> #include <freetype/internal/ftstream.h> #include <freetype/internal/ftdebug.h> #include <freetype/ftlzw.h> #include FT_CONFIG_STANDARD_LIBRARY_H #include <freetype/ftmoderr.h> #undef FTERRORS_H_ #undef FT_ERR_PREFIX #define FT_ERR_PREFIX … #define FT_ERR_BASE … #include <freetype/fterrors.h> #ifdef FT_CONFIG_OPTION_USE_LZW #include "ftzopen.h" /***************************************************************************/ /***************************************************************************/ /***** *****/ /***** M E M O R Y M A N A G E M E N T *****/ /***** *****/ /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ /***************************************************************************/ /***** *****/ /***** F I L E D E S C R I P T O R *****/ /***** *****/ /***************************************************************************/ /***************************************************************************/ #define FT_LZW_BUFFER_SIZE … FT_LZWFile; /* check and skip .Z header */ static FT_Error ft_lzw_check_header( FT_Stream stream ) { … } static FT_Error ft_lzw_file_init( FT_LZWFile zip, FT_Stream stream, FT_Stream source ) { … } static void ft_lzw_file_done( FT_LZWFile zip ) { … } static FT_Error ft_lzw_file_reset( FT_LZWFile zip ) { … } static FT_Error ft_lzw_file_fill_output( FT_LZWFile zip ) { … } /* fill output buffer; `count' must be <= FT_LZW_BUFFER_SIZE */ static FT_Error ft_lzw_file_skip_output( FT_LZWFile zip, FT_ULong count ) { … } static FT_ULong ft_lzw_file_io( FT_LZWFile zip, FT_ULong pos, FT_Byte* buffer, FT_ULong count ) { … } /***************************************************************************/ /***************************************************************************/ /***** *****/ /***** L Z W E M B E D D I N G S T R E A M *****/ /***** *****/ /***************************************************************************/ /***************************************************************************/ static void ft_lzw_stream_close( FT_Stream stream ) { … } static unsigned long ft_lzw_stream_io( FT_Stream stream, unsigned long offset, unsigned char* buffer, unsigned long count ) { … } FT_EXPORT_DEF( FT_Error ) FT_Stream_OpenLZW( FT_Stream stream, FT_Stream source ) { … } #include "ftzopen.c" #else /* !FT_CONFIG_OPTION_USE_LZW */ FT_EXPORT_DEF( FT_Error ) FT_Stream_OpenLZW( FT_Stream stream, FT_Stream source ) { FT_UNUSED( stream ); FT_UNUSED( source ); return FT_THROW( Unimplemented_Feature ); } #endif /* !FT_CONFIG_OPTION_USE_LZW */ /* END */