summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@yahoo.com>2010-12-31 16:59:33 +0100
committerWerner Lemberg <wl@gnu.org>2010-12-31 16:59:33 +0100
commited913c2151e40eda626d8d2809ed3229aade2941 (patch)
tree340368096759173a766d4149dc681e8c160e3bf9 /include
parent7774ac67ec562add4212930c82e402a7d7cdff8b (diff)
Add bzip2 compression support to handle *.pcf.bz2 files.
* builds/unix/configure.raw: Test for libbz2 library. * devel/ftoption.h, include/freetype/config/ftoption.h (FT_CONFIG_OPTION_USE_BZIP2): Define. * include/freetype/config/ftheader.h (FT_BZIP2_H): Define. * include/freetype/ftbzip2.h: New file. * src/bzip2/*: New files. * src/pcf/pcf.h: s/gzip_/comp_/. * src/pcf/pcfdrvr.c: Include FT_BZIP2_H. s/gzip_/comp_/. (PCF_Face_Init): Handle bzip2 compressed files. * docs/formats.txt, modules.cfg: Updated.
Diffstat (limited to 'include')
-rw-r--r--include/freetype/config/ftheader.h15
-rw-r--r--include/freetype/config/ftoption.h16
-rw-r--r--include/freetype/ftbzip2.h102
3 files changed, 132 insertions, 1 deletions
diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h
index b63945dc..2a7b8c4e 100644
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -4,7 +4,7 @@
/* */
/* Build macros of the FreeType 2 library. */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -427,6 +427,19 @@
/*************************************************************************
*
* @macro:
+ * FT_BZIP2_H
+ *
+ * @description:
+ * A macro used in #include statements to name the file containing the
+ * definitions of an API which supports bzip2-compressed files.
+ *
+ */
+#define FT_BZIP2_H <freetype/ftbzip2.h>
+
+
+ /*************************************************************************
+ *
+ * @macro:
* FT_WINFONTS_H
*
* @description:
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 2b46259c..1ab6e1e4 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -190,6 +190,22 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
+ /* Bzip2-compressed file support. */
+ /* */
+ /* FreeType now handles font files that have been compressed with the */
+ /* `bzip2' program. This is mostly used to parse many of the PCF */
+ /* files that come with XFree86. The implementation uses `libbz2' to */
+ /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */
+ /* Contrary to gzip, bzip2 currently is not included and need to use */
+ /* the system available bzip2 implementation. */
+ /* */
+ /* Define this macro if you want to enable this `feature'. */
+ /* */
+/* #define FT_CONFIG_OPTION_USE_BZIP2 */
+
+
+ /*************************************************************************/
+ /* */
/* DLL export compilation */
/* */
/* When compiling FreeType as a DLL, some systems/compilers need a */
diff --git a/include/freetype/ftbzip2.h b/include/freetype/ftbzip2.h
new file mode 100644
index 00000000..083c3563
--- /dev/null
+++ b/include/freetype/ftbzip2.h
@@ -0,0 +1,102 @@
+/***************************************************************************/
+/* */
+/* ftbzip2.h */
+/* */
+/* Bzip2-compressed stream support. */
+/* */
+/* Copyright 2010 by */
+/* Joel Klinghed. */
+/* */
+/* 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. */
+/* */
+/***************************************************************************/
+
+
+#ifndef __FTBZIP2_H__
+#define __FTBZIP2_H__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
+
+
+FT_BEGIN_HEADER
+
+ /*************************************************************************/
+ /* */
+ /* <Section> */
+ /* bzip2 */
+ /* */
+ /* <Title> */
+ /* BZIP2 Streams */
+ /* */
+ /* <Abstract> */
+ /* Using bzip2-compressed font files. */
+ /* */
+ /* <Description> */
+ /* This section contains the declaration of Bzip2-specific functions. */
+ /* */
+ /*************************************************************************/
+
+
+ /************************************************************************
+ *
+ * @function:
+ * FT_Stream_OpenBzip2
+ *
+ * @description:
+ * Open a new stream to parse bzip2-compressed font files. This is
+ * mainly used to support the compressed `*.pcf.gz' fonts that come
+ * with XFree86.
+ *
+ * @input:
+ * stream ::
+ * The target embedding stream.
+ *
+ * source ::
+ * The source stream.
+ *
+ * @return:
+ * FreeType error code. 0~means success.
+ *
+ * @note:
+ * The source stream must be opened _before_ calling this function.
+ *
+ * Calling the internal function `FT_Stream_Close' on the new stream will
+ * *not* call `FT_Stream_Close' on the source stream. None of the stream
+ * objects will be released to the heap.
+ *
+ * The stream implementation is very basic and resets the decompression
+ * process each time seeking backwards is needed within the stream.
+ *
+ * In certain builds of the library, bzip2 compression recognition is
+ * automatically handled when calling @FT_New_Face or @FT_Open_Face.
+ * This means that if no font driver is capable of handling the raw
+ * compressed file, the library will try to open a bzip2 compressed stream
+ * from it and re-open the face with it.
+ *
+ * This function may return `FT_Err_Unimplemented_Feature' if your build
+ * of FreeType was not compiled with bzip2 support.
+ */
+ FT_EXPORT( FT_Error )
+ FT_Stream_OpenBzip2( FT_Stream stream,
+ FT_Stream source );
+
+ /* */
+
+
+FT_END_HEADER
+
+#endif /* __FTBZIP2_H__ */
+
+
+/* END */