summaryrefslogtreecommitdiff
path: root/include/freetype/internal
diff options
context:
space:
mode:
Diffstat (limited to 'include/freetype/internal')
-rw-r--r--include/freetype/internal/autohint.h205
-rw-r--r--include/freetype/internal/bdftypes.h53
-rw-r--r--include/freetype/internal/cfftypes.h256
-rw-r--r--include/freetype/internal/fnttypes.h155
-rw-r--r--include/freetype/internal/ftcalc.h77
-rw-r--r--include/freetype/internal/ftcore.h185
-rw-r--r--include/freetype/internal/ftdebug.h196
-rw-r--r--include/freetype/internal/ftdriver.h202
-rw-r--r--include/freetype/internal/ftexcept.h82
-rw-r--r--include/freetype/internal/ftgloadr.h153
-rw-r--r--include/freetype/internal/fthash.h502
-rw-r--r--include/freetype/internal/ftmemory.h296
-rw-r--r--include/freetype/internal/ftobject.h533
-rw-r--r--include/freetype/internal/ftobjs.h794
-rw-r--r--include/freetype/internal/ftstream.h498
-rw-r--r--include/freetype/internal/fttrace.h106
-rw-r--r--include/freetype/internal/internal.h57
-rw-r--r--include/freetype/internal/pcftypes.h56
-rw-r--r--include/freetype/internal/pfr.h36
-rw-r--r--include/freetype/internal/psaux.h717
-rw-r--r--include/freetype/internal/pshints.h626
-rw-r--r--include/freetype/internal/psnames.h241
-rw-r--r--include/freetype/internal/sfnt.h534
-rw-r--r--include/freetype/internal/t1types.h199
-rw-r--r--include/freetype/internal/t42types.h55
-rw-r--r--include/freetype/internal/tttypes.h1669
26 files changed, 8483 insertions, 0 deletions
diff --git a/include/freetype/internal/autohint.h b/include/freetype/internal/autohint.h
new file mode 100644
index 00000000..22340afc
--- /dev/null
+++ b/include/freetype/internal/autohint.h
@@ -0,0 +1,205 @@
+/***************************************************************************/
+/* */
+/* autohint.h */
+/* */
+/* High-level `autohint' module-specific interface (specification). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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. */
+/* */
+/***************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* The auto-hinter is used to load and automatically hint glyphs if a */
+ /* format-specific hinter isn't available. */
+ /* */
+ /*************************************************************************/
+
+
+#ifndef __AUTOHINT_H__
+#define __AUTOHINT_H__
+
+
+ /*************************************************************************/
+ /* */
+ /* A small technical note regarding automatic hinting in order to */
+ /* clarify this module interface. */
+ /* */
+ /* An automatic hinter might compute two kinds of data for a given face: */
+ /* */
+ /* - global hints: Usually some metrics that describe global properties */
+ /* of the face. It is computed by scanning more or less */
+ /* agressively the glyphs in the face, and thus can be */
+ /* very slow to compute (even if the size of global */
+ /* hints is really small). */
+ /* */
+ /* - glyph hints: These describe some important features of the glyph */
+ /* outline, as well as how to align them. They are */
+ /* generally much faster to compute than global hints. */
+ /* */
+ /* The current FreeType auto-hinter does a pretty good job while */
+ /* performing fast computations for both global and glyph hints. */
+ /* However, we might be interested in introducing more complex and */
+ /* powerful algorithms in the future, like the one described in the John */
+ /* D. Hobby paper, which unfortunately requires a lot more horsepower. */
+ /* */
+ /* Because a sufficiently sophisticated font management system would */
+ /* typically implement an LRU cache of opened face objects to reduce */
+ /* memory usage, it is a good idea to be able to avoid recomputing */
+ /* global hints every time the same face is re-opened. */
+ /* */
+ /* We thus provide the ability to cache global hints outside of the face */
+ /* object, in order to speed up font re-opening time. Of course, this */
+ /* feature is purely optional, so most client programs won't even notice */
+ /* it. */
+ /* */
+ /* I initially thought that it would be a good idea to cache the glyph */
+ /* hints too. However, my general idea now is that if you really need */
+ /* to cache these too, you are simply in need of a new font format, */
+ /* where all this information could be stored within the font file and */
+ /* decoded on the fly. */
+ /* */
+ /*************************************************************************/
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ typedef struct FT_AutoHinterRec_ *FT_AutoHinter;
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* FT_AutoHinter_GlobalGetFunc */
+ /* */
+ /* <Description> */
+ /* Retrieves the global hints computed for a given face object the */
+ /* resulting data is dissociated from the face and will survive a */
+ /* call to FT_Done_Face(). It must be discarded through the API */
+ /* FT_AutoHinter_GlobalDoneFunc(). */
+ /* */
+ /* <Input> */
+ /* hinter :: A handle to the source auto-hinter. */
+ /* */
+ /* face :: A handle to the source face object. */
+ /* */
+ /* <Output> */
+ /* global_hints :: A typeless pointer to the global hints. */
+ /* */
+ /* global_len :: The size in bytes of the global hints. */
+ /* */
+ typedef void
+ (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter,
+ FT_Face face,
+ void** global_hints,
+ long* global_len );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* FT_AutoHinter_GlobalDoneFunc */
+ /* */
+ /* <Description> */
+ /* Discards the global hints retrieved through */
+ /* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints */
+ /* are freed from memory. */
+ /* */
+ /* <Input> */
+ /* hinter :: A handle to the auto-hinter module. */
+ /* */
+ /* global :: A pointer to retrieved global hints to discard. */
+ /* */
+ typedef void
+ (*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter,
+ void* global );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* FT_AutoHinter_GlobalResetFunc */
+ /* */
+ /* <Description> */
+ /* This function is used to recompute the global metrics in a given */
+ /* font. This is useful when global font data changes (e.g. Multiple */
+ /* Masters fonts where blend coordinates change). */
+ /* */
+ /* <Input> */
+ /* hinter :: A handle to the source auto-hinter. */
+ /* */
+ /* face :: A handle to the face. */
+ /* */
+ typedef void
+ (*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter,
+ FT_Face face );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* FT_AutoHinter_GlyphLoadFunc */
+ /* */
+ /* <Description> */
+ /* This function is used to load, scale, and automatically hint a */
+ /* glyph from a given face. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the face. */
+ /* */
+ /* glyph_index :: The glyph index. */
+ /* */
+ /* load_flags :: The load flags. */
+ /* */
+ /* <Note> */
+ /* This function is capable of loading composite glyphs by hinting */
+ /* each sub-glyph independently (which improves quality). */
+ /* */
+ /* It will call the font driver with FT_Load_Glyph(), with */
+ /* FT_LOAD_NO_SCALE set. */
+ /* */
+ typedef FT_Error
+ (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter,
+ FT_GlyphSlot slot,
+ FT_Size size,
+ FT_UInt glyph_index,
+ FT_Int32 load_flags );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_AutoHinter_ServiceRec */
+ /* */
+ /* <Description> */
+ /* The auto-hinter module's interface. */
+ /* */
+ typedef struct FT_AutoHinter_ServiceRec_
+ {
+ FT_AutoHinter_GlobalResetFunc reset_face;
+ FT_AutoHinter_GlobalGetFunc get_global_hints;
+ FT_AutoHinter_GlobalDoneFunc done_global_hints;
+ FT_AutoHinter_GlyphLoadFunc load_glyph;
+
+ } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service;
+
+
+FT_END_HEADER
+
+#endif /* __AUTOHINT_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/bdftypes.h b/include/freetype/internal/bdftypes.h
new file mode 100644
index 00000000..cd4dcabd
--- /dev/null
+++ b/include/freetype/internal/bdftypes.h
@@ -0,0 +1,53 @@
+/* bdftypes.h
+
+ FreeType font driver for bdf fonts
+
+ Copyright (C) 2001, 2002 by
+ Francesco Zappa Nardelli
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+#ifndef __BDFTYPES_H__
+#define __BDFTYPES_H__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ typedef struct BDF_Public_FaceRec_
+ {
+ FT_FaceRec root;
+
+ char* charset_encoding;
+ char* charset_registry;
+
+ } BDF_Public_FaceRec, *BDF_Public_Face;
+
+
+FT_END_HEADER
+
+
+#endif /* __BDFTYPES_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/cfftypes.h b/include/freetype/internal/cfftypes.h
new file mode 100644
index 00000000..82e1e91b
--- /dev/null
+++ b/include/freetype/internal/cfftypes.h
@@ -0,0 +1,256 @@
+/***************************************************************************/
+/* */
+/* cfftypes.h */
+/* */
+/* Basic OpenType/CFF type definitions and interface (specification */
+/* only). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __CFFTYPES_H__
+#define __CFFTYPES_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* CFF_IndexRec */
+ /* */
+ /* <Description> */
+ /* A structure used to model a CFF Index table. */
+ /* */
+ /* <Fields> */
+ /* stream :: The source input stream. */
+ /* */
+ /* count :: The number of elements in the index. */
+ /* */
+ /* off_size :: The size in bytes of object offsets in index. */
+ /* */
+ /* data_offset :: The position of first data byte in the index's */
+ /* bytes. */
+ /* */
+ /* offsets :: A table of element offsets in the index. */
+ /* */
+ /* bytes :: If the index is loaded in memory, its bytes. */
+ /* */
+ typedef struct CFF_IndexRec_
+ {
+ FT_Stream stream;
+ FT_UInt count;
+ FT_Byte off_size;
+ FT_ULong data_offset;
+
+ FT_ULong* offsets;
+ FT_Byte* bytes;
+
+ } CFF_IndexRec, *CFF_Index;
+
+
+ typedef struct CFF_EncodingRec_
+ {
+ FT_UInt format;
+ FT_ULong offset;
+
+ FT_UInt count;
+ FT_UShort sids [256]; /* avoid dynamic allocations */
+ FT_UShort codes[256];
+
+ } CFF_EncodingRec, *CFF_Encoding;
+
+
+ typedef struct CFF_CharsetRec_
+ {
+
+ FT_UInt format;
+ FT_ULong offset;
+
+ FT_UShort* sids;
+
+ } CFF_CharsetRec, *CFF_Charset;
+
+
+ typedef struct CFF_FontRecDictRec_
+ {
+ FT_UInt version;
+ FT_UInt notice;
+ FT_UInt copyright;
+ FT_UInt full_name;
+ FT_UInt family_name;
+ FT_UInt weight;
+ FT_Bool is_fixed_pitch;
+ FT_Fixed italic_angle;
+ FT_Pos underline_position;
+ FT_Pos underline_thickness;
+ FT_Int paint_type;
+ FT_Int charstring_type;
+ FT_Matrix font_matrix;
+ FT_UShort units_per_em;
+ FT_Vector font_offset;
+ FT_ULong unique_id;
+ FT_BBox font_bbox;
+ FT_Pos stroke_width;
+ FT_ULong charset_offset;
+ FT_ULong encoding_offset;
+ FT_ULong charstrings_offset;
+ FT_ULong private_offset;
+ FT_ULong private_size;
+ FT_Long synthetic_base;
+ FT_UInt embedded_postscript;
+ FT_UInt base_font_name;
+ FT_UInt postscript;
+
+ /* these should only be used for the top-level font dictionary */
+ FT_UInt cid_registry;
+ FT_UInt cid_ordering;
+ FT_ULong cid_supplement;
+
+ FT_Long cid_font_version;
+ FT_Long cid_font_revision;
+ FT_Long cid_font_type;
+ FT_Long cid_count;
+ FT_ULong cid_uid_base;
+ FT_ULong cid_fd_array_offset;
+ FT_ULong cid_fd_select_offset;
+ FT_UInt cid_font_name;
+
+ } CFF_FontRecDictRec, *CFF_FontRecDict;
+
+
+ typedef struct CFF_PrivateRec_
+ {
+ FT_Byte num_blue_values;
+ FT_Byte num_other_blues;
+ FT_Byte num_family_blues;
+ FT_Byte num_family_other_blues;
+
+ FT_Pos blue_values[14];
+ FT_Pos other_blues[10];
+ FT_Pos family_blues[14];
+ FT_Pos family_other_blues[10];
+
+ FT_Fixed blue_scale;
+ FT_Pos blue_shift;
+ FT_Pos blue_fuzz;
+ FT_Pos standard_width;
+ FT_Pos standard_height;
+
+ FT_Byte num_snap_widths;
+ FT_Byte num_snap_heights;
+ FT_Pos snap_widths[13];
+ FT_Pos snap_heights[13];
+ FT_Bool force_bold;
+ FT_Fixed force_bold_threshold;
+ FT_Int lenIV;
+ FT_Int language_group;
+ FT_Fixed expansion_factor;
+ FT_Long initial_random_seed;
+ FT_ULong local_subrs_offset;
+ FT_Pos default_width;
+ FT_Pos nominal_width;
+
+ } CFF_PrivateRec, *CFF_Private;
+
+
+ typedef struct CFF_FDSelectRec_
+ {
+ FT_Byte format;
+ FT_UInt range_count;
+
+ /* that's the table, taken from the file `as is' */
+ FT_Byte* data;
+ FT_UInt data_size;
+
+ /* small cache for format 3 only */
+ FT_UInt cache_first;
+ FT_UInt cache_count;
+ FT_Byte cache_fd;
+
+ } CFF_FDSelectRec, *CFF_FDSelect;
+
+
+ /* A SubFont packs a font dict and a private dict together. They are */
+ /* needed to support CID-keyed CFF fonts. */
+ typedef struct CFF_SubFontRec_
+ {
+ CFF_FontRecDictRec font_dict;
+ CFF_PrivateRec private_dict;
+
+ CFF_IndexRec local_subrs_index;
+ FT_UInt num_local_subrs;
+ FT_Byte** local_subrs;
+
+ } CFF_SubFontRec, *CFF_SubFont;
+
+
+ /* maximum number of sub-fonts in a CID-keyed file */
+#define CFF_MAX_CID_FONTS 16
+
+
+ typedef struct CFF_FontRec_
+ {
+ FT_Stream stream;
+ FT_Memory memory;
+ FT_UInt num_faces;
+ FT_UInt num_glyphs;
+
+ FT_Byte version_major;
+ FT_Byte version_minor;
+ FT_Byte header_size;
+ FT_Byte absolute_offsize;
+
+
+ CFF_IndexRec name_index;
+ CFF_IndexRec top_dict_index;
+ CFF_IndexRec string_index;
+ CFF_IndexRec global_subrs_index;
+
+ CFF_EncodingRec encoding;
+ CFF_CharsetRec charset;
+
+ CFF_IndexRec charstrings_index;
+ CFF_IndexRec font_dict_index;
+ CFF_IndexRec private_index;
+ CFF_IndexRec local_subrs_index;
+
+ FT_String* font_name;
+ FT_UInt num_global_subrs;
+ FT_Byte** global_subrs;
+
+ CFF_SubFontRec top_font;
+ FT_UInt num_subfonts;
+ CFF_SubFont subfonts[CFF_MAX_CID_FONTS];
+
+ CFF_FDSelectRec fd_select;
+
+ /* interface to PostScript hinter */
+ void* pshinter;
+
+ /* interface to Postscript Names service */
+ void* psnames;
+
+ } CFF_FontRec, *CFF_Font;
+
+
+FT_END_HEADER
+
+#endif /* __CFFTYPES_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/fnttypes.h b/include/freetype/internal/fnttypes.h
new file mode 100644
index 00000000..54e37ec4
--- /dev/null
+++ b/include/freetype/internal/fnttypes.h
@@ -0,0 +1,155 @@
+/***************************************************************************/
+/* */
+/* fnttypes.h */
+/* */
+/* Basic Windows FNT/FON type definitions and interface (specification */
+/* only). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __FNTTYPES_H__
+#define __FNTTYPES_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ typedef struct WinMZ_HeaderRec_
+ {
+ FT_UShort magic;
+ /* skipped content */
+ FT_UShort lfanew;
+
+ } WinMZ_HeaderRec;
+
+
+ typedef struct WinNE_HeaderRec_
+ {
+ FT_UShort magic;
+ /* skipped content */
+ FT_UShort resource_tab_offset;
+ FT_UShort rname_tab_offset;
+
+ } WinNE_HeaderRec;
+
+
+ typedef struct WinNameInfoRec_
+ {
+ FT_UShort offset;
+ FT_UShort length;
+ FT_UShort flags;
+ FT_UShort id;
+ FT_UShort handle;
+ FT_UShort usage;
+
+ } WinNameInfoRec;
+
+
+ typedef struct WinResourceInfoRec_
+ {
+ FT_UShort type_id;
+ FT_UShort count;
+
+ } WinResourceInfoRec;
+
+
+#define WINFNT_MZ_MAGIC 0x5A4D
+#define WINFNT_NE_MAGIC 0x454E
+
+
+ typedef struct WinFNT_HeaderRec_
+ {
+ FT_UShort version;
+ FT_ULong file_size;
+ FT_Byte copyright[60];
+ FT_UShort file_type;
+ FT_UShort nominal_point_size;
+ FT_UShort vertical_resolution;
+ FT_UShort horizontal_resolution;
+ FT_UShort ascent;
+ FT_UShort internal_leading;
+ FT_UShort external_leading;
+ FT_Byte italic;
+ FT_Byte underline;
+ FT_Byte strike_out;
+ FT_UShort weight;
+ FT_Byte charset;
+ FT_UShort pixel_width;
+ FT_UShort pixel_height;
+ FT_Byte pitch_and_family;
+ FT_UShort avg_width;
+ FT_UShort max_width;
+ FT_Byte first_char;
+ FT_Byte last_char;
+ FT_Byte default_char;
+ FT_Byte break_char;
+ FT_UShort bytes_per_row;
+ FT_ULong device_offset;
+ FT_ULong face_name_offset;
+ FT_ULong bits_pointer;
+ FT_ULong bits_offset;
+ FT_Byte reserved;
+ FT_ULong flags;
+ FT_UShort A_space;
+ FT_UShort B_space;
+ FT_UShort C_space;
+ FT_UShort color_table_offset;
+ FT_Byte reserved2[4];
+
+ } WinFNT_HeaderRec, *WinFNT_Header;
+
+
+ typedef struct FNT_FontRec_
+ {
+ FT_ULong offset;
+ FT_Int size_shift;
+
+ WinFNT_HeaderRec header;
+
+ FT_Byte* fnt_frame;
+ FT_ULong fnt_size;
+
+ } FNT_FontRec, *FNT_Font;
+
+
+ typedef struct FNT_SizeRec_
+ {
+ FT_SizeRec root;
+ FNT_Font font;
+
+ } FNT_SizeRec, *FNT_Size;
+
+
+ typedef struct FNT_FaceRec_
+ {
+ FT_FaceRec root;
+
+ FT_UInt num_fonts;
+ FNT_Font fonts;
+
+ FT_CharMap charmap_handle;
+ FT_CharMapRec charmap; /* a single charmap per face */
+
+ } FNT_FaceRec, *FNT_Face;
+
+
+FT_END_HEADER
+
+#endif /* __FNTTYPES_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h
new file mode 100644
index 00000000..af1f6407
--- /dev/null
+++ b/include/freetype/internal/ftcalc.h
@@ -0,0 +1,77 @@
+/***************************************************************************/
+/* */
+/* ftcalc.h */
+/* */
+/* Arithmetic computations (specification). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __FTCALC_H__
+#define __FTCALC_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x );
+
+
+#define SQRT_32( x ) FT_Sqrt32( x )
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Sqrt32 */
+ /* */
+ /* <Description> */
+ /* Computes the square root of an Int32 integer (which will be */
+ /* handled as an unsigned long value). */
+ /* */
+ /* <Input> */
+ /* x :: The value to compute the root for. */
+ /* */
+ /* <Return> */
+ /* The result of `sqrt(x)'. */
+ /* */
+ FT_EXPORT( FT_Int32 )
+ FT_Sqrt32( FT_Int32 x );
+
+
+ /*************************************************************************/
+ /* */
+ /* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */
+ /* */
+ /*************************************************************************/
+
+
+#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
+#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
+#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )
+#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 )
+#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) )
+
+#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
+ : ( -( ( 32 - (x) ) & -64 ) ) )
+
+
+FT_END_HEADER
+
+#endif /* __FTCALC_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/ftcore.h b/include/freetype/internal/ftcore.h
new file mode 100644
index 00000000..3c3c94ff
--- /dev/null
+++ b/include/freetype/internal/ftcore.h
@@ -0,0 +1,185 @@
+#ifndef __FT_CORE_H__
+#define __FT_CORE_H__
+
+#include <ft2build.h>
+#include FT_TYPES_H
+#include FT_SYSTEM_MEMORY_H
+
+FT_BEGIN_HEADER
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /***** *****/
+ /***** C L E A N U P S T A C K *****/
+ /***** *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+
+ /************************************************************************
+ *
+ * @functype: FT_CleanupFunc
+ *
+ * @description:
+ * a function used to cleanup a given item on the cleanup stack
+ *
+ * @input:
+ * item :: target item pointer
+ * item_data :: optional argument to cleanup routine
+ */
+ typedef void (*FT_CleanupFunc)( FT_Pointer item,
+ FT_Pointer item_data );
+
+
+
+ /************************************************************************
+ *
+ * @type: FT_XHandler
+ *
+ * @description:
+ * handle to an exception-handler structure for the FreeType
+ * exception sub-system
+ *
+ * @note:
+ * exception handlers are allocated on the stack within a
+ * @FT_XTRY macro. Do not try to access them directly.
+ */
+ typedef struct FT_XHandlerRec_* FT_XHandler;
+
+
+/* the size of a cleanup chunk in bytes is FT_CLEANUP_CHUNK_SIZE*12 + 4 */
+/* this must be a small power of 2 whenever possible.. */
+/* */
+/* with a value of 5, we have a byte size of 64 bytes per chunk.. */
+/* */
+#define FT_CLEANUP_CHUNK_SIZE 5
+
+
+
+ typedef struct FT_CleanupItemRec_
+ {
+ FT_Pointer item;
+ FT_CleanupFunc item_func;
+ FT_Pointer item_data;
+
+ } FT_CleanupItemRec;
+
+
+ typedef struct FT_CleanupChunkRec_* FT_CleanupChunk;
+
+ typedef struct FT_CleanupChunkRec_
+ {
+ FT_CleanupChunk link;
+ FT_CleanupItemRec items[ FT_CLEANUP_CHUNK_SIZE ];
+
+ } FT_CleanupChunkRec;
+
+
+ typedef struct FT_CleanupStackRec_
+ {
+ FT_CleanupItem top;
+ FT_CleanupItem limit;
+ FT_CleanupChunk chunk;
+ FT_CleanupChunkRec chunk_0; /* avoids stupid dynamic allocation */
+ FT_Memory memory;
+
+ } FT_CleanupStackRec, *FT_CleanupStack;
+
+
+ FT_BASE( void )
+ ft_cleanup_stack_push( FT_CleanupStack stack,
+ FT_Pointer item,
+ FT_CleanupFunc item_func,
+ FT_Pointer item_data );
+
+ FT_BASE( void )
+ ft_cleanup_stack_pop( FT_CleanupStack stack,
+ FT_Int destroy );
+
+ FT_BASE( FT_CleanupItem )
+ ft_cleanup_stack_peek( FT_CleanupStack stack );
+
+ FT_BASE( void )
+ ft_cleanup_throw( FT_CleanupStack stack,
+ FT_Error error );
+
+
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /***** *****/
+ /***** M E M O R Y M A N A G E R *****/
+ /***** *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+ typedef struct FT_MemoryRec_
+ {
+ FT_Memory_AllocFunc mem_alloc; /* shortcut to funcs->mem_alloc */
+ FT_Memory_FreeFunc mem_free; /* shortcut to funcs->mem_free */
+ FT_Pointer mem_data;
+ const FT_Memory_Funcs mem_funcs;
+
+ FT_CleanupStackRec cleanup_stack;
+ FT_Pointer meta_class;
+
+ } FT_MemoryRec;
+
+
+#define FT_MEMORY(x) ((FT_Memory)(x))
+#define FT_MEMORY__ALLOC(x) FT_MEMORY(x)->mem_alloc
+#define FT_MEMORY__FREE(x) FT_MEMORY(x)->mem_free
+#define FT_MEMORY__REALLOC(x) FT_MEMORY(x)->mem_funcs->mem_realloc
+#define FT_MEMORY__CLEANUP(x) (&FT_MEMORY(x)->cleanup_stack)
+#define FT_MEMORY__META_CLASS(x) ((FT_MetaClass)(FT_MEMORY(x)->meta_class))
+
+
+ /**************************************************************************/
+ /**************************************************************************/
+ /***** *****/
+ /***** E X C E P T I O N H A N D L I N G *****/
+ /***** *****/
+ /**************************************************************************/
+ /**************************************************************************/
+
+
+ /************************************************************************
+ *
+ * @struct: FT_XHandlerRec
+ *
+ * @description:
+ * exception handler structure
+ *
+ * @fields:
+ * previous :: previous handler in chain.
+ * jum_buffer :: processor state used by setjmp/longjmp to implement
+ * exception control transfer
+ * error :: exception error code
+ * mark :: top of cleanup stack when @FT_XTRY is used
+ */
+ typedef struct FT_XHandlerRec_
+ {
+ FT_XHandler previous;
+ ft_jmp_buf jump_buffer;
+ volatile FT_Error error;
+ FT_Pointer mark;
+
+ } FT_XHandlerRec;
+
+ FT_BASE( void )
+ ft_xhandler_enter( FT_XHandler xhandler,
+ FT_Memory memory );
+
+ FT_BASE( void )
+ ft_xhandler_exit( FT_XHandler xhandler );
+
+
+
+
+
+
+
+
+FT_END_HEADER
+
+#endif /* __FT_CORE_H__ */
diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h
new file mode 100644
index 00000000..129c91f6
--- /dev/null
+++ b/include/freetype/internal/ftdebug.h
@@ -0,0 +1,196 @@
+/***************************************************************************/
+/* */
+/* ftdebug.h */
+/* */
+/* Debugging and logging component (specification). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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. */
+/* */
+/* */
+/* IMPORTANT: A description of FreeType's debugging support can be */
+/* found in "docs/DEBUG.TXT". Read it if you need to use or */
+/* understand this code. */
+/* */
+/***************************************************************************/
+
+
+#ifndef __FTDEBUG_H__
+#define __FTDEBUG_H__
+
+
+#include <ft2build.h>
+#include FT_CONFIG_CONFIG_H
+
+
+FT_BEGIN_HEADER
+
+
+ /* force the definition of FT_DEBUG_LEVEL_ERROR if FT_DEBUG_LEVEL_TRACE */
+ /* is already defined; this simplifies the following #ifdefs */
+ /* */
+#ifdef FT_DEBUG_LEVEL_TRACE
+#undef FT_DEBUG_LEVEL_ERROR
+#define FT_DEBUG_LEVEL_ERROR
+#endif
+
+
+ /*************************************************************************/
+ /* */
+ /* Define the trace enums as well as the trace levels array when they */
+ /* are needed. */
+ /* */
+ /*************************************************************************/
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+#define FT_TRACE_DEF( x ) trace_ ## x ,
+
+ /* defining the enumeration */
+ typedef enum
+ {
+#include FT_INTERNAL_TRACE_H
+ trace_count
+
+ } FT_Trace;
+
+
+ /* defining the array of trace levels, provided by `src/base/ftdebug.c' */
+ extern int ft_trace_levels[trace_count];
+
+#undef FT_TRACE_DEF
+
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
+
+ /*************************************************************************/
+ /* */
+ /* Define the FT_TRACE macro */
+ /* */
+ /* IMPORTANT! */
+ /* */
+ /* Each component must define the macro FT_COMPONENT to a valid FT_Trace */
+ /* value before using any TRACE macro. */
+ /* */
+ /*************************************************************************/
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+#define FT_TRACE( level, varformat ) \
+ do \
+ { \
+ if ( ft_trace_levels[FT_COMPONENT] >= level ) \
+ FT_Message varformat; \
+ } while ( 0 )
+
+#else /* !FT_DEBUG_LEVEL_TRACE */
+
+#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
+
+#endif /* !FT_DEBUG_LEVEL_TRACE */
+
+
+ /*************************************************************************/
+ /* */
+ /* You need two opening resp. closing parentheses! */
+ /* */
+ /* Example: FT_TRACE0(( "Value is %i", foo )) */
+ /* */
+ /*************************************************************************/
+
+#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat )
+#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat )
+#define FT_TRACE2( varformat ) FT_TRACE( 2, varformat )
+#define FT_TRACE3( varformat ) FT_TRACE( 3, varformat )
+#define FT_TRACE4( varformat ) FT_TRACE( 4, varformat )
+#define FT_TRACE5( varformat ) FT_TRACE( 5, varformat )
+#define FT_TRACE6( varformat ) FT_TRACE( 6, varformat )
+#define FT_TRACE7( varformat ) FT_TRACE( 7, varformat )
+
+
+ /*************************************************************************/
+ /* */
+ /* Define the FT_ERROR macro */
+ /* */
+ /*************************************************************************/
+
+#ifdef FT_DEBUG_LEVEL_ERROR
+
+#define FT_ERROR( varformat ) FT_Message varformat
+
+#else /* !FT_DEBUG_LEVEL_ERROR */
+
+#define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */
+
+#endif /* !FT_DEBUG_LEVEL_ERROR */
+
+
+ /*************************************************************************/
+ /* */
+ /* Define the FT_ASSERT macro */
+ /* */
+ /*************************************************************************/
+
+#ifdef FT_DEBUG_LEVEL_ERROR
+
+#define FT_ASSERT( condition ) \
+ do \
+ { \
+ if ( !( condition ) ) \
+ FT_Panic( "assertion failed on line %d of file %s\n", \
+ __LINE__, __FILE__ ); \
+ } while ( 0 )
+
+#else /* !FT_DEBUG_LEVEL_ERROR */
+
+#define FT_ASSERT( condition ) do ; while ( 0 )
+
+#endif /* !FT_DEBUG_LEVEL_ERROR */
+
+
+ /*************************************************************************/
+ /* */
+ /* Define 'FT_Message' and 'FT_Panic' when needed */
+ /* */
+ /*************************************************************************/
+
+#ifdef FT_DEBUG_LEVEL_ERROR
+
+#include "stdio.h" /* for vprintf() */
+
+ /* print a message */
+ FT_EXPORT( void )
+ FT_Message( const char* fmt, ... );
+
+ /* print a message and exit */
+ FT_EXPORT( void )
+ FT_Panic( const char* fmt, ... );
+
+#endif /* FT_DEBUG_LEVEL_ERROR */
+
+
+ FT_BASE( void )
+ ft_debug_init( void );
+
+
+#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
+
+ /* we disable the warning `conditional expression is constant' here */
+ /* in order to compile cleanly with the maximum level of warnings */
+#pragma warning( disable : 4127 )
+
+#endif /* _MSC_VER */
+
+
+FT_END_HEADER
+
+#endif /* __FTDEBUG_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/ftdriver.h b/include/freetype/internal/ftdriver.h
new file mode 100644
index 00000000..9323910b
--- /dev/null
+++ b/include/freetype/internal/ftdriver.h
@@ -0,0 +1,202 @@
+/***************************************************************************/
+/* */
+/* ftdriver.h */
+/* */
+/* FreeType font driver interface (specification). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __FTDRIVER_H__
+#define __FTDRIVER_H__
+
+
+#include <ft2build.h>
+#include FT_MODULE_H
+
+
+FT_BEGIN_HEADER
+
+
+ typedef FT_Error
+ (*FT_Face_InitFunc)( FT_Stream stream,
+ FT_Face face,
+ FT_Int typeface_index,
+ FT_Int num_params,
+ FT_Parameter* parameters );
+
+ typedef void
+ (*FT_Face_DoneFunc)( FT_Face face );
+
+
+ typedef FT_Error
+ (*FT_Size_InitFunc)( FT_Size size );
+
+ typedef void
+ (*FT_Size_DoneFunc)( FT_Size size );
+
+
+ typedef FT_Error
+ (*FT_Slot_InitFunc)( FT_GlyphSlot slot );
+
+ typedef void
+ (*FT_Slot_DoneFunc)( FT_GlyphSlot slot );
+
+
+ typedef FT_Error
+ (*FT_Size_ResetPointsFunc)( FT_Size size,
+ FT_F26Dot6 char_width,
+ FT_F26Dot6 char_height,
+ FT_UInt horz_resolution,
+ FT_UInt vert_resolution );
+
+ typedef FT_Error
+ (*FT_Size_ResetPixelsFunc)( FT_Size size,
+ FT_UInt pixel_width,
+ FT_UInt pixel_height );
+
+ typedef FT_Error
+ (*FT_Slot_LoadFunc)( FT_GlyphSlot slot,
+ FT_Size size,
+ FT_UInt glyph_index,
+ FT_Int32 load_flags );
+
+
+ typedef FT_UInt
+ (*FT_CharMap_CharIndexFunc)( FT_CharMap charmap,
+ FT_Long charcode );
+
+ typedef FT_Long
+ (*FT_CharMap_CharNextFunc)( FT_CharMap charmap,
+ FT_Long charcode );
+
+ typedef FT_Error
+ (*FT_Face_GetKerningFunc)( FT_Face face,
+ FT_UInt left_glyph,
+ FT_UInt right_glyph,
+ FT_Vector* kerning );
+
+
+ typedef FT_Error
+ (*FT_Face_AttachFunc)( FT_Face face,
+ FT_Stream stream );
+
+
+ typedef FT_Error
+ (*FT_Face_GetAdvancesFunc)( FT_Face face,
+ FT_UInt first,
+ FT_UInt count,
+ FT_Bool vertical,
+ FT_UShort* advances );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_Driver_ClassRec */
+ /* */
+ /* <Description> */
+ /* The font driver class. This structure mostly contains pointers to */
+ /* driver methods. */
+ /* */
+ /* <Fields> */
+ /* root :: The parent module. */
+ /* */
+ /* face_object_size :: The size of a face object in bytes. */
+ /* */
+ /* size_object_size :: The size of a size object in bytes. */
+ /* */
+ /* slot_object_size :: The size of a glyph object in bytes. */
+ /* */
+ /* init_face :: The format-specific face constructor. */
+ /* */
+ /* done_face :: The format-specific face destructor. */
+ /* */
+ /* init_size :: The format-specific size constructor. */
+ /* */
+ /* done_size :: The format-specific size destructor. */
+ /* */
+ /* init_slot :: The format-specific slot constructor. */
+ /* */
+ /* done_slot :: The format-specific slot destructor. */
+ /* */
+ /* set_char_sizes :: A handle to a function used to set the new */
+ /* character size in points + resolution. Can be */
+ /* set to 0 to indicate default behaviour. */
+ /* */
+ /* set_pixel_sizes :: A handle to a function used to set the new */
+ /* character size in pixels. Can be set to 0 to */
+ /* indicate default behaviour. */
+ /* */
+ /* load_glyph :: A function handle to load a given glyph image */
+ /* in a slot. This field is mandatory! */
+ /* */
+ /* get_char_index :: A function handle to return the glyph index of */
+ /* a given character for a given charmap. This */
+ /* field is mandatory! */
+ /* */
+ /* get_kerning :: A function handle to return the unscaled */
+ /* kerning for a given pair of glyphs. Can be */
+ /* set to 0 if the format doesn't support */
+ /* kerning. */
+ /* */
+ /* attach_file :: This function handle is used to read */
+ /* additional data for a face from another */
+ /* file/stream. For example, this can be used to */
+ /* add data from AFM or PFM files on a Type 1 */
+ /* face, or a CIDMap on a CID-keyed face. */
+ /* */
+ /* get_advances :: A function handle used to return the advances */
+ /* of 'count' glyphs, starting at `index'. the */
+ /* `vertical' flags must be set when vertical */
+ /* advances are queried. The advances buffer is */
+ /* caller-allocated. */
+ /* */
+ /* <Note> */
+ /* Most function pointers, with the exception of `load_glyph' and */
+ /* `get_char_index' can be set to 0 to indicate a default behaviour. */
+ /* */
+ typedef struct FT_Driver_ClassRec_
+ {
+ FT_Module_Class root;
+
+ FT_Int face_object_size;
+ FT_Int size_object_size;
+ FT_Int slot_object_size;
+
+ FT_Face_InitFunc init_face;
+ FT_Face_DoneFunc done_face;
+
+ FT_Size_InitFunc init_size;
+ FT_Size_DoneFunc done_size;
+
+ FT_Slot_InitFunc init_slot;
+ FT_Slot_DoneFunc done_slot;
+
+ FT_Size_ResetPointsFunc set_char_sizes;
+ FT_Size_ResetPixelsFunc set_pixel_sizes;
+
+ FT_Slot_LoadFunc load_glyph;
+
+ FT_Face_GetKerningFunc get_kerning;
+ FT_Face_AttachFunc attach_file;
+ FT_Face_GetAdvancesFunc get_advances;
+
+ } FT_Driver_ClassRec, *FT_Driver_Class;
+
+
+FT_END_HEADER
+
+#endif /* __FTDRIVER_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/ftexcept.h b/include/freetype/internal/ftexcept.h
new file mode 100644
index 00000000..f5495e56
--- /dev/null
+++ b/include/freetype/internal/ftexcept.h
@@ -0,0 +1,82 @@
+#ifndef __FT_EXCEPT_H__
+#define __FT_EXCEPT_H__
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+
+FT_BEGIN_HEADER
+
+
+
+ /* I can't find a better place for this for now */
+
+<<<<<<< ftexcept.h
+=======
+
+/* the size of a cleanup chunk in bytes is FT_CLEANUP_CHUNK_SIZE*12 + 4 */
+/* this must be a small power of 2 whenever possible.. */
+/* */
+/* with a value of 5, we have a byte size of 64 bytes per chunk.. */
+/* */
+#define FT_CLEANUP_CHUNK_SIZE 5
+
+
+
+ typedef struct FT_CleanupItemRec_
+ {
+ FT_Pointer item;
+ FT_CleanupFunc item_func;
+ FT_Pointer item_data;
+
+ } FT_CleanupItemRec;
+
+ typedef struct FT_CleanupChunkRec_* FT_CleanupChunk;
+
+ typedef struct FT_CleanupChunkRec_
+ {
+ FT_CleanupChunk link;
+ FT_CleanupItemRec items[ FT_CLEANUP_CHUNK_SIZE ];
+
+ } FT_CleanupChunkRec;
+
+
+ typedef struct FT_CleanupStackRec_
+ {
+ FT_CleanupItem top;
+ FT_CleanupItem limit;
+ FT_CleanupChunk chunk;
+ FT_CleanupChunkRec chunk_0; /* avoids stupid dynamic allocation */
+ FT_Memory memory;
+
+ } FT_CleanupStackRec, *FT_CleanupStack;
+
+
+ FT_BASE( void )
+ ft_cleanup_stack_push( FT_CleanupStack stack,
+ FT_Pointer item,
+ FT_CleanupFunc item_func,
+ FT_Pointer item_data );
+
+ FT_BASE( void )
+ ft_cleanup_stack_pop( FT_CleanupStack stack,
+ FT_Int destroy );
+
+ FT_BASE( FT_CleanupItem )
+ ft_cleanup_stack_peek( FT_CleanupStack stack );
+
+ FT_BASE( void )
+ ft_xhandler_enter( FT_XHandler xhandler,
+ FT_Memory memory );
+
+ FT_BASE( void )
+ ft_xhandler_exit( FT_XHandler xhandler );
+
+
+ FT_BASE( void )
+ ft_cleanup_throw( FT_CleanupStack stack,
+ FT_Error error );
+
+>>>>>>> 1.2
+FT_END_HEADER
+
+#endif /* __FT_EXCEPT_H__ */
diff --git a/include/freetype/internal/ftgloadr.h b/include/freetype/internal/ftgloadr.h
new file mode 100644
index 00000000..d66d10b1
--- /dev/null
+++ b/include/freetype/internal/ftgloadr.h
@@ -0,0 +1,153 @@
+/***************************************************************************/
+/* */
+/* ftgloadr.h */
+/* */
+/* The FreeType glyph loader (specification). */
+/* */
+/* Copyright 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg */
+/* */
+/* 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 __FTGLOADR_H__
+#define __FTGLOADR_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_GlyphLoader */
+ /* */
+ /* <Description> */
+ /* The glyph loader is an internal object used to load several glyphs */
+ /* together (for example, in the case of composites). */
+ /* */
+ /* <Note> */
+ /* The glyph loader implementation is not part of the high-level API, */
+ /* hence the forward structure declaration. */
+ /* */
+ typedef struct FT_GlyphLoaderRec_* FT_GlyphLoader ;
+
+
+#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
+#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
+#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
+#define FT_SUBGLYPH_FLAG_SCALE 8
+#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
+#define FT_SUBGLYPH_FLAG_2X2 0x80
+#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
+
+
+ enum
+ {
+ FT_GLYPH_OWN_BITMAP = 1
+ };
+
+
+ typedef struct FT_SubGlyphRec_
+ {
+ FT_Int index;
+ FT_UShort flags;
+ FT_Int arg1;
+ FT_Int arg2;
+ FT_Matrix transform;
+
+ } FT_SubGlyphRec;
+
+
+ typedef struct FT_GlyphLoadRec_
+ {
+ FT_Outline outline; /* outline */
+ FT_Vector* extra_points; /* extra points table */
+ FT_UInt num_subglyphs; /* number of subglyphs */
+ FT_SubGlyph subglyphs; /* subglyphs */
+
+ } FT_GlyphLoadRec, *FT_GlyphLoad;
+
+
+ typedef struct FT_GlyphLoaderRec_
+ {
+ FT_Memory memory;
+ FT_UInt max_points;
+ FT_UInt max_contours;
+ FT_UInt max_subglyphs;
+ FT_Bool use_extra;
+
+ FT_GlyphLoadRec base;
+ FT_GlyphLoadRec current;
+
+ void* other; /* for possible future extension? */
+
+ } FT_GlyphLoaderRec;
+
+
+ /* create new empty glyph loader */
+ FT_BASE( FT_Error )
+ FT_GlyphLoader_New( FT_Memory memory,
+ FT_GlyphLoader *aloader );
+
+ /* add an extra points table to a glyph loader */
+ FT_BASE( FT_Error )
+ FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader );
+
+ /* destroy a glyph loader */
+ FT_BASE( void )
+ FT_GlyphLoader_Done( FT_GlyphLoader loader );
+
+ /* reset a glyph loader (frees everything int it) */
+ FT_BASE( void )
+ FT_GlyphLoader_Reset( FT_GlyphLoader loader );
+
+ /* rewind a glyph loader */
+ FT_BASE( void )
+ FT_GlyphLoader_Rewind( FT_GlyphLoader loader );
+
+ /* check that there is enough room to add 'n_points' and 'n_contours' */
+ /* to the glyph loader */
+ FT_BASE( FT_Error )
+ FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
+ FT_UInt n_points,
+ FT_UInt n_contours );
+
+ /* check that there is enough room to add 'n_subs' sub-glyphs to */
+ /* a glyph loader */
+ FT_BASE( FT_Error )
+ FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
+ FT_UInt n_subs );
+
+ /* prepare a glyph loader, i.e. empty the current glyph */
+ FT_BASE( void )
+ FT_GlyphLoader_Prepare( FT_GlyphLoader loader );
+
+ /* add the current glyph to the base glyph */
+ FT_BASE( void )
+ FT_GlyphLoader_Add( FT_GlyphLoader loader );
+
+ /* copy points from one glyph loader to another */
+ FT_BASE( FT_Error )
+ FT_GlyphLoader_CopyPoints( FT_GlyphLoader target,
+ FT_GlyphLoader source );
+
+ /* */
+
+
+FT_END_HEADER
+
+#endif /* __FTGLOADR_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/fthash.h b/include/freetype/internal/fthash.h
new file mode 100644
index 00000000..b95b6c92
--- /dev/null
+++ b/include/freetype/internal/fthash.h
@@ -0,0 +1,502 @@
+/******************************************************************
+ *
+ * fthash.h - fast dynamic hash tables
+ *
+ * Copyright 2002 by
+ * David Turner, Robert Wilhelm, and Werner Lemberg
+ *
+ * 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.
+ *
+ *
+ * This header is used to define dynamic hash tables as described
+ * by the article "Main-Memory Linear Hashing - Some Enhancements
+ * of Larson's Algorithm" by Mikael Petterson.
+ *
+ * Basically, linear hashing prevents big "stalls" during
+ * resizes of the buckets array by only splitting one bucket
+ * at a time. This ensures excellent response time even when
+ * the table is frequently resized..
+ *
+ *
+ * Note that the use of the FT_Hash type is rather unusual in order
+ * to be as generic and efficient as possible. See the comments in the
+ * following definitions for more details.
+ */
+
+#ifndef __FT_HASH_H__
+#define __FT_HASH_H__
+
+#include <ft2build.h>
+#include FT_TYPES_H
+
+FT_BEGIN_HEADER
+
+ /***********************************************************
+ *
+ * @type: FT_Hash
+ *
+ * @description:
+ * handle to a @FT_HashRec structure used to model a
+ * dynamic hash table
+ */
+ typedef struct FT_HashRec_* FT_Hash;
+
+
+ /***********************************************************
+ *
+ * @type: FT_HashNode
+ *
+ * @description:
+ * handle to a @FT_HashNodeRec structure used to model a
+ * single node of a hash table
+ */
+ typedef struct FT_HashNodeRec_* FT_HashNode;
+
+
+ /***********************************************************
+ *
+ * @type: FT_HashLookup
+ *
+ * @description:
+ * handle to a @FT_HashNode pointer. This is returned by
+ * the @ft_hash_lookup function and can later be used by
+ * @ft_hash_add or @ft_hash_remove
+ */
+ typedef FT_HashNode* FT_HashLookup;
+
+
+ /***********************************************************
+ *
+ * @type: FT_Hash_EqualFunc
+ *
+ * @description:
+ * a function used to compare two nodes of the hash table
+ *
+ * @input:
+ * node1 :: handle to first node
+ * node2 :: handle to second node
+ *
+ * @return:
+ * 1 iff the 'keys' in 'node1' and 'node2' are identical.
+ * 0 otherwise.
+ */
+ typedef FT_Int (*FT_Hash_EqualFunc)( FT_HashNode node1,
+ FT_HashNode node2 );
+
+
+ /***********************************************************
+ *
+ * @struct: FT_HashRec
+ *
+ * @description:
+ * a structure used to model a dynamic hash table.
+ *
+ * @fields:
+ * memory :: memory manager used to allocate
+ * the buckets array and the hash nodes
+ *
+ * buckets :: array of hash buckets
+ *
+ * node_size :: size of node in bytes
+ * node_compare :: a function used to compare two nodes
+ * node_hash :: a function used to compute the hash
+ * value of a given node
+ * p ::
+ * mask ::
+ * slack ::
+ *
+ * @note:
+ * 'p', 'mask' and 'slack' are control values managed by
+ * the hash table. Do not try to interpret them directly.
+ *
+ * You can grab the hash table size by calling
+ * '@ft_hash_get_size'.
+ */
+ typedef struct FT_HashRec_
+ {
+ FT_HashNode* buckets;
+ FT_UInt p;
+ FT_UInt mask; /* really maxp-1 */
+ FT_Long slack;
+ FT_Hash_EqualFunc node_equal;
+ FT_Memory memory;
+
+ } FT_HashRec;
+
+
+ /***********************************************************
+ *
+ * @struct: FT_HashNodeRec
+ *
+ * @description:
+ * a structure used to model the root fields of a dynamic
+ * hash table node.
+ *
+ * it's up to client applications to "sub-class" this
+ * structure to add relevant (key,value) definitions
+ *
+ * @fields:
+ * link :: pointer to next node in bucket's collision list
+ * hash :: 32-bit hash value for this node
+ *
+ * @note:
+ * it's up to client applications to "sub-class" this structure
+ * to add relevant (key,value) type definitions. For example,
+ * if we want to build a "string -> int" mapping, we could use
+ * something like:
+ *
+ * {
+ * typedef struct MyNodeRec_
+ * {
+ * FT_HashNodeRec hnode;
+ * const char* key;
+ * int value;
+ *
+ * } MyNodeRec, *MyNode;
+ * }
+ *
+ */
+ typedef struct FT_HashNodeRec_
+ {
+ FT_HashNode link;
+ FT_UInt32 hash;
+
+ } FT_HashNodeRec;
+
+
+ /****************************************************************
+ *
+ * @function: ft_hash_init
+ *
+ * @description:
+ * initialize a dynamic hash table
+ *
+ * @input:
+ * table :: handle to target hash table structure
+ * node_equal :: node comparison function
+ * memory :: memory manager handle used to allocate the
+ * buckets array within the hash table
+ *
+ * @return:
+ * error code. 0 means success
+ *
+ * @note:
+ * the node comparison function should only compare node _keys_
+ * and ignore values !! with good hashing computation (which the
+ * user must perform itself), the comparison function should be
+ * pretty seldom called.
+ *
+ * here is a simple example:
+ *
+ * {
+ * static int my_equal( MyNode node1,
+ * MyNode node2 )
+ * {
+ * // compare keys of 'node1' and 'node2'
+ * return (strcmp( node1->key, node2->key ) == 0);
+ * }
+ *
+ * ....
+ *
+ * ft_hash_init( &hash, (FT_Hash_EqualFunc) my_compare, memory );
+ * ....
+ * }
+ */
+ FT_BASE( FT_Error )
+ ft_hash_init( FT_Hash table,
+ FT_Hash_EqualFunc compare,
+ FT_Memory memory );
+
+
+ /****************************************************************
+ *
+ * @function: ft_hash_lookup
+ *
+ * @description:
+ * search a hash table to find a node corresponding to a given
+ * key.
+ *
+ * @input:
+ * table :: handle to target hash table structure
+ * keynode :: handle to a reference hash node that will be
+ * only used for key comparisons with the table's
+ * elements
+ *
+ * @return:
+ * a pointer-to-hash-node value, which must be used as followed:
+ *
+ * - if '*result' is NULL, the key wasn't found in the hash
+ * table. The value of 'result' can be used to add new elements
+ * through @ft_hash_add however..
+ *
+ * - if '*result' is not NULL, it's a handle to the first table
+ * node that corresponds to the search key. The value of 'result'
+ * can be used to remove this element through @ft_hash_remove
+ *
+ * @note:
+ * here is an example:
+ *
+ * {
+ * // maps a string to an integer with a hash table
+ * // returns -1 in case of failure
+ * //
+ * int my_lookup( FT_Hash table,
+ * const char* key )
+ * {
+ * MyNode* pnode;
+ * MyNodeRec noderec;
+ *
+ * // set-up key node. It's 'hash' and 'key' fields must
+ * // be set correctly.. we ignore 'link' and 'value'
+ * //
+ * noderec.hnode.hash = strhash( key );
+ * noderec.key = key;
+ *
+ * // perform search - return value
+ * //
+ * pnode = (MyNode) ft_hash_lookup( table, &noderec );
+ * if ( *pnode )
+ * {
+ * // we found it
+ * return (*pnode)->value;
+ * }
+ * return -1;
+ * }
+ * }
+ */
+ FT_BASE_DEF( FT_HashLookup )
+ ft_hash_lookup( FT_Hash table,
+ FT_HashNode keynode );
+
+
+ /****************************************************************
+ *
+ * @function: ft_hash_add
+ *
+ * @description:
+ * add a new node to a dynamic hash table. the user must
+ * call @ft_hash_lookup and allocate a new node before calling
+ * this function.
+ *
+ * @input:
+ * table :: hash table handle
+ * lookup :: pointer-to-hash-node value returned by @ft_hash_lookup
+ * new_node :: handle to new hash node. All its fields must be correctly
+ * set, including 'hash'.
+ *
+ * @return:
+ * error code. 0 means success
+ *
+ * @note:
+ * this function should always be used _after_ a call to @ft_hash_lookup
+ * that returns a pointer to a NULL handle. Here's an example:
+ *
+ * {
+ * // sets the value corresponding to a given string key
+ * //
+ * void my_set( FT_Hash table,
+ * const char* key,
+ * int value )
+ * {
+ * MyNode* pnode;
+ * MyNodeRec noderec;
+ * MyNode node;
+ *
+ * // set-up key node. It's 'hash' and 'key' fields must
+ * // be set correctly..
+ * noderec.hnode.hash = strhash( key );
+ * noderec.key = key;
+ *
+ * // perform search - return value
+ * pnode = (MyNode) ft_hash_lookup( table, &noderec );
+ * if ( *pnode )
+ * {
+ * // we found it, simply replace the value in the node
+ * (*pnode)->value = value;
+ * return;
+ * }
+ *
+ * // allocate a new node - and set it up
+ * node = (MyNode) malloc( sizeof(*node) );
+ * if ( node == NULL ) .....
+ *
+ * node->hnode.hash = noderec.hnode.hash;
+ * node->key = key;
+ * node->value = value;
+ *
+ * // add it to the hash table
+ * error = ft_hash_add( table, pnode, node );
+ * if (error) ....
+ * }
+ */
+ FT_BASE( FT_Error )
+ ft_hash_add( FT_Hash table,
+ FT_HashLookup lookup,
+ FT_HashNode new_node );
+
+
+ /****************************************************************
+ *
+ * @function: ft_hash_remove
+ *
+ * @description:
+ * try to remove the node corresponding to a given key from
+ * a hash table. This must be called after @ft_hash_lookup
+ *
+ * @input:
+ * table :: hash table handle
+ * lookup :: pointer-to-hash-node value returned by @ft_hash_lookup
+ *
+ * @note:
+ * this function doesn't free the node itself !! Here's an example:
+ *
+ * {
+ * // sets the value corresponding to a given string key
+ * //
+ * void my_remove( FT_Hash table,
+ * const char* key )
+ * {
+ * MyNodeRec noderec;
+ * MyNode node;
+ *
+ * noderec.hnode.hash = strhash(key);
+ * noderec.key = key;
+ * node = &noderec;
+ *
+ * pnode = ft_hash_lookup( table, &noderec );
+ * node = *pnode;
+ * if ( node != NULL )
+ * {
+ * error = ft_hash_remove( table, pnode );
+ * if ( !error )
+ * free( node );
+ * }
+ * }
+ * }
+ */
+ FT_BASE( FT_Error )
+ ft_hash_remove( FT_Hash table,
+ FT_HashLookup lookup );
+
+
+
+ /****************************************************************
+ *
+ * @function: ft_hash_get_size
+ *
+ * @description:
+ * return the number of elements in a given hash table
+ *
+ * @input:
+ * table :: handle to target hash table structure
+ *
+ * @return:
+ * number of elements. 0 if empty
+ */
+ FT_BASE( FT_UInt )
+ ft_hash_get_size( FT_Hash table );
+
+
+
+ /****************************************************************
+ *
+ * @functype: FT_Hash_ForeachFunc
+ *
+ * @description:
+ * a function used to iterate over all elements of a given
+ * hash table
+ *
+ * @input:
+ * node :: handle to target @FT_HashNodeRec node structure
+ * data :: optional argument to iteration routine
+ *
+ * @also: @ft_hash_foreach
+ */
+ typedef void (*FT_Hash_ForeachFunc)( const FT_HashNode node,
+ const FT_Pointer data );
+
+
+ /****************************************************************
+ *
+ * @function: ft_hash_foreach
+ *
+ * @description:
+ * parse over all elements in a hash table
+ *
+ * @input:
+ * table :: handle to target hash table structure
+ * foreach_func :: iteration routine called for each element
+ * foreach_data :: optional argument to the iteration routine
+ *
+ * @note:
+ * this function is often used to release all elements from a
+ * hash table. See the example given for @ft_hash_done
+ */
+ FT_BASE( void )
+ ft_hash_foreach( FT_Hash table,
+ FT_Hash_ForeachFunc foreach_func,
+ const FT_Pointer foreach_data );
+
+
+
+ /****************************************************************
+ *
+ * @function: ft_hash_done
+ *
+ * @description:
+ * finalize a given hash table
+ *
+ * @input:
+ * table :: handle to target hash table structure
+ * node_func :: optional iteration function pointer. this
+ * can be used to destroy all nodes explicitely
+ * node_data :: optional argument to the node iterator
+ *
+ * @note:
+ * this function simply frees the hash table's buckets.
+ * you probably will need to call @ft_hash_foreach to
+ * destroy all its elements before @ft_hash_done, as in
+ * the following example:
+ *
+ * {
+ * static void my_node_clear( const MyNode node )
+ * {
+ * free( node );
+ * }
+ *
+ * static void my_done( FT_Hash table )
+ * {
+ * ft_hash_done( table, (FT_Hash_ForeachFunc) my_node_clear, NULL );
+ * }
+ * }
+ */
+ FT_BASE( void )
+ ft_hash_done( FT_Hash table,
+ FT_Hash_ForeachFunc item_func,
+ const FT_Pointer item_data );
+
+ /* */
+
+ /* compute bucket index from hash value in a dynamic hash table */
+ /* this is only used to break encapsulation to speed lookups in */
+ /* the FreeType cache manager !! */
+ /* */
+
+#define FT_HASH_COMPUTE_INDEX(_table,_hash,_index) \
+ { \
+ FT_UInt _mask = (_table)->mask; \
+ FT_UInt _hash0 = (_hash); \
+ \
+ (_index) = (FT_UInt)( (_hash0) & _mask ) ); \
+ if ( (_index) < (_table)->p ) \
+ (_index) = (FT_uInt)( (_hash0) & ( 2*_mask+1 ) ); \
+ }
+
+
+FT_END_HEADER
+
+#endif /* __FT_HASH_H__ */
diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
new file mode 100644
index 00000000..cbe66d7f
--- /dev/null
+++ b/include/freetype/internal/ftmemory.h
@@ -0,0 +1,296 @@
+/***************************************************************************/
+/* */
+/* ftmemory.h */
+/* */
+/* The FreeType memory management macros (specification). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg */
+/* */
+/* 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 __FTMEMORY_H__
+#define __FTMEMORY_H__
+
+
+#include <ft2build.h>
+#include FT_CONFIG_CONFIG_H
+#include FT_TYPES_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /* */
+ /* <Macro> */
+ /* FT_SET_ERROR */
+ /* */
+ /* <Description> */
+ /* This macro is used to set an implicit `error' variable to a given */
+ /* expression's value (usually a function call), and convert it to a */
+ /* boolean which is set whenever the value is != 0. */
+ /* */
+#undef FT_SET_ERROR
+#define FT_SET_ERROR( expression ) \
+ ( ( error = (expression) ) != 0 )
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** M E M O R Y ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+#ifdef FT_DEBUG_MEMORY
+
+ FT_BASE( FT_Error )
+ FT_Alloc_Debug( FT_Memory memory,
+ FT_Long size,
+ void* *P,
+ const char* file_name,
+ FT_Long line_no );
+
+ FT_BASE( FT_Error )
+ FT_Realloc_Debug( FT_Memory memory,
+ FT_Long current,
+ FT_Long size,
+ void* *P,
+ const char* file_name,
+ FT_Long line_no );
+
+ FT_BASE( void )
+ FT_Free_Debug( FT_Memory memory,
+ FT_Pointer block,
+ const char* file_name,
+ FT_Long line_no );
+
+#endif
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Alloc */
+ /* */
+ /* <Description> */
+ /* Allocates a new block of memory. The returned area is always */
+ /* zero-filled; this is a strong convention in many FreeType parts. */
+ /* */
+ /* <Input> */
+ /* memory :: A handle to a given `memory object' which handles */
+ /* allocation. */
+ /* */
+ /* size :: The size in bytes of the block to allocate. */
+ /* */
+ /* <Output> */
+ /* P :: A pointer to the fresh new block. It should be set to */
+ /* NULL if `size' is 0, or in case of error. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ FT_BASE( FT_Error )
+ FT_Alloc( FT_Memory memory,
+ FT_Long size,
+ void* *P );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Realloc */
+ /* */
+ /* <Description> */
+ /* Reallocates a block of memory pointed to by `*P' to `Size' bytes */
+ /* from the heap, possibly changing `*P'. */
+ /* */
+ /* <Input> */
+ /* memory :: A handle to a given `memory object' which handles */
+ /* reallocation. */
+ /* */
+ /* current :: The current block size in bytes. */
+ /* */
+ /* size :: The new block size in bytes. */
+ /* */
+ /* <InOut> */
+ /* P :: A pointer to the fresh new block. It should be set to */
+ /* NULL if `size' is 0, or in case of error. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* All callers of FT_Realloc() _must_ provide the current block size */
+ /* as well as the new one. */
+ /* */
+ FT_BASE( FT_Error )
+ FT_Realloc( FT_Memory memory,
+ FT_Long current,
+ FT_Long size,
+ void** P );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Free */
+ /* */
+ /* <Description> */
+ /* Releases a given block of memory allocated through FT_Alloc(). */
+ /* */
+ /* <Input> */
+ /* memory :: A handle to a given `memory object' which handles */
+ /* memory deallocation */
+ /* */
+ /* P :: This is the _address_ of a _pointer_ which points to the */
+ /* allocated block. It is always set to NULL on exit. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* If P or *P are NULL, this function should return successfully. */
+ /* This is a strong convention within all of FreeType and its */
+ /* drivers. */
+ /* */
+ FT_BASE( void )
+ FT_Free( FT_Memory memory,
+ void** P );
+
+
+#define FT_MEM_SET( dest, byte, count ) ft_memset( dest, byte, count )
+
+#define FT_MEM_COPY( dest, source, count ) ft_memcpy( dest, source, count )
+
+#define FT_MEM_MOVE( dest, source, count ) ft_memmove( dest, source, count )
+
+
+#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count )
+
+#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )
+
+
+ /*************************************************************************/
+ /* */
+ /* We first define FT_MEM_ALLOC, FT_MEM_REALLOC, and FT_MEM_FREE. All */
+ /* macros use an _implicit_ `memory' parameter to access the current */
+ /* memory allocator. */
+ /* */
+
+#ifdef FT_DEBUG_MEMORY
+
+#define FT_MEM_ALLOC( _pointer_, _size_ ) \
+ FT_Alloc_Debug( memory, _size_, \
+ (void**)&(_pointer_), __FILE__, __LINE__ )
+
+#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
+ FT_Realloc_Debug( memory, _current_, _size_, \
+ (void**)&(_pointer_), __FILE__, __LINE__ )
+
+#define FT_MEM_FREE( _pointer_ ) \
+ FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ )
+
+
+#else /* !FT_DEBUG_MEMORY */
+
+
+#define FT_MEM_ALLOC( _pointer_, _size_ ) \
+ FT_Alloc( memory, _size_, (void**)&(_pointer_) )
+
+#define FT_MEM_FREE( _pointer_ ) \
+ FT_Free( memory, (void**)&(_pointer_) )
+
+#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
+ FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) )
+
+
+#endif /* !FT_DEBUG_MEMORY */
+
+
+ /*************************************************************************/
+ /* */
+ /* The following functions macros expect that their pointer argument is */
+ /* _typed_ in order to automatically compute array element sizes. */
+ /* */
+
+#define FT_MEM_NEW( _pointer_ ) \
+ FT_MEM_ALLOC( _pointer_, sizeof ( *(_pointer_) ) )
+
+#define FT_MEM_NEW_ARRAY( _pointer_, _count_ ) \
+ FT_MEM_ALLOC( _pointer_, (_count_) * sizeof ( *(_pointer_) ) )
+
+#define FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) \
+ FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( *(_pointer_) ), \
+ (_new_) * sizeof ( *(_pointer_) ) )
+
+
+ /*************************************************************************/
+ /* */
+ /* the following macros are obsolete but kept for compatibility reasons */
+ /* */
+
+#define FT_MEM_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
+ FT_MEM_ALLOC( _pointer_, (_count_) * sizeof ( _type_ ) )
+
+#define FT_MEM_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \
+ FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( _type ), \
+ (_new_) * sizeof ( _type_ ) )
+
+
+ /*************************************************************************/
+ /* */
+ /* The following macros are variants of their FT_MEM_XXXX equivalents; */
+ /* they are used to set an _implicit_ `error' variable and return TRUE */
+ /* if an error occured (i.e. if 'error != 0'). */
+ /* */
+
+#define FT_ALLOC( _pointer_, _size_ ) \
+ FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, _size_ ) )
+
+#define FT_REALLOC( _pointer_, _current_, _size_ ) \
+ FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, _current_, _size_ ) )
+
+#define FT_FREE( _pointer_ ) \
+ FT_MEM_FREE( _pointer_ )
+
+#define FT_NEW( _pointer_ ) \
+ FT_SET_ERROR( FT_MEM_NEW( _pointer_ ) )
+
+#define FT_NEW_ARRAY( _pointer_, _count_ ) \
+ FT_SET_ERROR( FT_MEM_NEW_ARRAY( _pointer_, _count_ ) )
+
+#define FT_RENEW_ARRAY( _pointer_, _old_, _new_ ) \
+ FT_SET_ERROR( FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) )
+
+#define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
+ FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, \
+ (_count_) * sizeof ( _type_ ) ) )
+
+#define FT_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \
+ FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, \
+ (_old_) * sizeof ( _type_ ), \
+ (_new_) * sizeof ( _type_ ) ) )
+
+ /* */
+
+
+FT_END_HEADER
+
+#endif /* __FTMEMORY_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/ftobject.h b/include/freetype/internal/ftobject.h
new file mode 100644
index 00000000..f285d9e2
--- /dev/null
+++ b/include/freetype/internal/ftobject.h
@@ -0,0 +1,533 @@
+#ifndef __FT_OBJECT_H__
+#define __FT_OBJECT_H__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+FT_BEGIN_HEADER
+
+ /**************************************************************
+ *
+ * @type: FT_Object
+ *
+ * @description:
+ * handle to a FreeType Object. See @FT_ObjectRec
+ */
+ typedef struct FT_ObjectRec_* FT_Object;
+
+
+ /**************************************************************
+ *
+ * @type: FT_Class
+ *
+ * @description:
+ * handle to a constant class handle to a FreeType Object.
+ *
+ * Note that a class is itself a @FT_Object and are dynamically
+ * allocated on the heap.
+ *
+ * @also:
+ * @FT_ClassRec, @FT_Object, @FT_ObjectRec, @FT_Type, @FT_TypeRec
+ */
+ typedef const struct FT_ClassRec_* FT_Class;
+
+
+ /**************************************************************
+ *
+ * @type: FT_Type
+ *
+ * @description:
+ * handle to a constant structure (of type @FT_TypeRec) used
+ * to describe a given @FT_Class type to the FreeType object
+ * sub-system.
+ */
+ typedef const struct FT_TypeRec_* FT_Type;
+
+
+
+ /**************************************************************
+ *
+ * @struct: FT_ObjectRec
+ *
+ * @description:
+ * a structure describing the root fields of all @FT_Object
+ * class instances in FreeType
+ *
+ * @fields:
+ * clazz :: handle to the object's class
+ * ref_count :: object's reference count. Starts at 1
+ */
+ typedef struct FT_ObjectRec_
+ {
+ FT_Class clazz;
+ FT_Int ref_count;
+
+ } FT_ObjectRec;
+
+
+ /**************************************************************
+ *
+ * @macro: FT_OBJECT (x)
+ *
+ * @description:
+ * a useful macro to type-cast anything to a @FT_Object
+ * handle. No check performed..
+ */
+#define FT_OBJECT(x) ((FT_Object)(x))
+
+
+ /**************************************************************
+ *
+ * @macro: FT_OBJECT_P (x)
+ *
+ * @description:
+ * a useful macro to type-cast anything to a pointer to
+ * @FT_Object handle.
+ */
+#define FT_OBJECT_P(x) ((FT_Object*)(x))
+
+
+ /**************************************************************
+ *
+ * @macro: FT_OBJECT__CLASS (obj)
+ *
+ * @description:
+ * a useful macro to return the class of any object
+ */
+#define FT_OBJECT__CLASS(x) FT_OBJECT(x)->clazz
+
+
+ /**************************************************************
+ *
+ * @macro: FT_OBJECT__REF_COUNT (obj)
+ *
+ * @description:
+ * a useful macro to return the reference count of any object
+ */
+#define FT_OBJECT__REF_COUNT(x) FT_OBJECT(x)->ref_count
+
+
+ /**************************************************************
+ *
+ * @macro: FT_OBJECT__MEMORY (obj)
+ *
+ * @description:
+ * a useful macro to return a handle to the memory manager
+ * used to allocate a given object
+ */
+#define FT_OBJECT__MEMORY(x) FT_CLASS__MEMORY(FT_OBJECT(x)->clazz)
+
+
+ /**************************************************************
+ *
+ * @macro: FT_OBJECT__LIBRARY (obj)
+ *
+ * @description:
+ * a useful macro to return a handle to the library handle
+ * that owns the object
+ */
+#define FT_OBJECT__LIBRARY(x) FT_CLASS__LIBRARY(FT_OBJECT(x)->clazz)
+
+
+ /**************************************************************
+ *
+ * @functype: FT_Object_InitFunc
+ *
+ * @description:
+ * a function used to initialize a new object
+ *
+ * @input:
+ * object :: target object handle
+ * init_data :: optional pointer to initialization data
+ *
+ * @return:
+ * error code. 0 means success
+ */
+ typedef FT_Error (*FT_Object_InitFunc)( FT_Object object,
+ FT_Pointer init_data );
+
+ /**************************************************************
+ *
+ * @functype: FT_Object_DoneFunc
+ *
+ * @description:
+ * a function used to finalize a given object
+ *
+ * @input:
+ * object :: handle to target object
+ */
+ typedef void (*FT_Object_DoneFunc)( FT_Object object );
+
+
+ /**************************************************************
+ *
+ * @struct: FT_ClassRec
+ *
+ * @description:
+ * a structure used to describe a given object class within
+ * FreeType
+ *
+ * @fields:
+ * object :: root @FT_ObjectRec fields, since each class is
+ * itself an object. (it's an instance of the
+ * "metaclass", a special object of the FreeType
+ * object sub-system.)
+ *
+ * magic :: a 32-bit magic number used for decoding
+ * super :: pointer to super class
+ * type :: the @FT_Type descriptor of this class
+ * memory :: the current memory manager handle
+ * library :: the current library handle
+ * info :: an opaque pointer to class-specific information
+ * managed by the FreeType object sub-system
+ *
+ * class_done :: the class destructor function
+ *
+ * obj_size :: size of class instances in bytes
+ * obj_init :: class instance constructor
+ * obj_done :: class instance destructor
+ */
+ typedef struct FT_ClassRec_
+ {
+ FT_ObjectRec object;
+ FT_UInt32 magic;
+ FT_Class super;
+ FT_Type type;
+ FT_Memory memory;
+ FT_Library library;
+ FT_Pointer info;
+
+ FT_Object_DoneFunc class_done;
+
+ FT_UInt obj_size;
+ FT_Object_InitFunc obj_init;
+ FT_Object_DoneFunc obj_done;
+
+ } FT_ClassRec;
+
+
+ /**************************************************************
+ *
+ * @macro: FT_CLASS (x)
+ *
+ * @description:
+ * a useful macro to convert anything to a class handle
+ * without checks
+ */
+#define FT_CLASS(x) ((FT_Class)(x))
+
+
+ /**************************************************************
+ *
+ * @macro: FT_CLASS_P (x)
+ *
+ * @description:
+ * a useful macro to convert anything to a pointer to a class
+ * handle without checks
+ */
+#define FT_CLASS_P(x) ((FT_Class*)(x))
+
+
+ /**************************************************************
+ *
+ * @macro: FT_CLASS__MEMORY (clazz)
+ *
+ * @description:
+ * a useful macro to return the memory manager handle of a
+ * given class
+ */
+#define FT_CLASS__MEMORY(x) FT_CLASS(x)->memory
+
+
+ /**************************************************************
+ *
+ * @macro: FT_CLASS__LIBRARY (clazz)
+ *
+ * @description:
+ * a useful macro to return the library handle of a
+ * given class
+ */
+#define FT_CLASS__LIBRARY(x) FT_CLASS(x)->library
+
+
+
+ /**************************************************************
+ *
+ * @macro: FT_CLASS__TYPE (clazz)
+ *
+ * @description:
+ * a useful macro to return the type of a given class
+ * given class
+ */
+#define FT_CLASS__TYPE(x) FT_CLASS(x)->type
+
+ /* */
+#define FT_CLASS__INFO(x) FT_CLASS(x)->info
+#define FT_CLASS__MAGIC(x) FT_CLASS(x)->magic
+
+
+ /**************************************************************
+ *
+ * @struct: FT_TypeRec
+ *
+ * @description:
+ * a structure used to describe a given class to the FreeType
+ * object sub-system.
+ *
+ * @fields:
+ * name :: class name. only used for debugging
+ * super :: type of super-class. NULL if none
+ *
+ * class_size :: size of class structure in bytes
+ * class_init :: class constructor
+ * class_done :: class finalizer
+ *
+ * obj_size :: instance size in bytes
+ * obj_init :: instance constructor. can be NULL
+ * obj_done :: instance destructor. can be NULL
+ *
+ * @note:
+ * if 'obj_init' is NULL, the class will use it's parent
+ * constructor, if any
+ *
+ * if 'obj_done' is NULL, the class will use it's parent
+ * finalizer, if any
+ *
+ * the object sub-system allocates a new class, copies
+ * the content of its super-class into the new structure,
+ * _then_ calls 'clazz_init'.
+ *
+ * 'class_init' and 'class_done' can be NULL, in which case
+ * the parent's class constructor and destructor wil be used
+ */
+ typedef struct FT_TypeRec_
+ {
+ const char* name;
+ FT_Type super;
+
+ FT_UInt class_size;
+ FT_Object_InitFunc class_init;
+ FT_Object_DoneFunc class_done;
+
+ FT_UInt obj_size;
+ FT_Object_InitFunc obj_init;
+ FT_Object_DoneFunc obj_done;
+
+ } FT_TypeRec;
+
+
+ /**************************************************************
+ *
+ * @macro: FT_TYPE (x)
+ *
+ * @description:
+ * a useful macro to convert anything to a class type handle
+ * without checks
+ */
+#define FT_TYPE(x) ((FT_Type)(x))
+
+
+ /**************************************************************
+ *
+ * @function: ft_object_check
+ *
+ * @description:
+ * checks that a handle points to a valid @FT_Object
+ *
+ * @input:
+ * obj :: handle/pointer
+ *
+ * @return:
+ * 1 iff the handle points to a valid object. 0 otherwise
+ */
+ FT_BASE( FT_Int )
+ ft_object_check( FT_Pointer obj );
+
+
+ /**************************************************************
+ *
+ * @function: ft_object_is_a
+ *
+ * @description:
+ * checks that a handle points to a valid @FT_Object that
+ * is an instance of a given class (or of any of its sub-classes)
+ *
+ * @input:
+ * obj :: handle/pointer
+ * clazz :: class handle to check
+ *
+ * @return:
+ * 1 iff the handle points to a valid 'clazz' instance. 0
+ * otherwise.
+ */
+ FT_BASE( FT_Int )
+ ft_object_is_a( FT_Pointer obj,
+ FT_Class clazz );
+
+
+ /**************************************************************
+ *
+ * @function: ft_object_create
+ *
+ * @description:
+ * create a new object (class instance)
+ *
+ * @output:
+ * aobject :: new object handle. NULL in case of error
+ *
+ * @input:
+ * clazz :: object's class pointer
+ * init_data :: optional pointer to initialization data
+ *
+ * @return:
+ * error code. 0 means success
+ */
+ FT_BASE( FT_Error )
+ ft_object_create( FT_Object *aobject,
+ FT_Class clazz,
+ FT_Pointer init_data );
+
+
+ /**************************************************************
+ *
+ * @function: ft_object_create_from_type
+ *
+ * @description:
+ * create a new object (class instance) from a @FT_Type
+ *
+ * @output:
+ * aobject :: new object handle. NULL in case of error
+ *
+ * @input:
+ * type :: object's type descriptor
+ * init_data :: optional pointer to initialization data
+ *
+ * @return:
+ * error code. 0 means success
+ *
+ * @note:
+ * this function is slower than @ft_object_create
+ *
+ * this is equivalent to calling @ft_class_from_type followed by
+ * @ft_object_create
+ */
+ FT_BASE( FT_Error )
+ ft_object_create_from_type( FT_Object *aobject,
+ FT_Type type,
+ FT_Pointer init_data,
+ FT_Library library );
+
+
+
+ /**************************************************************
+ *
+ * @macro FT_OBJ_CREATE (object,class,init)
+ *
+ * @description:
+ * a convenient macro used to create new objects. see
+ * @ft_object_create for details
+ */
+#define FT_OBJ_CREATE( _obj, _clazz, _init ) \
+ ft_object_create( FT_OBJECT_P(&(_obj)), _clazz, _init )
+
+
+ /**************************************************************
+ *
+ * @macro FT_CREATE (object,class,init)
+ *
+ * @description:
+ * a convenient macro used to create new objects. It also
+ * sets an _implicit_ local variable named "error" to the error
+ * code returned by the object constructor.
+ */
+#define FT_CREATE( _obj, _clazz, _init ) \
+ FT_SET_ERROR( FT_OBJ_CREATE( _obj, _clazz, _init ) )
+
+ /**************************************************************
+ *
+ * @macro FT_OBJ_CREATE_FROM_TYPE (object,type,init)
+ *
+ * @description:
+ * a convenient macro used to create new objects. see
+ * @ft_object_create_from_type for details
+ */
+#define FT_OBJ_CREATE_FROM_TYPE( _obj, _type, _init, _lib ) \
+ ft_object_create_from_type( FT_OBJECT_P(&(_obj)), _type, _init, _lib )
+
+
+ /**************************************************************
+ *
+ * @macro FT_CREATE_FROM_TYPE (object,type,init)
+ *
+ * @description:
+ * a convenient macro used to create new objects. It also
+ * sets an _implicit_ local variable named "error" to the error
+ * code returned by the object constructor.
+ */
+#define FT_CREATE_FROM_TYPE( _obj, _type, _init, _lib ) \
+ FT_SET_ERROR( FT_OBJ_CREATE_FROM_TYPE( _obj, _type, _init, _lib ) )
+
+
+ /* */
+
+ /**************************************************************
+ *
+ * @function: ft_class_from_type
+ *
+ * @description:
+ * retrieves the class object corresponding to a given type
+ * descriptor. The class is created when needed
+ *
+ * @output:
+ * aclass :: handle to corresponding class object. NULL in
+ * case of error
+ *
+ * @input:
+ * type :: type descriptor handle
+ * library :: library handle
+ *
+ * @return:
+ * error code. 0 means success
+ */
+ FT_BASE( FT_Error )
+ ft_class_from_type( FT_Class *aclass,
+ FT_Type type,
+ FT_Library library );
+
+
+ /* */
+
+#include FT_INTERNAL_HASH_H
+
+ typedef struct FT_ClassHNodeRec_* FT_ClassHNode;
+
+ typedef struct FT_ClassHNodeRec_
+ {
+ FT_HashNodeRec hnode;
+ FT_Type type;
+ FT_Class clazz;
+
+ } FT_ClassHNodeRec;
+
+ typedef struct FT_MetaClassRec_
+ {
+ FT_ClassRec clazz; /* the meta-class is a class itself */
+ FT_HashRec type_to_class; /* the type => class hash table */
+
+ } FT_MetaClassRec, *FT_MetaClass;
+
+
+ /* initialize meta class */
+ FT_BASE( FT_Error )
+ ft_metaclass_init( FT_MetaClass meta,
+ FT_Library library );
+
+ /* finalize meta class - destroy all registered class objects */
+ FT_BASE( void )
+ ft_metaclass_done( FT_MetaClass meta );
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __FT_OBJECT_H__ */
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
new file mode 100644
index 00000000..5ccd5dc0
--- /dev/null
+++ b/include/freetype/internal/ftobjs.h
@@ -0,0 +1,794 @@
+/***************************************************************************/
+/* */
+/* ftobjs.h */
+/* */
+/* The FreeType private base classes (specification). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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. */
+/* */
+/***************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* This file contains the definition of all internal FreeType classes. */
+ /* */
+ /*************************************************************************/
+
+
+#ifndef __FTOBJS_H__
+#define __FTOBJS_H__
+
+#include <ft2build.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */
+#include FT_RENDER_H
+#include FT_SIZES_H
+#include FT_INTERNAL_MEMORY_H
+#include FT_INTERNAL_GLYPH_LOADER_H
+#include FT_INTERNAL_DRIVER_H
+#include FT_INTERNAL_AUTOHINT_H
+#include FT_INTERNAL_OBJECT_H
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+#include FT_INCREMENTAL_H
+#endif
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /* */
+ /* Some generic definitions. */
+ /* */
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef NULL
+#define NULL (void*)0
+#endif
+
+
+ /*************************************************************************/
+ /* */
+ /* The min and max functions missing in C. As usual, be careful not to */
+ /* write things like MIN( a++, b++ ) to avoid side effects. */
+ /* */
+#ifndef MIN
+#define MIN( a, b ) ( (a) < (b) ? (a) : (b) )
+#endif
+
+#ifndef MAX
+#define MAX( a, b ) ( (a) > (b) ? (a) : (b) )
+#endif
+
+#ifndef ABS
+#define ABS( a ) ( (a) < 0 ? -(a) : (a) )
+#endif
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** V A L I D A T I O N ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /* handle to a validation object */
+ typedef struct FT_ValidatorRec_* FT_Validator;
+
+
+ /*************************************************************************/
+ /* */
+ /* There are three distinct validation levels defined here: */
+ /* */
+ /* FT_VALIDATE_DEFAULT :: */
+ /* A table that passes this validation level can be used reliably by */
+ /* FreeType. It generally means that all offsets have been checked to */
+ /* prevent out-of-bound reads, array counts are correct, etc. */
+ /* */
+ /* FT_VALIDATE_TIGHT :: */
+ /* A table that passes this validation level can be used reliably and */
+ /* doesn't contain invalid data. For example, a charmap table that */
+ /* returns invalid glyph indices will not pass, even though it can */
+ /* be used with FreeType in default mode (the library will simply */
+ /* return an error later when trying to load the glyph). */
+ /* */
+ /* It also check that fields that must be a multiple of 2, 4, or 8 */
+ /* dont' have incorrect values, etc. */
+ /* */
+ /* FT_VALIDATE_PARANOID :: */
+ /* Only for font debugging. Checks that a table follows the */
+ /* specification by 100%. Very few fonts will be able to pass this */
+ /* level anyway but it can be useful for certain tools like font */
+ /* editors/converters. */
+ /* */
+ typedef enum FT_ValidationLevel_
+ {
+ FT_VALIDATE_DEFAULT = 0,
+ FT_VALIDATE_TIGHT,
+ FT_VALIDATE_PARANOID
+
+ } FT_ValidationLevel;
+
+
+ /* validator structure */
+ typedef struct FT_ValidatorRec_
+ {
+ const FT_Byte* base; /* address of table in memory */
+ const FT_Byte* limit; /* `base' + sizeof(table) in memory */
+ FT_ValidationLevel level; /* validation level */
+ FT_Error error; /* error returned. 0 means success */
+
+ ft_jmp_buf jump_buffer; /* used for exception handling */
+
+ } FT_ValidatorRec;
+
+
+#define FT_VALIDATOR( x ) ((FT_Validator)( x ))
+
+
+ FT_BASE( void )
+ ft_validator_init( FT_Validator valid,
+ const FT_Byte* base,
+ const FT_Byte* limit,
+ FT_ValidationLevel level );
+
+ FT_BASE( FT_Int )
+ ft_validator_run( FT_Validator valid );
+
+ /* Sets the error field in a validator, then calls `longjmp' to return */
+ /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */
+ /* error checks within the validation routines. */
+ /* */
+ FT_BASE( void )
+ ft_validator_error( FT_Validator valid,
+ FT_Error error );
+
+
+ /* Calls ft_validate_error. Assumes that the `valid' local variable */
+ /* holds a pointer to the current validator object. */
+ /* */
+#define FT_INVALID( _error ) ft_validator_error( valid, _error )
+
+ /* called when a broken table is detected */
+#define FT_INVALID_TOO_SHORT FT_INVALID( FT_Err_Invalid_Table )
+
+ /* called when an invalid offset is detected */
+#define FT_INVALID_OFFSET FT_INVALID( FT_Err_Invalid_Offset )
+
+ /* called when an invalid format/value is detected */
+#define FT_INVALID_FORMAT FT_INVALID( FT_Err_Invalid_Table )
+
+ /* called when an invalid glyph index is detected */
+#define FT_INVALID_GLYPH_ID FT_INVALID( FT_Err_Invalid_Glyph_Index )
+
+ /* called when an invalid field value is detected */
+#define FT_INVALID_DATA FT_INVALID( FT_Err_Invalid_Table )
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** C H A R M A P S ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /* handle to internal charmap object */
+ typedef struct FT_CMapRec_* FT_CMap;
+
+ /* handle to charmap class structure */
+ typedef const struct FT_CMap_ClassRec_* FT_CMap_Class;
+
+ /* internal charmap object structure */
+ typedef struct FT_CMapRec_
+ {
+ FT_CharMapRec charmap;
+ FT_CMap_Class clazz;
+
+ } FT_CMapRec;
+
+ /* typecase any pointer to a charmap handle */
+#define FT_CMAP( x ) ((FT_CMap)( x ))
+
+ /* obvious macros */
+#define FT_CMAP_PLATFORM_ID( x ) FT_CMAP( x )->charmap.platform_id
+#define FT_CMAP_ENCODING_ID( x ) FT_CMAP( x )->charmap.encoding_id
+#define FT_CMAP_ENCODING( x ) FT_CMAP( x )->charmap.encoding
+#define FT_CMAP_FACE( x ) FT_CMAP( x )->charmap.face
+
+
+ /* class method definitions */
+ typedef FT_Error
+ (*FT_CMap_InitFunc)( FT_CMap cmap,
+ FT_Pointer init_data );
+
+ typedef void
+ (*FT_CMap_DoneFunc)( FT_CMap cmap );
+
+ typedef FT_UInt
+ (*FT_CMap_CharIndexFunc)( FT_CMap cmap,
+ FT_UInt32 char_code );
+
+ typedef FT_UInt
+ (*FT_CMap_CharNextFunc)( FT_CMap cmap,
+ FT_UInt32 *achar_code );
+
+
+ typedef struct FT_CMap_ClassRec_
+ {
+ FT_UInt size;
+ FT_CMap_InitFunc init;
+ FT_CMap_DoneFunc done;
+ FT_CMap_CharIndexFunc char_index;
+ FT_CMap_CharNextFunc char_next;
+
+ } FT_CMap_ClassRec;
+
+
+ /* create a new charmap and add it to charmap->face */
+ FT_BASE( FT_Error )
+ FT_CMap_New( FT_CMap_Class clazz,
+ FT_Pointer init_data,
+ FT_CharMap charmap,
+ FT_CMap *acmap );
+
+ /* destroy a charmap (don't remove it from face's list though) */
+ FT_BASE( void )
+ FT_CMap_Done( FT_CMap cmap );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_Face_InternalRec */
+ /* */
+ /* <Description> */
+ /* This structure contains the internal fields of each FT_Face */
+ /* object. These fields may change between different releases of */
+ /* FreeType. */
+ /* */
+ /* <Fields> */
+ /* max_points :: The maximal number of points used to store the */
+ /* vectorial outline of any glyph in this face. */
+ /* If this value cannot be known in advance, or */
+ /* if the face isn't scalable, this should be set */
+ /* to 0. Only relevant for scalable formats. */
+ /* */
+ /* max_contours :: The maximal number of contours used to store */
+ /* the vectorial outline of any glyph in this */
+ /* face. If this value cannot be known in */
+ /* advance, or if the face isn't scalable, this */
+ /* should be set to 0. Only relevant for */
+ /* scalable formats. */
+ /* */
+ /* transform_matrix :: A 2x2 matrix of 16.16 coefficients used to */
+ /* transform glyph outlines after they are loaded */
+ /* from the font. Only used by the convenience */
+ /* functions. */
+ /* */
+ /* transform_delta :: A translation vector used to transform glyph */
+ /* outlines after they are loaded from the font. */
+ /* Only used by the convenience functions. */
+ /* */
+ /* transform_flags :: Some flags used to classify the transform. */
+ /* Only used by the convenience functions. */
+ /* */
+ /* hint_flags :: Some flags used to change the hinters' */
+ /* behaviour. Only used for debugging for now. */
+ /* */
+ /* postscript_name :: Postscript font name for this face. */
+ /* */
+ /* incremental_interface :: */
+ /* If non-null, the interface through */
+ /* which glyph data and metrics are loaded */
+ /* incrementally for faces that do not provide */
+ /* all of this data when first opened. */
+ /* This field exists only if */
+ /* @FT_CONFIG_OPTION_INCREMENTAL is defined. */
+ /* */
+ typedef struct FT_Face_InternalRec_
+ {
+ FT_UShort max_points;
+ FT_Short max_contours;
+
+ FT_Matrix transform_matrix;
+ FT_Vector transform_delta;
+ FT_Int transform_flags;
+
+ FT_UInt32 hint_flags;
+
+ const char* postscript_name;
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+ FT_Incremental_InterfaceRec* incremental_interface;
+#endif
+
+ } FT_Face_InternalRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_Slot_InternalRec */
+ /* */
+ /* <Description> */
+ /* This structure contains the internal fields of each FT_GlyphSlot */
+ /* object. These fields may change between different releases of */
+ /* FreeType. */
+ /* */
+ /* <Fields> */
+ /* loader :: The glyph loader object used to load outlines */
+ /* into the glyph slot. */
+ /* */
+ /* glyph_transformed :: Boolean. Set to TRUE when the loaded glyph */
+ /* must be transformed through a specific */
+ /* font transformation. This is _not_ the same */
+ /* as the face transform set through */
+ /* FT_Set_Transform(). */
+ /* */
+ /* glyph_matrix :: The 2x2 matrix corresponding to the glyph */
+ /* transformation, if necessary. */
+ /* */
+ /* glyph_delta :: The 2d translation vector corresponding to */
+ /* the glyph transformation, if necessary. */
+ /* */
+ /* glyph_hints :: Format-specific glyph hints management. */
+ /* */
+ typedef struct FT_Slot_InternalRec_
+ {
+ FT_GlyphLoader loader;
+ FT_Bool glyph_transformed;
+ FT_Matrix glyph_matrix;
+ FT_Vector glyph_delta;
+ void* glyph_hints;
+
+ } FT_GlyphSlot_InternalRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** M O D U L E S ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_ModuleRec */
+ /* */
+ /* <Description> */
+ /* A module object instance. */
+ /* */
+ /* <Fields> */
+ /* clazz :: A pointer to the module's class. */
+ /* */
+ /* library :: A handle to the parent library object. */
+ /* */
+ /* memory :: A handle to the memory manager. */
+ /* */
+ /* generic :: A generic structure for user-level extensibility (?). */
+ /* */
+ typedef struct FT_ModuleRec_
+ {
+ FT_Module_Class* clazz;
+ FT_Library library;
+ FT_Memory memory;
+ FT_Generic generic;
+
+ } FT_ModuleRec;
+
+
+ /* typecast an object to a FT_Module */
+#define FT_MODULE( x ) ((FT_Module)( x ))
+#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
+#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
+#define FT_MODULE_MEMORY( x ) FT_MODULE( x )->memory
+
+
+#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
+ ft_module_font_driver )
+
+#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
+ ft_module_renderer )
+
+#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
+ ft_module_hinter )
+
+#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
+ ft_module_styler )
+
+#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
+ ft_module_driver_scalable )
+
+#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
+ ft_module_driver_no_outlines )
+
+#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
+ ft_module_driver_has_hinter )
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Get_Module_Interface */
+ /* */
+ /* <Description> */
+ /* Finds a module and returns its specific interface as a typeless */
+ /* pointer. */
+ /* */
+ /* <Input> */
+ /* library :: A handle to the library object. */
+ /* */
+ /* module_name :: The module's name (as an ASCII string). */
+ /* */
+ /* <Return> */
+ /* A module-specific interface if available, 0 otherwise. */
+ /* */
+ /* <Note> */
+ /* You should better be familiar with FreeType internals to know */
+ /* which module to look for, and what its interface is :-) */
+ /* */
+ FT_BASE( const void* )
+ FT_Get_Module_Interface( FT_Library library,
+ const char* mod_name );
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** FACE, SIZE & GLYPH SLOT OBJECTS ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /* a few macros used to perform easy typecasts with minimal brain damage */
+
+#define FT_FACE( x ) ((FT_Face)(x))
+#define FT_SIZE( x ) ((FT_Size)(x))
+#define FT_SLOT( x ) ((FT_GlyphSlot)(x))
+
+#define FT_FACE_DRIVER( x ) FT_FACE( x )->driver
+#define FT_FACE_LIBRARY( x ) FT_FACE_DRIVER( x )->root.library
+#define FT_FACE_MEMORY( x ) FT_FACE( x )->memory
+#define FT_FACE_STREAM( x ) FT_FACE( x )->stream
+
+#define FT_SIZE_FACE( x ) FT_SIZE( x )->face
+#define FT_SLOT_FACE( x ) FT_SLOT( x )->face
+
+#define FT_FACE_SLOT( x ) FT_FACE( x )->glyph
+#define FT_FACE_SIZE( x ) FT_FACE( x )->size
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_New_GlyphSlot */
+ /* */
+ /* <Description> */
+ /* It is sometimes useful to have more than one glyph slot for a */
+ /* given face object. This function is used to create additional */
+ /* slots. All of them are automatically discarded when the face is */
+ /* destroyed. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to a parent face object. */
+ /* */
+ /* <Output> */
+ /* aslot :: A handle to a new glyph slot object. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ FT_BASE( FT_Error )
+ FT_New_GlyphSlot( FT_Face face,
+ FT_GlyphSlot *aslot );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Done_GlyphSlot */
+ /* */
+ /* <Description> */
+ /* Destroys a given glyph slot. Remember however that all slots are */
+ /* automatically destroyed with its parent. Using this function is */
+ /* not always mandatory. */
+ /* */
+ /* <Input> */
+ /* slot :: A handle to a target glyph slot. */
+ /* */
+ FT_BASE( void )
+ FT_Done_GlyphSlot( FT_GlyphSlot slot );
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** R E N D E R E R S ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+#define FT_RENDERER( x ) ((FT_Renderer)( x ))
+#define FT_GLYPH( x ) ((FT_Glyph)( x ))
+#define FT_BITMAP_GLYPH( x ) ((FT_BitmapGlyph)( x ))
+#define FT_OUTLINE_GLYPH( x ) ((FT_OutlineGlyph)( x ))
+
+
+ typedef struct FT_RendererRec_
+ {
+ FT_ModuleRec root;
+ FT_Renderer_Class* clazz;
+ FT_Glyph_Format glyph_format;
+ FT_Glyph_Class glyph_class;
+
+ FT_Raster raster;
+ FT_Raster_Render_Func raster_render;
+ FT_Renderer_RenderFunc render;
+
+ } FT_RendererRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** F O N T D R I V E R S ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /* typecast a module into a driver easily */
+#define FT_DRIVER( x ) ((FT_Driver)(x))
+
+ /* typecast a module as a driver, and get its driver class */
+#define FT_DRIVER_CLASS( x ) FT_DRIVER( x )->clazz
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_DriverRec */
+ /* */
+ /* <Description> */
+ /* The root font driver class. A font driver is responsible for */
+ /* managing and loading font files of a given format. */
+ /* */
+ /* <Fields> */
+ /* root :: Contains the fields of the root module class. */
+ /* */
+ /* clazz :: A pointer to the font driver's class. Note that */
+ /* this is NOT root.clazz. `class' wasn't used */
+ /* as it is a reserved word in C++. */
+ /* */
+ /* faces_list :: The list of faces currently opened by this */
+ /* driver. */
+ /* */
+ /* extensions :: A typeless pointer to the driver's extensions */
+ /* registry, if they are supported through the */
+ /* configuration macro FT_CONFIG_OPTION_EXTENSIONS. */
+ /* */
+ /* glyph_loader :: The glyph loader for all faces managed by this */
+ /* driver. This object isn't defined for unscalable */
+ /* formats. */
+ /* */
+ typedef struct FT_DriverRec_
+ {
+ FT_ModuleRec root;
+ FT_Driver_Class clazz;
+
+ FT_ListRec faces_list;
+ void* extensions;
+
+ FT_GlyphLoader glyph_loader;
+
+ } FT_DriverRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
+ /**** ****/
+ /**** L I B R A R I E S ****/
+ /**** ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+#define FT_DEBUG_HOOK_TRUETYPE 0
+#define FT_DEBUG_HOOK_TYPE1 1
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_LibraryRec */
+ /* */
+ /* <Description> */
+ /* The FreeType library class. This is the root of all FreeType */
+ /* data. Use FT_New_Library() to create a library object, and */
+ /* FT_Done_Library() to discard it and all child objects. */
+ /* */
+ /* <Fields> */
+ /* memory :: The library's memory object. Manages memory */
+ /* allocation. */
+ /* */
+ /* generic :: Client data variable. Used to extend the */
+ /* Library class by higher levels and clients. */
+ /* */
+ /* num_modules :: The number of modules currently registered */
+ /* within this library. This is set to 0 for new */
+ /* libraries. New modules are added through the */
+ /* FT_Add_Module() API function. */
+ /* */
+ /* modules :: A table used to store handles to the currently */
+ /* registered modules. Note that each font driver */
+ /* contains a list of its opened faces. */
+ /* */
+ /* renderers :: The list of renderers currently registered */
+ /* within the library. */
+ /* */
+ /* cur_renderer :: The current outline renderer. This is a */
+ /* shortcut used to avoid parsing the list on */
+ /* each call to FT_Outline_Render(). It is a */
+ /* handle to the current renderer for the */
+ /* FT_GLYPH_FORMAT_OUTLINE format. */
+ /* */
+ /* auto_hinter :: XXX */
+ /* */
+ /* raster_pool :: The raster object's render pool. This can */
+ /* ideally be changed dynamically at run-time. */
+ /* */
+ /* raster_pool_size :: The size of the render pool in bytes. */
+ /* */
+ /* debug_hooks :: XXX */
+ /* */
+ typedef struct FT_LibraryRec_
+ {
+ FT_Memory memory; /* library's memory manager */
+
+ FT_Generic generic;
+
+ FT_Int version_major;
+ FT_Int version_minor;
+ FT_Int version_patch;
+
+ FT_UInt num_modules;
+ FT_Module modules[FT_MAX_MODULES]; /* module objects */
+
+ FT_ListRec renderers; /* list of renderers */
+ FT_Renderer cur_renderer; /* current outline renderer */
+ FT_Module auto_hinter;
+
+ FT_Byte* raster_pool; /* scan-line conversion */
+ /* render pool */
+ FT_ULong raster_pool_size; /* size of render pool in bytes */
+
+ FT_DebugHook_Func debug_hooks[4];
+
+ FT_MetaClassRec meta_class;
+
+ } FT_LibraryRec;
+
+
+ FT_BASE( FT_Renderer )
+ FT_Lookup_Renderer( FT_Library library,
+ FT_Glyph_Format format,
+ FT_ListNode* node );
+
+ FT_BASE( FT_Error )
+ FT_Render_Glyph_Internal( FT_Library library,
+ FT_GlyphSlot slot,
+ FT_Render_Mode render_mode );
+
+ typedef const char*
+ (*FT_Face_GetPostscriptNameFunc)( FT_Face face );
+
+ typedef FT_Error
+ (*FT_Face_GetGlyphNameFunc)( FT_Face face,
+ FT_UInt glyph_index,
+ FT_Pointer buffer,
+ FT_UInt buffer_max );
+
+ typedef FT_UInt
+ (*FT_Face_GetGlyphNameIndexFunc)( FT_Face face,
+ FT_String* glyph_name );
+
+
+#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_New_Memory */
+ /* */
+ /* <Description> */
+ /* Creates a new memory object. */
+ /* */
+ /* <Return> */
+ /* A pointer to the new memory object. 0 in case of error. */
+ /* */
+ FT_EXPORT( FT_Memory )
+ FT_New_Memory( void );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Done_Memory */
+ /* */
+ /* <Description> */
+ /* Discards memory manager. */
+ /* */
+ /* <Input> */
+ /* memory :: A handle to the memory manager. */
+ /* */
+ FT_EXPORT( void )
+ FT_Done_Memory( FT_Memory memory );
+
+#endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
+
+
+ /* Define default raster's interface. The default raster is located in */
+ /* `src/base/ftraster.c'. */
+ /* */
+ /* Client applications can register new rasters through the */
+ /* FT_Set_Raster() API. */
+
+#ifndef FT_NO_DEFAULT_RASTER
+ FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster;
+#endif
+
+
+FT_END_HEADER
+
+#endif /* __FTOBJS_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h
new file mode 100644
index 00000000..618f64aa
--- /dev/null
+++ b/include/freetype/internal/ftstream.h
@@ -0,0 +1,498 @@
+/***************************************************************************/
+/* */
+/* ftstream.h */
+/* */
+/* Stream handling (specification). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __FTSTREAM_H__
+#define __FTSTREAM_H__
+
+
+#include <ft2build.h>
+#include FT_SYSTEM_H
+#include FT_INTERNAL_OBJECTS_H
+
+
+FT_BEGIN_HEADER
+
+
+ /* format of an 8-bit frame_op value: */
+ /* */
+ /* bit 76543210 */
+ /* xxxxxxes */
+ /* */
+ /* s is set to 1 if the value is signed. */
+ /* e is set to 1 if the value is little-endian. */
+ /* xxx is a command. */
+
+#define FT_FRAME_OP_SHIFT 2
+#define FT_FRAME_OP_SIGNED 1
+#define FT_FRAME_OP_LITTLE 2
+#define FT_FRAME_OP_COMMAND( x ) ( x >> FT_FRAME_OP_SHIFT )
+
+#define FT_MAKE_FRAME_OP( command, little, sign ) \
+ ( ( command << FT_FRAME_OP_SHIFT ) | ( little << 1 ) | sign )
+
+#define FT_FRAME_OP_END 0
+#define FT_FRAME_OP_START 1 /* start a new frame */
+#define FT_FRAME_OP_BYTE 2 /* read 1-byte value */
+#define FT_FRAME_OP_SHORT 3 /* read 2-byte value */
+#define FT_FRAME_OP_LONG 4 /* read 4-byte value */
+#define FT_FRAME_OP_OFF3 5 /* read 3-byte value */
+#define FT_FRAME_OP_BYTES 6 /* read a bytes sequence */
+
+
+ typedef enum FT_Frame_Op_
+ {
+ ft_frame_end = 0,
+ ft_frame_start = FT_MAKE_FRAME_OP( FT_FRAME_OP_START, 0, 0 ),
+
+ ft_frame_byte = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 0 ),
+ ft_frame_schar = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTE, 0, 1 ),
+
+ ft_frame_ushort_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 0 ),
+ ft_frame_short_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 0, 1 ),
+ ft_frame_ushort_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 0 ),
+ ft_frame_short_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_SHORT, 1, 1 ),
+
+ ft_frame_ulong_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 0 ),
+ ft_frame_long_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 0, 1 ),
+ ft_frame_ulong_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 0 ),
+ ft_frame_long_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_LONG, 1, 1 ),
+
+ ft_frame_uoff3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 0 ),
+ ft_frame_off3_be = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 0, 1 ),
+ ft_frame_uoff3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 0 ),
+ ft_frame_off3_le = FT_MAKE_FRAME_OP( FT_FRAME_OP_OFF3, 1, 1 ),
+
+ ft_frame_bytes = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 0 ),
+ ft_frame_skip = FT_MAKE_FRAME_OP( FT_FRAME_OP_BYTES, 0, 1 )
+
+ } FT_Frame_Op;
+
+
+ typedef struct FT_Frame_Field_
+ {
+ FT_Byte value;
+ FT_Byte size;
+ FT_UShort offset;
+
+ } FT_Frame_Field;
+
+
+ /* Construct an FT_Frame_Field out of a structure type and a field name. */
+ /* The structure type must be set in the FT_STRUCTURE macro before */
+ /* calling the FT_FRAME_START() macro. */
+ /* */
+#define FT_FIELD_SIZE( f ) \
+ (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f )
+
+#define FT_FIELD_SIZE_DELTA( f ) \
+ (FT_Byte)sizeof ( ((FT_STRUCTURE*)0)->f[0] )
+
+#define FT_FIELD_OFFSET( f ) \
+ (FT_UShort)( offsetof( FT_STRUCTURE, f ) )
+
+#define FT_FRAME_FIELD( frame_op, field ) \
+ { \
+ frame_op, \
+ FT_FIELD_SIZE( field ), \
+ FT_FIELD_OFFSET( field ) \
+ }
+
+#define FT_MAKE_EMPTY_FIELD( frame_op ) { frame_op, 0, 0 }
+
+#define FT_FRAME_START( size ) { ft_frame_start, 0, size }
+#define FT_FRAME_END { ft_frame_end, 0, 0 }
+
+#define FT_FRAME_LONG( f ) FT_FRAME_FIELD( ft_frame_long_be, f )
+#define FT_FRAME_ULONG( f ) FT_FRAME_FIELD( ft_frame_ulong_be, f )
+#define FT_FRAME_SHORT( f ) FT_FRAME_FIELD( ft_frame_short_be, f )
+#define FT_FRAME_USHORT( f ) FT_FRAME_FIELD( ft_frame_ushort_be, f )
+#define FT_FRAME_OFF3( f ) FT_FRAME_FIELD( ft_frame_off3_be, f )
+#define FT_FRAME_UOFF3( f ) FT_FRAME_FIELD( ft_frame_uoff3_be, f )
+#define FT_FRAME_BYTE( f ) FT_FRAME_FIELD( ft_frame_byte, f )
+#define FT_FRAME_CHAR( f ) FT_FRAME_FIELD( ft_frame_schar, f )
+
+#define FT_FRAME_LONG_LE( f ) FT_FRAME_FIELD( ft_frame_long_le, f )
+#define FT_FRAME_ULONG_LE( f ) FT_FRAME_FIELD( ft_frame_ulong_le, f )
+#define FT_FRAME_SHORT_LE( f ) FT_FRAME_FIELD( ft_frame_short_le, f )
+#define FT_FRAME_USHORT_LE( f ) FT_FRAME_FIELD( ft_frame_ushort_le, f )
+#define FT_FRAME_OFF3_LE( f ) FT_FRAME_FIELD( ft_frame_off3_le, f )
+#define FT_FRAME_UOFF3_LE( f ) FT_FRAME_FIELD( ft_frame_uoff3_le, f )
+
+#define FT_FRAME_SKIP_LONG { ft_frame_long_be, 0, 0 }
+#define FT_FRAME_SKIP_SHORT { ft_frame_short_be, 0, 0 }
+#define FT_FRAME_SKIP_BYTE { ft_frame_byte, 0, 0 }
+
+#define FT_FRAME_BYTES( field, count ) \
+ { \
+ ft_frame_bytes, \
+ count, \
+ FT_FIELD_OFFSET( field ) \
+ }
+
+#define FT_FRAME_SKIP_BYTES( count ) { ft_frame_skip, count, 0 }
+
+
+ /*************************************************************************/
+ /* */
+ /* Integer extraction macros -- the `buffer' parameter must ALWAYS be of */
+ /* type `char*' or equivalent (1-byte elements). */
+ /* */
+
+#define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] )
+#define FT_INT8_( p, i ) ( ((const FT_Char*)(p))[(i)] )
+
+#define FT_INT16( x ) ( (FT_Int16)(x) )
+#define FT_UINT16( x ) ( (FT_UInt16)(x) )
+#define FT_INT32( x ) ( (FT_Int32)(x) )
+#define FT_UINT32( x ) ( (FT_UInt32)(x) )
+
+#define FT_BYTE_I16( p, i, s ) ( FT_INT16( FT_BYTE_( p, i ) ) << (s) )
+#define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) )
+#define FT_BYTE_I32( p, i, s ) ( FT_INT32( FT_BYTE_( p, i ) ) << (s) )
+#define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) )
+
+#define FT_INT8_I16( p, i, s ) ( FT_INT16( FT_INT8_( p, i ) ) << (s) )
+#define FT_INT8_U16( p, i, s ) ( FT_UINT16( FT_INT8_( p, i ) ) << (s) )
+#define FT_INT8_I32( p, i, s ) ( FT_INT32( FT_INT8_( p, i ) ) << (s) )
+#define FT_INT8_U32( p, i, s ) ( FT_UINT32( FT_INT8_( p, i ) ) << (s) )
+
+
+#define FT_PEEK_SHORT( p ) FT_INT16( FT_INT8_I16( p, 0, 8) | \
+ FT_BYTE_I16( p, 1, 0) )
+
+#define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \
+ FT_BYTE_U16( p, 1, 0 ) )
+
+#define FT_PEEK_LONG( p ) FT_INT32( FT_INT8_I32( p, 0, 24 ) | \
+ FT_BYTE_I32( p, 1, 16 ) | \
+ FT_BYTE_I32( p, 2, 8 ) | \
+ FT_BYTE_I32( p, 3, 0 ) )
+
+#define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \
+ FT_BYTE_U32( p, 1, 16 ) | \
+ FT_BYTE_U32( p, 2, 8 ) | \
+ FT_BYTE_U32( p, 3, 0 ) )
+
+#define FT_PEEK_OFF3( p ) FT_INT32( FT_INT8_I32( p, 0, 16 ) | \
+ FT_BYTE_I32( p, 1, 8 ) | \
+ FT_BYTE_I32( p, 2, 0 ) )
+
+#define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \
+ FT_BYTE_U32( p, 1, 8 ) | \
+ FT_BYTE_U32( p, 2, 0 ) )
+
+#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_INT8_I16( p, 1, 8 ) | \
+ FT_BYTE_I16( p, 0, 0 ) )
+
+#define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \
+ FT_BYTE_U16( p, 0, 0 ) )
+
+#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_INT8_I32( p, 3, 24 ) | \
+ FT_BYTE_I32( p, 2, 16 ) | \
+ FT_BYTE_I32( p, 1, 8 ) | \
+ FT_BYTE_I32( p, 0, 0 ) )
+
+#define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \
+ FT_BYTE_U32( p, 2, 16 ) | \
+ FT_BYTE_U32( p, 1, 8 ) | \
+ FT_BYTE_U32( p, 0, 0 ) )
+
+#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_INT8_I32( p, 2, 16 ) | \
+ FT_BYTE_I32( p, 1, 8 ) | \
+ FT_BYTE_I32( p, 0, 0 ) )
+
+#define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \
+ FT_BYTE_U32( p, 1, 8 ) | \
+ FT_BYTE_U32( p, 0, 0 ) )
+
+
+#define FT_NEXT_CHAR( buffer ) \
+ ( (signed char)*buffer++ )
+
+#define FT_NEXT_BYTE( buffer ) \
+ ( (unsigned char)*buffer++ )
+
+#define FT_NEXT_SHORT( buffer ) \
+ ( (short)( buffer += 2, FT_PEEK_SHORT( buffer - 2 ) ) )
+
+#define FT_NEXT_USHORT( buffer ) \
+ ( (unsigned short)( buffer += 2, FT_PEEK_USHORT( buffer - 2 ) ) )
+
+#define FT_NEXT_OFF3( buffer ) \
+ ( (long)( buffer += 3, FT_PEEK_OFF3( buffer - 3 ) ) )
+
+#define FT_NEXT_UOFF3( buffer ) \
+ ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3( buffer - 3 ) ) )
+
+#define FT_NEXT_LONG( buffer ) \
+ ( (long)( buffer += 4, FT_PEEK_LONG( buffer - 4 ) ) )
+
+#define FT_NEXT_ULONG( buffer ) \
+ ( (unsigned long)( buffer += 4, FT_PEEK_ULONG( buffer - 4 ) ) )
+
+
+#define FT_NEXT_SHORT_LE( buffer ) \
+ ( (short)( buffer += 2, FT_PEEK_SHORT_LE( buffer - 2 ) ) )
+
+#define FT_NEXT_USHORT_LE( buffer ) \
+ ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) )
+
+#define FT_NEXT_OFF3_LE( buffer ) \
+ ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) )
+
+#define FT_NEXT_UOFF3_LE( buffer ) \
+ ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) )
+
+#define FT_NEXT_LONG_LE( buffer ) \
+ ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) )
+
+#define FT_NEXT_ULONG_LE( buffer ) \
+ ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) )
+
+
+ /*************************************************************************/
+ /* */
+ /* Each GET_xxxx() macro uses an implicit `stream' variable. */
+ /* */
+#define FT_GET_MACRO( func, type ) ( (type)func( stream ) )
+
+#define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char )
+#define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte )
+#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_Short )
+#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort )
+#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long )
+#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong )
+#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetLong, FT_Long )
+#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong )
+#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong )
+
+#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short )
+#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort )
+#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_Long )
+#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_ULong )
+
+#define FT_READ_MACRO( func, type, var ) \
+ ( var = (type)func( stream, &error ), \
+ error != FT_Err_Ok )
+
+#define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var )
+#define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var )
+#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_Short, var )
+#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_UShort, var )
+#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_Long, var )
+#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_ULong, var )
+#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_Long, var )
+#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_ULong, var )
+
+#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_Short, var )
+#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_UShort, var )
+#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_Long, var )
+#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var )
+
+
+#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
+
+ /* initialize a stream for reading a regular system stream */
+ FT_EXPORT( FT_Error )
+ FT_Stream_Open( FT_Stream stream,
+ const char* filepathname );
+
+#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
+
+
+ /* initialize a stream for reading in-memory data */
+ FT_BASE( void )
+ FT_Stream_OpenMemory( FT_Stream stream,
+ const FT_Byte* base,
+ FT_ULong size );
+
+ /* close a stream (does not destroy the stream structure) */
+ FT_BASE( void )
+ FT_Stream_Close( FT_Stream stream );
+
+
+ /* seek within a stream. position is relative to start of stream */
+ FT_BASE( FT_Error )
+ FT_Stream_Seek( FT_Stream stream,
+ FT_ULong pos );
+
+ /* skip bytes in a stream */
+ FT_BASE( FT_Error )
+ FT_Stream_Skip( FT_Stream stream,
+ FT_Long distance );
+
+ /* return current stream position */
+ FT_BASE( FT_Long )
+ FT_Stream_Pos( FT_Stream stream );
+
+ /* read bytes from a stream into a user-allocated buffer, returns an */
+ /* error if not all bytes could be read. */
+ FT_BASE( FT_Error )
+ FT_Stream_Read( FT_Stream stream,
+ FT_Byte* buffer,
+ FT_ULong count );
+
+ /* read bytes from a stream at a given position */
+ FT_BASE( FT_Error )
+ FT_Stream_ReadAt( FT_Stream stream,
+ FT_ULong pos,
+ FT_Byte* buffer,
+ FT_ULong count );
+
+ /* Enter a frame of `count' consecutive bytes in a stream. Returns an */
+ /* error if the frame could not be read/accessed. The caller can use */
+ /* the FT_Stream_Get_XXX functions to retrieve frame data without */
+ /* error checks. */
+ /* */
+ /* You must _always_ call FT_Stream_ExitFrame() once you have entered */
+ /* a stream frame! */
+ /* */
+ FT_BASE( FT_Error )
+ FT_Stream_EnterFrame( FT_Stream stream,
+ FT_ULong count );
+
+ /* exit a stream frame */
+ FT_BASE( void )
+ FT_Stream_ExitFrame( FT_Stream stream );
+
+ /* Extract a stream frame. If the stream is disk-based, a heap block */
+ /* is allocated and the frame bytes are read into it. If the stream */
+ /* is memory-based, this function simply set a pointer to the data. */
+ /* */
+ /* Useful to optimize access to memory-based streams transparently. */
+ /* */
+ /* All extracted frames must be `freed` with a call to the function */
+ /* FT_Stream_ReleaseFrame(). */
+ /* */
+ FT_BASE( FT_Error )
+ FT_Stream_ExtractFrame( FT_Stream stream,
+ FT_ULong count,
+ FT_Byte** pbytes );
+
+ /* release an extract frame (see FT_Stream_ExtractFrame) */
+ FT_BASE( void )
+ FT_Stream_ReleaseFrame( FT_Stream stream,
+ FT_Byte** pbytes );
+
+ /* read a byte from an entered frame */
+ FT_BASE( FT_Char )
+ FT_Stream_GetChar( FT_Stream stream );
+
+ /* read a 16-bit big-endian integer from an entered frame */
+ FT_BASE( FT_Short )
+ FT_Stream_GetShort( FT_Stream stream );
+
+ /* read a 24-bit big-endian integer from an entered frame */
+ FT_BASE( FT_Long )
+ FT_Stream_GetOffset( FT_Stream stream );
+
+ /* read a 32-bit big-endian integer from an entered frame */
+ FT_BASE( FT_Long )
+ FT_Stream_GetLong( FT_Stream stream );
+
+ /* read a 16-bit little-endian integer from an entered frame */
+ FT_BASE( FT_Short )
+ FT_Stream_GetShortLE( FT_Stream stream );
+
+ /* read a 32-bit little-endian integer from an entered frame */
+ FT_BASE( FT_Long )
+ FT_Stream_GetLongLE( FT_Stream stream );
+
+
+ /* read a byte from a stream */
+ FT_BASE( FT_Char )
+ FT_Stream_ReadChar( FT_Stream stream,
+ FT_Error* error );
+
+ /* read a 16-bit big-endian integer from a stream */
+ FT_BASE( FT_Short )
+ FT_Stream_ReadShort( FT_Stream stream,
+ FT_Error* error );
+
+ /* read a 24-bit big-endian integer from a stream */
+ FT_BASE( FT_Long )
+ FT_Stream_ReadOffset( FT_Stream stream,
+ FT_Error* error );
+
+ /* read a 32-bit big-endian integer from a stream */
+ FT_BASE( FT_Long )
+ FT_Stream_ReadLong( FT_Stream stream,
+ FT_Error* error );
+
+ /* read a 16-bit little-endian integer from a stream */
+ FT_BASE( FT_Short )
+ FT_Stream_ReadShortLE( FT_Stream stream,
+ FT_Error* error );
+
+ /* read a 32-bit little-endian integer from a stream */
+ FT_BASE( FT_Long )
+ FT_Stream_ReadLongLE( FT_Stream stream,
+ FT_Error* error );
+
+ /* Read a structure from a stream. The structure must be described */
+ /* by an array of FT_Frame_Field records. */
+ FT_BASE( FT_Error )
+ FT_Stream_ReadFields( FT_Stream stream,
+ const FT_Frame_Field* fields,
+ void* structure );
+
+
+#define FT_STREAM_POS() \
+ FT_Stream_Pos( stream )
+
+#define FT_STREAM_SEEK( position ) \
+ FT_SET_ERROR( FT_Stream_Seek( stream, position ) )
+
+#define FT_STREAM_SKIP( distance ) \
+ FT_SET_ERROR( FT_Stream_Skip( stream, distance ) )
+
+#define FT_STREAM_READ( buffer, count ) \
+ FT_SET_ERROR( FT_Stream_Read( stream, \
+ (FT_Byte*)buffer, \
+ count ) )
+
+#define FT_STREAM_READ_AT( position, buffer, count ) \
+ FT_SET_ERROR( FT_Stream_ReadAt( stream, \
+ position, \
+ (FT_Byte*)buffer, \
+ count ) )
+
+#define FT_STREAM_READ_FIELDS( fields, object ) \
+ FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
+
+
+#define FT_FRAME_ENTER( size ) \
+ FT_SET_ERROR( FT_Stream_EnterFrame( stream, size ) )
+
+#define FT_FRAME_EXIT() \
+ FT_Stream_ExitFrame( stream )
+
+#define FT_FRAME_EXTRACT( size, bytes ) \
+ FT_SET_ERROR( FT_Stream_ExtractFrame( stream, size, \
+ (FT_Byte**)&(bytes) ) )
+
+#define FT_FRAME_RELEASE( bytes ) \
+ FT_Stream_ReleaseFrame( stream, (FT_Byte**)&(bytes) )
+
+
+FT_END_HEADER
+
+#endif /* __FTSTREAM_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/fttrace.h b/include/freetype/internal/fttrace.h
new file mode 100644
index 00000000..ffc0b141
--- /dev/null
+++ b/include/freetype/internal/fttrace.h
@@ -0,0 +1,106 @@
+/***************************************************************************/
+/* */
+/* fttrace.h */
+/* */
+/* Tracing handling (specification only). */
+/* */
+/* Copyright 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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. */
+/* */
+/***************************************************************************/
+
+
+/* definitions of trace levels for FreeType 2 */
+
+/* the first level must always be `trace_any' */
+FT_TRACE_DEF( any )
+
+/* base components */
+FT_TRACE_DEF( calc ) /* calculations (ftcalc.c) */
+FT_TRACE_DEF( memory ) /* memory manager (ftobjs.c) */
+FT_TRACE_DEF( stream ) /* stream manager (ftstream.c) */
+FT_TRACE_DEF( io ) /* i/o interface (ftsystem.c) */
+FT_TRACE_DEF( list ) /* list management (ftlist.c) */
+FT_TRACE_DEF( init ) /* initialization (ftinit.c) */
+FT_TRACE_DEF( objs ) /* base objects (ftobjs.c) */
+FT_TRACE_DEF( outline ) /* outline management (ftoutln.c) */
+FT_TRACE_DEF( glyph ) /* glyph management (ftglyph.c) */
+
+FT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */
+FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */
+FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */
+
+/* Cache sub-system */
+FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc..) */
+
+/* SFNT driver components */
+FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */
+FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
+FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
+FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */
+FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */
+
+/* TrueType driver components */
+FT_TRACE_DEF( ttdriver ) /* TT font driver (ttdriver.c) */
+FT_TRACE_DEF( ttgload ) /* TT glyph loader (ttgload.c) */
+FT_TRACE_DEF( ttinterp ) /* bytecode interpreter (ttinterp.c) */
+FT_TRACE_DEF( ttobjs ) /* TT objects manager (ttobjs.c) */
+FT_TRACE_DEF( ttpload ) /* TT data/program loader (ttpload.c) */
+
+/* Type 1 driver components */
+FT_TRACE_DEF( t1driver )
+FT_TRACE_DEF( t1gload )
+FT_TRACE_DEF( t1hint )
+FT_TRACE_DEF( t1load )
+FT_TRACE_DEF( t1objs )
+FT_TRACE_DEF( t1parse )
+
+/* PostScript helper module `psaux' */
+FT_TRACE_DEF( t1decode )
+FT_TRACE_DEF( psobjs )
+
+/* PostScript hinting module `pshinter' */
+FT_TRACE_DEF( pshrec )
+FT_TRACE_DEF( pshalgo1 )
+FT_TRACE_DEF( pshalgo2 )
+
+/* Type 2 driver components */
+FT_TRACE_DEF( cffdriver )
+FT_TRACE_DEF( cffgload )
+FT_TRACE_DEF( cffload )
+FT_TRACE_DEF( cffobjs )
+FT_TRACE_DEF( cffparse )
+
+/* Type 42 driver component */
+FT_TRACE_DEF( t42 )
+
+/* CID driver components */
+FT_TRACE_DEF( cidafm )
+FT_TRACE_DEF( ciddriver )
+FT_TRACE_DEF( cidgload )
+FT_TRACE_DEF( cidload )
+FT_TRACE_DEF( cidobjs )
+FT_TRACE_DEF( cidparse )
+
+/* Windows fonts component */
+FT_TRACE_DEF( winfnt )
+
+/* PCF fonts components */
+FT_TRACE_DEF( pcfdriver )
+FT_TRACE_DEF( pcfread )
+
+/* BDF fonts component */
+FT_TRACE_DEF( bdfdriver )
+FT_TRACE_DEF( bdflib )
+
+/* PFR fonts component */
+FT_TRACE_DEF( pfr )
+
+
+/* END */
diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h
new file mode 100644
index 00000000..872f6ac7
--- /dev/null
+++ b/include/freetype/internal/internal.h
@@ -0,0 +1,57 @@
+/***************************************************************************/
+/* */
+/* internal.h */
+/* */
+/* Internal header files (specification only). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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. */
+/* */
+/***************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* This file is automatically included by `ft2build.h'. */
+ /* Do not include it manually! */
+ /* */
+ /*************************************************************************/
+
+
+#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h>
+#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h>
+#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h>
+#define FT_INTERNAL_EXTENSION_H <freetype/internal/ftextend.h>
+#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
+#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
+#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
+#define FT_INTERNAL_EXTEND_H <freetype/internal/ftextend.h>
+#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h>
+#define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h>
+#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
+#define FT_INTERNAL_HASH_H <freetype/internal/fthash.h>
+#define FT_INTERNAL_OBJECT_H <freetype/internal/ftobject.h>
+
+#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
+#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
+#define FT_INTERNAL_TYPE42_TYPES_H <freetype/internal/t42types.h>
+#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
+#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
+#define FT_INTERNAL_BDF_TYPES_H <freetype/internal/bdftypes.h>
+#define FT_INTERNAL_PFR_H <freetype/internal/pfr.h>
+
+#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
+#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
+#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
+#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>
+
+#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
+
+
+/* END */
diff --git a/include/freetype/internal/pcftypes.h b/include/freetype/internal/pcftypes.h
new file mode 100644
index 00000000..2c924d7d
--- /dev/null
+++ b/include/freetype/internal/pcftypes.h
@@ -0,0 +1,56 @@
+/* pcftypes.h
+
+ FreeType font driver for pcf fonts
+
+ Copyright (C) 2000-2001 by
+ Francesco Zappa Nardelli
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+
+
+#ifndef __PCFTYPES_H__
+#define __PCFTYPES_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ typedef struct PCF_Public_FaceRec_
+ {
+ FT_FaceRec root;
+ FT_StreamRec gzip_stream;
+ FT_Stream gzip_source;
+
+ char* charset_encoding;
+ char* charset_registry;
+
+ } PCF_Public_FaceRec, *PCF_Public_Face;
+
+
+FT_END_HEADER
+
+#endif /* __PCFTYPES_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/pfr.h b/include/freetype/internal/pfr.h
new file mode 100644
index 00000000..cead0781
--- /dev/null
+++ b/include/freetype/internal/pfr.h
@@ -0,0 +1,36 @@
+#ifndef __FT_INTERNAL_PFR_H__
+#define __FT_INTERNAL_PFR_H__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+FT_BEGIN_HEADER
+
+ typedef FT_Error (*FT_PFR_GetMetricsFunc)( FT_Face face,
+ FT_UInt *aoutline,
+ FT_UInt *ametrics,
+ FT_Fixed *ax_scale,
+ FT_Fixed *ay_scale );
+
+ typedef FT_Error (*FT_PFR_GetKerningFunc)( FT_Face face,
+ FT_UInt left,
+ FT_UInt right,
+ FT_Vector *avector );
+
+ typedef FT_Error (*FT_PFR_GetAdvanceFunc)( FT_Face face,
+ FT_UInt gindex,
+ FT_Pos *aadvance );
+
+ typedef struct FT_PFR_ServiceRec_
+ {
+ FT_PFR_GetMetricsFunc get_metrics;
+ FT_PFR_GetKerningFunc get_kerning;
+ FT_PFR_GetAdvanceFunc get_advance;
+
+ } FT_PFR_ServiceRec, *FT_PFR_Service;
+
+#define FT_PFR_SERVICE_NAME "pfr"
+
+FT_END_HEADER
+
+#endif /* __FT_INTERNAL_PFR_H__ */
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
new file mode 100644
index 00000000..e79f83aa
--- /dev/null
+++ b/include/freetype/internal/psaux.h
@@ -0,0 +1,717 @@
+/***************************************************************************/
+/* */
+/* psaux.h */
+/* */
+/* Auxiliary functions and data structures related to PostScript fonts */
+/* (specification). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __PSAUX_H__
+#define __PSAUX_H__
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_TYPE1_TYPES_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** T1_TABLE *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ typedef struct PS_TableRec_* PS_Table;
+ typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* PS_Table_FuncsRec */
+ /* */
+ /* <Description> */
+ /* A set of function pointers to manage PS_Table objects. */
+ /* */
+ /* <Fields> */
+ /* table_init :: Used to initialize a table. */
+ /* */
+ /* table_done :: Finalizes resp. destroy a given table. */
+ /* */
+ /* table_add :: Adds a new object to a table. */
+ /* */
+ /* table_release :: Releases table data, then finalizes it. */
+ /* */
+ typedef struct PS_Table_FuncsRec_
+ {
+ FT_Error
+ (*init)( PS_Table table,
+ FT_Int count,
+ FT_Memory memory );
+
+ void
+ (*done)( PS_Table table );
+
+ FT_Error
+ (*add)( PS_Table table,
+ FT_Int index,
+ void* object,
+ FT_Int length );
+
+ void
+ (*release)( PS_Table table );
+
+ } PS_Table_FuncsRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* PS_TableRec */
+ /* */
+ /* <Description> */
+ /* A PS_Table is a simple object used to store an array of objects in */
+ /* a single memory block. */
+ /* */
+ /* <Fields> */
+ /* block :: The address in memory of the growheap's block. This */
+ /* can change between two object adds, due to */
+ /* reallocation. */
+ /* */
+ /* cursor :: The current top of the grow heap within its block. */
+ /* */
+ /* capacity :: The current size of the heap block. Increments by */
+ /* 1kByte chunks. */
+ /* */
+ /* max_elems :: The maximum number of elements in table. */
+ /* */
+ /* num_elems :: The current number of elements in table. */
+ /* */
+ /* elements :: A table of element addresses within the block. */
+ /* */
+ /* lengths :: A table of element sizes within the block. */
+ /* */
+ /* memory :: The object used for memory operations */
+ /* (alloc/realloc). */
+ /* */
+ /* funcs :: A table of method pointers for this object. */
+ /* */
+ typedef struct PS_TableRec_
+ {
+ FT_Byte* block; /* current memory block */
+ FT_Offset cursor; /* current cursor in memory block */
+ FT_Offset capacity; /* current size of memory block */
+ FT_Long init;
+
+ FT_Int max_elems;
+ FT_Int num_elems;
+ FT_Byte** elements; /* addresses of table elements */
+ FT_Int* lengths; /* lengths of table elements */
+
+ FT_Memory memory;
+ PS_Table_FuncsRec funcs;
+
+ } PS_TableRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** T1 FIELDS & TOKENS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ typedef struct PS_ParserRec_* PS_Parser;
+
+ typedef struct T1_TokenRec_* T1_Token;
+
+ typedef struct T1_FieldRec_* T1_Field;
+
+
+ /* simple enumeration type used to identify token types */
+ typedef enum T1_TokenType_
+ {
+ T1_TOKEN_TYPE_NONE = 0,
+ T1_TOKEN_TYPE_ANY,
+ T1_TOKEN_TYPE_STRING,
+ T1_TOKEN_TYPE_ARRAY,
+
+ /* do not remove */
+ T1_TOKEN_TYPE_MAX
+
+ } T1_TokenType;
+
+
+ /* a simple structure used to identify tokens */
+ typedef struct T1_TokenRec_
+ {
+ FT_Byte* start; /* first character of token in input stream */
+ FT_Byte* limit; /* first character after the token */
+ T1_TokenType type; /* type of token */
+
+ } T1_TokenRec;
+
+
+ /* enumeration type used to identify object fields */
+ typedef enum T1_FieldType_
+ {
+ T1_FIELD_TYPE_NONE = 0,
+ T1_FIELD_TYPE_BOOL,
+ T1_FIELD_TYPE_INTEGER,
+ T1_FIELD_TYPE_FIXED,
+ T1_FIELD_TYPE_STRING,
+ T1_FIELD_TYPE_BBOX,
+ T1_FIELD_TYPE_INTEGER_ARRAY,
+ T1_FIELD_TYPE_FIXED_ARRAY,
+ T1_FIELD_TYPE_CALLBACK,
+
+ /* do not remove */
+ T1_FIELD_TYPE_MAX
+
+ } T1_FieldType;
+
+
+ typedef enum T1_FieldLocation_
+ {
+ T1_FIELD_LOCATION_CID_INFO,
+ T1_FIELD_LOCATION_FONT_DICT,
+ T1_FIELD_LOCATION_FONT_INFO,
+ T1_FIELD_LOCATION_PRIVATE,
+ T1_FIELD_LOCATION_BBOX,
+
+ /* do not remove */
+ T1_FIELD_LOCATION_MAX
+
+ } T1_FieldLocation;
+
+
+ typedef void
+ (*T1_Field_ParseFunc)( FT_Face face,
+ FT_Pointer parser );
+
+
+ /* structure type used to model object fields */
+ typedef struct T1_FieldRec_
+ {
+ const char* ident; /* field identifier */
+ T1_FieldLocation location;
+ T1_FieldType type; /* type of field */
+ T1_Field_ParseFunc reader;
+ FT_UInt offset; /* offset of field in object */
+ FT_Byte size; /* size of field in bytes */
+ FT_UInt array_max; /* maximal number of elements for */
+ /* array */
+ FT_UInt count_offset; /* offset of element count for */
+ /* arrays */
+ } T1_FieldRec;
+
+
+#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname ) \
+ { \
+ _ident, T1CODE, _type, \
+ 0, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE( _fname ), \
+ 0, 0 \
+ },
+
+#define T1_NEW_CALLBACK_FIELD( _ident, _reader ) \
+ { \
+ _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \
+ (T1_Field_ParseFunc)_reader, \
+ 0, 0, \
+ 0, 0 \
+ },
+
+#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \
+ { \
+ _ident, T1CODE, _type, \
+ 0, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE_DELTA( _fname ), \
+ _max, \
+ FT_FIELD_OFFSET( num_ ## _fname ) \
+ },
+
+#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max ) \
+ { \
+ _ident, T1CODE, _type, \
+ 0, \
+ FT_FIELD_OFFSET( _fname ), \
+ FT_FIELD_SIZE_DELTA( _fname ), \
+ _max, 0 \
+ },
+
+
+#define T1_FIELD_TYPE_BOOL( _ident, _fname ) \
+ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname )
+
+#define T1_FIELD_NUM( _ident, _fname ) \
+ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname )
+
+#define T1_FIELD_FIXED( _ident, _fname ) \
+ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname )
+
+#define T1_FIELD_STRING( _ident, _fname ) \
+ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname )
+
+#define T1_FIELD_BBOX( _ident, _fname ) \
+ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname )
+
+
+#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax ) \
+ T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
+ _fname, _fmax )
+
+#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax ) \
+ T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
+ _fname, _fmax )
+
+#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax ) \
+ T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \
+ _fname, _fmax )
+
+#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax ) \
+ T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \
+ _fname, _fmax )
+
+#define T1_FIELD_CALLBACK( _ident, _name ) \
+ T1_NEW_CALLBACK_FIELD( _ident, _name )
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** T1 PARSER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs;
+
+ typedef struct PS_Parser_FuncsRec_
+ {
+ void
+ (*init)( PS_Parser parser,
+ FT_Byte* base,
+ FT_Byte* limit,
+ FT_Memory memory );
+
+ void
+ (*done)( PS_Parser parser );
+
+ void
+ (*skip_spaces)( PS_Parser parser );
+ void
+ (*skip_alpha)( PS_Parser parser );
+
+ FT_Long
+ (*to_int)( PS_Parser parser );
+ FT_Fixed
+ (*to_fixed)( PS_Parser parser,
+ FT_Int power_ten );
+ FT_Int
+ (*to_coord_array)( PS_Parser parser,
+ FT_Int max_coords,
+ FT_Short* coords );
+ FT_Int
+ (*to_fixed_array)( PS_Parser parser,
+ FT_Int max_values,
+ FT_Fixed* values,
+ FT_Int power_ten );
+
+ void
+ (*to_token)( PS_Parser parser,
+ T1_Token token );
+ void
+ (*to_token_array)( PS_Parser parser,
+ T1_Token tokens,
+ FT_UInt max_tokens,
+ FT_Int* pnum_tokens );
+
+ FT_Error
+ (*load_field)( PS_Parser parser,
+ const T1_Field field,
+ void** objects,
+ FT_UInt max_objects,
+ FT_ULong* pflags );
+
+ FT_Error
+ (*load_field_table)( PS_Parser parser,
+ const T1_Field field,
+ void** objects,
+ FT_UInt max_objects,
+ FT_ULong* pflags );
+
+ } PS_Parser_FuncsRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* PS_ParserRec */
+ /* */
+ /* <Description> */
+ /* A PS_Parser is an object used to parse a Type 1 font very quickly. */
+ /* */
+ /* <Fields> */
+ /* cursor :: The current position in the text. */
+ /* */
+ /* base :: Start of the processed text. */
+ /* */
+ /* limit :: End of the processed text. */
+ /* */
+ /* error :: The last error returned. */
+ /* */
+ /* memory :: The object used for memory operations (alloc/realloc). */
+ /* */
+ /* funcs :: A table of functions for the parser. */
+ /* */
+ typedef struct PS_ParserRec_
+ {
+ FT_Byte* cursor;
+ FT_Byte* base;
+ FT_Byte* limit;
+ FT_Error error;
+ FT_Memory memory;
+
+ PS_Parser_FuncsRec funcs;
+
+ } PS_ParserRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** T1 BUILDER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ typedef struct T1_BuilderRec_* T1_Builder;
+
+
+ typedef FT_Error
+ (*T1_Builder_Check_Points_Func)( T1_Builder builder,
+ FT_Int count );
+
+ typedef void
+ (*T1_Builder_Add_Point_Func)( T1_Builder builder,
+ FT_Pos x,
+ FT_Pos y,
+ FT_Byte flag );
+
+ typedef FT_Error
+ (*T1_Builder_Add_Point1_Func)( T1_Builder builder,
+ FT_Pos x,
+ FT_Pos y );
+
+ typedef FT_Error
+ (*T1_Builder_Add_Contour_Func)( T1_Builder builder );
+
+ typedef FT_Error
+ (*T1_Builder_Start_Point_Func)( T1_Builder builder,
+ FT_Pos x,
+ FT_Pos y );
+
+ typedef void
+ (*T1_Builder_Close_Contour_Func)( T1_Builder builder );
+
+
+ typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs;
+
+ typedef struct T1_Builder_FuncsRec_
+ {
+ void
+ (*init)( T1_Builder builder,
+ FT_Face face,
+ FT_Size size,
+ FT_GlyphSlot slot,
+ FT_Bool hinting );
+
+ void
+ (*done)( T1_Builder builder );
+
+ T1_Builder_Check_Points_Func check_points;
+ T1_Builder_Add_Point_Func add_point;
+ T1_Builder_Add_Point1_Func add_point1;
+ T1_Builder_Add_Contour_Func add_contour;
+ T1_Builder_Start_Point_Func start_point;
+ T1_Builder_Close_Contour_Func close_contour;
+
+ } T1_Builder_FuncsRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Structure> */
+ /* T1_BuilderRec */
+ /* */
+ /* <Description> */
+ /* A structure used during glyph loading to store its outline. */
+ /* */
+ /* <Fields> */
+ /* memory :: The current memory object. */
+ /* */
+ /* face :: The current face object. */
+ /* */
+ /* glyph :: The current glyph slot. */
+ /* */
+ /* loader :: XXX */
+ /* */
+ /* base :: The base glyph outline. */
+ /* */
+ /* current :: The current glyph outline. */
+ /* */
+ /* max_points :: maximum points in builder outline */
+ /* */
+ /* max_contours :: Maximal number of contours in builder outline. */
+ /* */
+ /* last :: The last point position. */
+ /* */
+ /* scale_x :: The horizontal scale (FUnits to sub-pixels). */
+ /* */
+ /* scale_y :: The vertical scale (FUnits to sub-pixels). */
+ /* */
+ /* pos_x :: The horizontal translation (if composite glyph). */
+ /* */
+ /* pos_y :: The vertical translation (if composite glyph). */
+ /* */
+ /* left_bearing :: The left side bearing point. */
+ /* */
+ /* advance :: The horizontal advance vector. */
+ /* */
+ /* bbox :: Unused. */
+ /* */
+ /* path_begun :: A flag which indicates that a new path has begun. */
+ /* */
+ /* load_points :: If this flag is not set, no points are loaded. */
+ /* */
+ /* no_recurse :: Set but not used. */
+ /* */
+ /* error :: An error code that is only used to report memory */
+ /* allocation problems. */
+ /* */
+ /* metrics_only :: A boolean indicating that we only want to compute */
+ /* the metrics of a given glyph, not load all of its */
+ /* points. */
+ /* */
+ /* funcs :: An array of function pointers for the builder. */
+ /* */
+ typedef struct T1_BuilderRec_
+ {
+ FT_Memory memory;
+ FT_Face face;
+ FT_GlyphSlot glyph;
+ FT_GlyphLoader loader;
+ FT_Outline* base;
+ FT_Outline* current;
+
+ FT_Vector last;
+
+ FT_Fixed scale_x;
+ FT_Fixed scale_y;
+
+ FT_Pos pos_x;
+ FT_Pos pos_y;
+
+ FT_Vector left_bearing;
+ FT_Vector advance;
+
+ FT_BBox bbox; /* bounding box */
+ FT_Bool path_begun;
+ FT_Bool load_points;
+ FT_Bool no_recurse;
+ FT_Bool shift;
+
+ FT_Error error; /* only used for memory errors */
+ FT_Bool metrics_only;
+
+ void* hints_funcs; /* hinter-specific */
+ void* hints_globals; /* hinter-specific */
+
+ T1_Builder_FuncsRec funcs;
+
+ } T1_BuilderRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** T1 DECODER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+#if 0
+
+ /*************************************************************************/
+ /* */
+ /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
+ /* calls during glyph loading. */
+ /* */
+#define T1_MAX_SUBRS_CALLS 8
+
+
+ /*************************************************************************/
+ /* */
+ /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
+ /* minimum of 16 is required. */
+ /* */
+#define T1_MAX_CHARSTRINGS_OPERANDS 32
+
+#endif /* 0 */
+
+
+ typedef struct T1_Decoder_ZoneRec_
+ {
+ FT_Byte* cursor;
+ FT_Byte* base;
+ FT_Byte* limit;
+
+ } T1_Decoder_ZoneRec, *T1_Decoder_Zone;
+
+
+ typedef struct T1_DecoderRec_* T1_Decoder;
+ typedef const struct T1_Decoder_FuncsRec_* T1_Decoder_Funcs;
+
+
+ typedef FT_Error
+ (*T1_Decoder_Callback)( T1_Decoder decoder,
+ FT_UInt glyph_index );
+
+
+ typedef struct T1_Decoder_FuncsRec_
+ {
+ FT_Error
+ (*init)( T1_Decoder decoder,
+ FT_Face face,
+ FT_Size size,
+ FT_GlyphSlot slot,
+ FT_Byte** glyph_names,
+ PS_Blend blend,
+ FT_Bool hinting,
+ FT_Render_Mode hint_mode,
+ T1_Decoder_Callback callback );
+
+ void
+ (*done)( T1_Decoder decoder );
+
+ FT_Error
+ (*parse_charstrings)( T1_Decoder decoder,
+ FT_Byte* base,
+ FT_UInt len );
+
+ } T1_Decoder_FuncsRec;
+
+
+ typedef struct T1_DecoderRec_
+ {
+ T1_BuilderRec builder;
+
+ FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];
+ FT_Long* top;
+
+ T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1];
+ T1_Decoder_Zone zone;
+
+ PSNames_Service psnames; /* for seac */
+ FT_UInt num_glyphs;
+ FT_Byte** glyph_names;
+
+ FT_Int lenIV; /* internal for sub routine calls */
+ FT_UInt num_subrs;
+ FT_Byte** subrs;
+ FT_Int* subrs_len; /* array of subrs length (optional) */
+
+ FT_Matrix font_matrix;
+ FT_Vector font_offset;
+
+ FT_Int flex_state;
+ FT_Int num_flex_vectors;
+ FT_Vector flex_vectors[7];
+
+ PS_Blend blend; /* for multiple master support */
+
+ FT_UInt32 hint_flags;
+ FT_Render_Mode hint_mode;
+
+ T1_Decoder_Callback parse_callback;
+ T1_Decoder_FuncsRec funcs;
+
+ } T1_DecoderRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** TYPE1 CHARMAPS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ typedef const struct T1_CMap_ClassesRec_* T1_CMap_Classes;
+
+ typedef struct T1_CMap_ClassesRec_
+ {
+ FT_CMap_Class standard;
+ FT_CMap_Class expert;
+ FT_CMap_Class custom;
+ FT_CMap_Class unicode;
+
+ } T1_CMap_ClassesRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** PSAux Module Interface *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ typedef struct PSAux_ServiceRec_
+ {
+ /* don't use `PS_Table_Funcs' and friends to avoid compiler warnings */
+ const PS_Table_FuncsRec* ps_table_funcs;
+ const PS_Parser_FuncsRec* ps_parser_funcs;
+ const T1_Builder_FuncsRec* t1_builder_funcs;
+ const T1_Decoder_FuncsRec* t1_decoder_funcs;
+
+ void
+ (*t1_decrypt)( FT_Byte* buffer,
+ FT_Offset length,
+ FT_UShort seed );
+
+ T1_CMap_Classes t1_cmap_classes;
+
+ } PSAux_ServiceRec, *PSAux_Service;
+
+ /* backwards-compatible type definition */
+ typedef PSAux_ServiceRec PSAux_Interface;
+
+FT_END_HEADER
+
+#endif /* __PSAUX_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/pshints.h b/include/freetype/internal/pshints.h
new file mode 100644
index 00000000..15571d9b
--- /dev/null
+++ b/include/freetype/internal/pshints.h
@@ -0,0 +1,626 @@
+/***************************************************************************/
+/* */
+/* pshints.h */
+/* */
+/* Interface to Postscript-specific (Type 1 and Type 2) hints */
+/* recorders (specification only). These are used to support native */
+/* T1/T2 hints in the "type1", "cid" and "cff" font drivers. */
+/* */
+/* Copyright 2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __PSHINTS_H__
+#define __PSHINTS_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_TYPE1_TABLES_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** INTERNAL REPRESENTATION OF GLOBALS *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ typedef struct PSH_GlobalsRec_* PSH_Globals;
+
+ typedef FT_Error
+ (*PSH_Globals_NewFunc)( FT_Memory memory,
+ T1_Private* private_dict,
+ PSH_Globals* aglobals );
+
+ typedef FT_Error
+ (*PSH_Globals_SetScaleFunc)( PSH_Globals globals,
+ FT_Fixed x_scale,
+ FT_Fixed y_scale,
+ FT_Fixed x_delta,
+ FT_Fixed y_delta );
+
+ typedef void
+ (*PSH_Globals_DestroyFunc)( PSH_Globals globals );
+
+
+ typedef struct PSH_Globals_FuncsRec_
+ {
+ PSH_Globals_NewFunc create;
+ PSH_Globals_SetScaleFunc set_scale;
+ PSH_Globals_DestroyFunc destroy;
+
+ } PSH_Globals_FuncsRec, *PSH_Globals_Funcs;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** PUBLIC TYPE 1 HINTS RECORDER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /*************************************************************************/
+ /* */
+ /* @type: */
+ /* T1_Hints */
+ /* */
+ /* @description: */
+ /* This is a handle to an opaque structure used to record glyph hints */
+ /* from a Type 1 character glyph character string. */
+ /* */
+ /* The methods used to operate on this object are defined by the */
+ /* @T1_Hints_FuncsRec structure. Recording glyph hints is normally */
+ /* achieved through the following scheme: */
+ /* */
+ /* - Open a new hint recording session by calling the "open" method. */
+ /* This will rewind the recorder and prepare it for new input. */
+ /* */
+ /* - For each hint found in the glyph charstring, call the */
+ /* corresponding method ("stem", "stem3", or "reset"). Note that */
+ /* these functions do not return an error code. */
+ /* */
+ /* - Close the recording session by calling the "close" method. It */
+ /* will return an error code if the hints were invalid or something */
+ /* strange happened (e.g. memory shortage). */
+ /* */
+ /* The hints accumulated in the object can later be used by the */
+ /* PostScript hinter. */
+ /* */
+ typedef struct T1_HintsRec_* T1_Hints;
+
+
+ /*************************************************************************/
+ /* */
+ /* @type: */
+ /* T1_Hints_Funcs */
+ /* */
+ /* @description: */
+ /* A pointer to the @T1_Hints_FuncsRec structure that defines the */
+ /* API of a given @T1_Hints object. */
+ /* */
+ typedef const struct T1_Hints_FuncsRec_* T1_Hints_Funcs;
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T1_Hints_OpenFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T1_Hints class used to prepare it for a new */
+ /* Type 1 hints recording session. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 1 hints recorder. */
+ /* */
+ /* @note: */
+ /* You should always call the @T1_Hints_CloseFunc method in order to */
+ /* close an opened recording session. */
+ /* */
+ typedef void
+ (*T1_Hints_OpenFunc)( T1_Hints hints );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T1_Hints_SetStemFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T1_Hints class used to record a new horizontal or */
+ /* vertical stem. This corresponds to the Type 1 "hstem" and "vstem" */
+ /* operators. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 1 hints recorder. */
+ /* */
+ /* dimension :: 0 for horizontal stems (hstem), 1 for vertical ones */
+ /* (vstem). */
+ /* */
+ /* coords :: Array of 2 integers, used as (position,length) stem */
+ /* descriptor. */
+ /* */
+ /* @note: */
+ /* Use vertical coordinates (y) for horizontal stems (dim=0). Use */
+ /* horizontal coordinates (x) for vertical stems (dim=1). */
+ /* */
+ /* "coords[0]" is the absolute stem position (lowest coordinate); */
+ /* "coords[1]" is the length. */
+ /* */
+ /* The length can be negative, in which case it must be either -20 or */
+ /* -21. It will be interpreted as a "ghost" stem, according to */
+ /* Type 1 specification. */
+ /* */
+ /* If the length is -21 (corresponding to a bottom ghost stem), then */
+ /* the real stem position is "coords[0]+coords[1]". */
+ /* */
+ typedef void
+ (*T1_Hints_SetStemFunc)( T1_Hints hints,
+ FT_UInt dimension,
+ FT_Long* coords );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T1_Hints_SetStem3Func */
+ /* */
+ /* @description: */
+ /* A method of the @T1_Hints class used to record three */
+ /* counter-controlled horizontal or vertical stems at once. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 1 hints recorder. */
+ /* */
+ /* dimension :: 0 for horizontal stems, 1 for vertical ones. */
+ /* */
+ /* coords :: An array of 6 integers, holding 3 (position,length) */
+ /* pairs for the counter-controlled stems. */
+ /* */
+ /* @note: */
+ /* Use vertical coordinates (y) for horizontal stems (dim=0). Use */
+ /* horizontal coordinates (x) for vertical stems (dim=1). */
+ /* */
+ /* The lengths cannot be negative (ghost stems are never */
+ /* counter-controlled). */
+ /* */
+ typedef void
+ (*T1_Hints_SetStem3Func)( T1_Hints hints,
+ FT_UInt dimension,
+ FT_Long* coords );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T1_Hints_ResetFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T1_Hints class used to reset the stems hints in a */
+ /* recording session. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 1 hints recorder. */
+ /* */
+ /* end_point :: The index of the last point in the input glyph in */
+ /* which the previously defined hints apply. */
+ /* */
+ typedef void
+ (*T1_Hints_ResetFunc)( T1_Hints hints,
+ FT_UInt end_point );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T1_Hints_CloseFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T1_Hints class used to close a hint recording */
+ /* session. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 1 hints recorder. */
+ /* */
+ /* end_point :: The index of the last point in the input glyph. */
+ /* */
+ /* @return: */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* @note: */
+ /* The error code will be set to indicate that an error occured */
+ /* during the recording session. */
+ /* */
+ typedef FT_Error
+ (*T1_Hints_CloseFunc)( T1_Hints hints,
+ FT_UInt end_point );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T1_Hints_ApplyFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T1_Hints class used to apply hints to the */
+ /* corresponding glyph outline. Must be called once all hints have */
+ /* been recorded. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 1 hints recorder. */
+ /* */
+ /* outline :: A pointer to the target outline descriptor. */
+ /* */
+ /* globals :: The hinter globals for this font. */
+ /* */
+ /* hint_flags :: Hinter bit flags. */
+ /* */
+ /* @return: */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* @note: */
+ /* On input, all points within the outline are in font coordinates. */
+ /* On output, they are in 1/64th of pixels. */
+ /* */
+ /* The scaling transformation is taken from the "globals" object */
+ /* which must correspond to the same font as the glyph. */
+ /* */
+ typedef FT_Error
+ (*T1_Hints_ApplyFunc)( T1_Hints hints,
+ FT_Outline* outline,
+ PSH_Globals globals,
+ FT_Render_Mode hint_mode );
+
+
+ /*************************************************************************/
+ /* */
+ /* @struct: */
+ /* T1_Hints_FuncsRec */
+ /* */
+ /* @description: */
+ /* The structure used to provide the API to @T1_Hints objects. */
+ /* */
+ /* @fields: */
+ /* hints :: A handle to the T1 Hints recorder. */
+ /* */
+ /* open :: The function to open a recording session. */
+ /* */
+ /* close :: The function to close a recording session. */
+ /* */
+ /* stem :: The function to set a simple stem. */
+ /* */
+ /* stem3 :: The function to set counter-controlled stems. */
+ /* */
+ /* reset :: The function to reset stem hints. */
+ /* */
+ /* apply :: The function to apply the hints to the corresponding */
+ /* glyph outline. */
+ /* */
+ typedef struct T1_Hints_FuncsRec_
+ {
+ T1_Hints hints;
+ T1_Hints_OpenFunc open;
+ T1_Hints_CloseFunc close;
+ T1_Hints_SetStemFunc stem;
+ T1_Hints_SetStem3Func stem3;
+ T1_Hints_ResetFunc reset;
+ T1_Hints_ApplyFunc apply;
+
+ } T1_Hints_FuncsRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /***** *****/
+ /***** PUBLIC TYPE 2 HINTS RECORDER *****/
+ /***** *****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+ /*************************************************************************/
+ /* */
+ /* @type: */
+ /* T2_Hints */
+ /* */
+ /* @description: */
+ /* This is a handle to an opaque structure used to record glyph hints */
+ /* from a Type 2 character glyph character string. */
+ /* */
+ /* The methods used to operate on this object are defined by the */
+ /* @T2_Hints_FuncsRec structure. Recording glyph hints is normally */
+ /* achieved through the following scheme: */
+ /* */
+ /* - Open a new hint recording session by calling the "open" method. */
+ /* This will rewind the recorder and prepare it for new input. */
+ /* */
+ /* - For each hint found in the glyph charstring, call the */
+ /* corresponding method ("stems", "hintmask", "counters"). Note */
+ /* that these functions do not return an error code. */
+ /* */
+ /* - Close the recording session by calling the "close" method. It */
+ /* will return an error code if the hints were invalid or something */
+ /* strange happened (e.g. memory shortage). */
+ /* */
+ /* The hints accumulated in the object can later be used by the */
+ /* Postscript hinter. */
+ /* */
+ typedef struct T2_HintsRec_* T2_Hints;
+
+
+ /*************************************************************************/
+ /* */
+ /* @type: */
+ /* T2_Hints_Funcs */
+ /* */
+ /* @description: */
+ /* A pointer to the @T2_Hints_FuncsRec structure that defines the API */
+ /* of a given @T2_Hints object. */
+ /* */
+ typedef const struct T2_Hints_FuncsRec_* T2_Hints_Funcs;
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T2_Hints_OpenFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T2_Hints class used to prepare it for a new */
+ /* Type 2 hints recording session. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 2 hints recorder. */
+ /* */
+ /* @note: */
+ /* You should always call the @T2_Hints_CloseFunc method in order to */
+ /* close an opened recording session. */
+ /* */
+ typedef void
+ (*T2_Hints_OpenFunc)( T2_Hints hints );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T2_Hints_StemsFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T2_Hints class used to set the table of stems in */
+ /* either the vertical or horizontal dimension. Equivalent to the */
+ /* "hstem", "vstem", "hstemhm", and "vstemhm" Type 2 operators. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 2 hints recorder. */
+ /* */
+ /* dimension :: 0 for horizontal stems (hstem), 1 for vertical ones */
+ /* (vstem). */
+ /* */
+ /* count :: The number of stems. */
+ /* */
+ /* coords :: An array of "count" (position,length) pairs. */
+ /* */
+ /* @note: */
+ /* Use vertical coordinates (y) for horizontal stems (dim=0). Use */
+ /* horizontal coordinates (x) for vertical stems (dim=1). */
+ /* */
+ /* There are "2*count" elements in the "coords" aray. Each even */
+ /* element is an absolute position in font units, each odd element is */
+ /* a length in font units. */
+ /* */
+ /* A length can be negative, in which case it must be either -20 or */
+ /* -21. It will be interpreted as a "ghost" stem, according to the */
+ /* Type 1 specification. */
+ /* */
+ typedef void
+ (*T2_Hints_StemsFunc)( T2_Hints hints,
+ FT_UInt dimension,
+ FT_UInt count,
+ FT_Fixed* coordinates );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T2_Hints_MaskFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T2_Hints class used to set a given hintmask */
+ /* (this corresponds to the "hintmask" Type 2 operator). */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 2 hints recorder. */
+ /* */
+ /* end_point :: The glyph index of the last point to which the */
+ /* previously defined/activated hints apply. */
+ /* */
+ /* bit_count :: The number of bits in the hint mask. */
+ /* */
+ /* bytes :: An array of bytes modelling the hint mask. */
+ /* */
+ /* @note: */
+ /* If the hintmask starts the charstring (before any glyph point */
+ /* definition), the value of "end_point" should be 0. */
+ /* */
+ /* "bit_count" is the number of meaningful bits in the "bytes" array; */
+ /* it must be equal to the total number of hints defined so far */
+ /* (i.e. horizontal+verticals). */
+ /* */
+ /* The "bytes" array can come directly from the Type 2 charstring and */
+ /* respects the same format. */
+ /* */
+ typedef void
+ (*T2_Hints_MaskFunc)( T2_Hints hints,
+ FT_UInt end_point,
+ FT_UInt bit_count,
+ const FT_Byte* bytes );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T2_Hints_CounterFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T2_Hints class used to set a given counter mask */
+ /* (this corresponds to the "hintmask" Type 2 operator). */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 2 hints recorder. */
+ /* */
+ /* end_point :: A glyph index of the last point to which the */
+ /* previously defined/active hints apply. */
+ /* */
+ /* bit_count :: The number of bits in the hint mask. */
+ /* */
+ /* bytes :: An array of bytes modelling the hint mask. */
+ /* */
+ /* @note: */
+ /* If the hintmask starts the charstring (before any glyph point */
+ /* definition), the value of "end_point" should be 0. */
+ /* */
+ /* "bit_count" is the number of meaningful bits in the "bytes" array; */
+ /* it must be equal to the total number of hints defined so far */
+ /* (i.e. horizontal+verticals). */
+ /* */
+ /* The "bytes" array can come directly from the Type 2 charstring and */
+ /* respects the same format. */
+ /* */
+ typedef void
+ (*T2_Hints_CounterFunc)( T2_Hints hints,
+ FT_UInt bit_count,
+ const FT_Byte* bytes );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T2_Hints_CloseFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T2_Hints class used to close a hint recording */
+ /* session. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 2 hints recorder. */
+ /* */
+ /* end_point :: The index of the last point in the input glyph. */
+ /* */
+ /* @return: */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* @note: */
+ /* The error code will be set to indicate that an error occured */
+ /* during the recording session. */
+ /* */
+ typedef FT_Error
+ (*T2_Hints_CloseFunc)( T2_Hints hints,
+ FT_UInt end_point );
+
+
+ /*************************************************************************/
+ /* */
+ /* @functype: */
+ /* T2_Hints_ApplyFunc */
+ /* */
+ /* @description: */
+ /* A method of the @T2_Hints class used to apply hints to the */
+ /* corresponding glyph outline. Must be called after the "close" */
+ /* method. */
+ /* */
+ /* @input: */
+ /* hints :: A handle to the Type 2 hints recorder. */
+ /* */
+ /* outline :: A pointer to the target outline descriptor. */
+ /* */
+ /* globals :: The hinter globals for this font. */
+ /* */
+ /* hint_flags :: Hinter bit flags. */
+ /* */
+ /* @return: */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* @note: */
+ /* On input, all points within the outline are in font coordinates. */
+ /* On output, they are in 1/64th of pixels. */
+ /* */
+ /* The scaling transformation is taken from the "globals" object */
+ /* which must correspond to the same font than the glyph. */
+ /* */
+ typedef FT_Error
+ (*T2_Hints_ApplyFunc)( T2_Hints hints,
+ FT_Outline* outline,
+ PSH_Globals globals,
+ FT_Render_Mode hint_mode );
+
+
+ /*************************************************************************/
+ /* */
+ /* @struct: */
+ /* T2_Hints_FuncsRec */
+ /* */
+ /* @description: */
+ /* The structure used to provide the API to @T2_Hints objects. */
+ /* */
+ /* @fields: */
+ /* hints :: A handle to the T2 hints recorder object. */
+ /* */
+ /* open :: The function to open a recording session. */
+ /* */
+ /* close :: The function to close a recording session. */
+ /* */
+ /* stems :: The function to set the dimension's stems table. */
+ /* */
+ /* hintmask :: The function to set hint masks. */
+ /* */
+ /* counter :: The function to set counter masks. */
+ /* */
+ /* apply :: The function to apply the hints on the corresponding */
+ /* glyph outline. */
+ /* */
+ typedef struct T2_Hints_FuncsRec_
+ {
+ T2_Hints hints;
+ T2_Hints_OpenFunc open;
+ T2_Hints_CloseFunc close;
+ T2_Hints_StemsFunc stems;
+ T2_Hints_MaskFunc hintmask;
+ T2_Hints_CounterFunc counter;
+ T2_Hints_ApplyFunc apply;
+
+ } T2_Hints_FuncsRec;
+
+
+ /* */
+
+
+ typedef struct PSHinter_Interface_
+ {
+ PSH_Globals_Funcs (*get_globals_funcs)( FT_Module module );
+ T1_Hints_Funcs (*get_t1_funcs) ( FT_Module module );
+ T2_Hints_Funcs (*get_t2_funcs) ( FT_Module module );
+
+ } PSHinter_Interface;
+
+ typedef PSHinter_Interface* PSHinter_Service;
+
+
+FT_END_HEADER
+
+#endif /* __PSHINTS_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/psnames.h b/include/freetype/internal/psnames.h
new file mode 100644
index 00000000..0f4ec86a
--- /dev/null
+++ b/include/freetype/internal/psnames.h
@@ -0,0 +1,241 @@
+/***************************************************************************/
+/* */
+/* psnames.h */
+/* */
+/* High-level interface for the `PSNames' module (in charge of */
+/* various functions related to Postscript glyph names conversion). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __PSNAMES_H__
+#define __PSNAMES_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* PS_Unicode_Value_Func */
+ /* */
+ /* <Description> */
+ /* A function used to return the Unicode index corresponding to a */
+ /* given glyph name. */
+ /* */
+ /* <Input> */
+ /* glyph_name :: The glyph name. */
+ /* */
+ /* <Return> */
+ /* The Unicode character index resp. the non-Unicode value 0xFFFF if */
+ /* the glyph name has no known Unicode meaning. */
+ /* */
+ /* <Note> */
+ /* This function is able to map several different glyph names to the */
+ /* same Unicode value, according to the rules defined in the Adobe */
+ /* Glyph List table. */
+ /* */
+ /* This function will not be compiled if the configuration macro */
+ /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined. */
+ /* */
+ typedef FT_UInt32
+ (*PS_Unicode_Value_Func)( const char* glyph_name );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* PS_Unicode_Index_Func */
+ /* */
+ /* <Description> */
+ /* A function used to return the glyph index corresponding to a given */
+ /* Unicode value. */
+ /* */
+ /* <Input> */
+ /* num_glyphs :: The number of glyphs in the face. */
+ /* */
+ /* glyph_names :: An array of glyph name pointers. */
+ /* */
+ /* unicode :: The Unicode value. */
+ /* */
+ /* <Return> */
+ /* The glyph index resp. 0xFFFF if no glyph corresponds to this */
+ /* Unicode value. */
+ /* */
+ /* <Note> */
+ /* This function is able to recognize several glyph names per Unicode */
+ /* value, according to the Adobe Glyph List. */
+ /* */
+ /* This function will not be compiled if the configuration macro */
+ /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined. */
+ /* */
+ typedef FT_UInt
+ (*PS_Unicode_Index_Func)( FT_UInt num_glyphs,
+ const char** glyph_names,
+ FT_ULong unicode );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* PS_Macintosh_Name_Func */
+ /* */
+ /* <Description> */
+ /* A function used to return the glyph name corresponding to an Apple */
+ /* glyph name index. */
+ /* */
+ /* <Input> */
+ /* name_index :: The index of the Mac name. */
+ /* */
+ /* <Return> */
+ /* The glyph name, or 0 if the index is invalid. */
+ /* */
+ /* <Note> */
+ /* This function will not be compiled if the configuration macro */
+ /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined. */
+ /* */
+ typedef const char*
+ (*PS_Macintosh_Name_Func)( FT_UInt name_index );
+
+
+ typedef const char*
+ (*PS_Adobe_Std_Strings_Func)( FT_UInt string_index );
+
+
+ typedef struct PS_UniMap_
+ {
+ FT_UInt unicode;
+ FT_UInt glyph_index;
+
+ } PS_UniMap;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* PS_Unicodes */
+ /* */
+ /* <Description> */
+ /* A simple table used to map Unicode values to glyph indices. It is */
+ /* built by the PS_Build_Unicodes table according to the glyphs */
+ /* present in a font file. */
+ /* */
+ /* <Fields> */
+ /* num_codes :: The number of glyphs in the font that match a given */
+ /* Unicode value. */
+ /* */
+ /* unicodes :: An array of unicode values, sorted in increasing */
+ /* order. */
+ /* */
+ /* gindex :: An array of glyph indices, corresponding to each */
+ /* Unicode value. */
+ /* */
+ /* <Note> */
+ /* Use the function PS_Lookup_Unicode() to retrieve the glyph index */
+ /* corresponding to a given Unicode character code. */
+ /* */
+ typedef struct PS_Unicodes_
+ {
+ FT_UInt num_maps;
+ PS_UniMap* maps;
+
+ } PS_Unicodes;
+
+
+ typedef FT_Error
+ (*PS_Build_Unicodes_Func)( FT_Memory memory,
+ FT_UInt num_glyphs,
+ const char** glyph_names,
+ PS_Unicodes* unicodes );
+
+ typedef FT_UInt
+ (*PS_Lookup_Unicode_Func)( PS_Unicodes* unicodes,
+ FT_UInt unicode );
+
+ typedef FT_ULong
+ (*PS_Next_Unicode_Func)( PS_Unicodes* unicodes,
+ FT_ULong unicode );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* PSNames_Interface */
+ /* */
+ /* <Description> */
+ /* This structure defines the PSNames interface. */
+ /* */
+ /* <Fields> */
+ /* unicode_value :: A function used to convert a glyph name */
+ /* into a Unicode character code. */
+ /* */
+ /* build_unicodes :: A function which builds up the Unicode */
+ /* mapping table. */
+ /* */
+ /* lookup_unicode :: A function used to return the glyph index */
+ /* corresponding to a given Unicode */
+ /* character. */
+ /* */
+ /* macintosh_name :: A function used to return the standard */
+ /* Apple glyph Postscript name corresponding */
+ /* to a given string index (used by the */
+ /* TrueType `post' table). */
+ /* */
+ /* adobe_std_strings :: A function that returns a pointer to a */
+ /* Adobe Standard String for a given SID. */
+ /* */
+ /* adobe_std_encoding :: A table of 256 unsigned shorts that maps */
+ /* character codes in the Adobe Standard */
+ /* Encoding to SIDs. */
+ /* */
+ /* adobe_expert_encoding :: A table of 256 unsigned shorts that maps */
+ /* character codes in the Adobe Expert */
+ /* Encoding to SIDs. */
+ /* */
+ /* <Note> */
+ /* `unicode_value' and `unicode_index' will be set to 0 if the */
+ /* configuration macro FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is */
+ /* undefined. */
+ /* */
+ /* `macintosh_name' will be set to 0 if the configuration macro */
+ /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined. */
+ /* */
+ typedef struct PSNames_Interface_
+ {
+ PS_Unicode_Value_Func unicode_value;
+ PS_Build_Unicodes_Func build_unicodes;
+ PS_Lookup_Unicode_Func lookup_unicode;
+ PS_Macintosh_Name_Func macintosh_name;
+
+ PS_Adobe_Std_Strings_Func adobe_std_strings;
+ const unsigned short* adobe_std_encoding;
+ const unsigned short* adobe_expert_encoding;
+
+ PS_Next_Unicode_Func next_unicode;
+
+ } PSNames_Interface;
+
+
+ typedef PSNames_Interface* PSNames_Service;
+
+
+FT_END_HEADER
+
+#endif /* __PSNAMES_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/sfnt.h b/include/freetype/internal/sfnt.h
new file mode 100644
index 00000000..89e91909
--- /dev/null
+++ b/include/freetype/internal/sfnt.h
@@ -0,0 +1,534 @@
+/***************************************************************************/
+/* */
+/* sfnt.h */
+/* */
+/* High-level `sfnt' driver interface (specification). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __SFNT_H__
+#define __SFNT_H__
+
+
+#include <ft2build.h>
+#include FT_INTERNAL_DRIVER_H
+#include FT_INTERNAL_TRUETYPE_TYPES_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Init_Face_Func */
+ /* */
+ /* <Description> */
+ /* First part of the SFNT face object initialization. This will find */
+ /* the face in a SFNT file or collection, and load its format tag in */
+ /* face->format_tag. */
+ /* */
+ /* <Input> */
+ /* stream :: The input stream. */
+ /* */
+ /* face :: A handle to the target face object. */
+ /* */
+ /* face_index :: The index of the TrueType font, if we are opening a */
+ /* collection. */
+ /* */
+ /* num_params :: The number of additional parameters. */
+ /* */
+ /* params :: Optional additional parameters. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* The stream cursor must be at the font file's origin. */
+ /* */
+ /* This function recognizes fonts embedded in a `TrueType */
+ /* collection'. */
+ /* */
+ /* Once the format tag has been validated by the font driver, it */
+ /* should then call the TT_Load_Face_Func() callback to read the rest */
+ /* of the SFNT tables in the object. */
+ /* */
+ typedef FT_Error
+ (*TT_Init_Face_Func)( FT_Stream stream,
+ TT_Face face,
+ FT_Int face_index,
+ FT_Int num_params,
+ FT_Parameter* params );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Load_Face_Func */
+ /* */
+ /* <Description> */
+ /* Second part of the SFNT face object initialization. This will */
+ /* load the common SFNT tables (head, OS/2, maxp, metrics, etc.) in */
+ /* the face object. */
+ /* */
+ /* <Input> */
+ /* stream :: The input stream. */
+ /* */
+ /* face :: A handle to the target face object. */
+ /* */
+ /* face_index :: The index of the TrueType font, if we are opening a */
+ /* collection. */
+ /* */
+ /* num_params :: The number of additional parameters. */
+ /* */
+ /* params :: Optional additional parameters. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* This function must be called after TT_Init_Face_Func(). */
+ /* */
+ typedef FT_Error
+ (*TT_Load_Face_Func)( FT_Stream stream,
+ TT_Face face,
+ FT_Int face_index,
+ FT_Int num_params,
+ FT_Parameter* params );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Done_Face_Func */
+ /* */
+ /* <Description> */
+ /* A callback used to delete the common SFNT data from a face. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the target face object. */
+ /* */
+ /* <Note> */
+ /* This function does NOT destroy the face object. */
+ /* */
+ typedef void
+ (*TT_Done_Face_Func)( TT_Face face );
+
+
+ typedef FT_Module_Interface
+ (*SFNT_Get_Interface_Func)( FT_Module module,
+ const char* func_interface );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Load_SFNT_HeaderRec_Func */
+ /* */
+ /* <Description> */
+ /* Loads the header of a SFNT font file. Supports collections. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the target face object. */
+ /* */
+ /* stream :: The input stream. */
+ /* */
+ /* face_index :: The index of the TrueType font, if we are opening a */
+ /* collection. */
+ /* */
+ /* <Output> */
+ /* sfnt :: The SFNT header. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* The stream cursor must be at the font file's origin. */
+ /* */
+ /* This function recognizes fonts embedded in a `TrueType */
+ /* collection'. */
+ /* */
+ /* This function checks that the header is valid by looking at the */
+ /* values of `search_range', `entry_selector', and `range_shift'. */
+ /* */
+ typedef FT_Error
+ (*TT_Load_SFNT_HeaderRec_Func)( TT_Face face,
+ FT_Stream stream,
+ FT_Long face_index,
+ SFNT_Header sfnt );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Load_Directory_Func */
+ /* */
+ /* <Description> */
+ /* Loads the table directory into a face object. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the target face object. */
+ /* */
+ /* stream :: The input stream. */
+ /* */
+ /* sfnt :: The SFNT header. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* The stream cursor must be on the first byte after the 4-byte font */
+ /* format tag. This is the case just after a call to */
+ /* TT_Load_Format_Tag(). */
+ /* */
+ typedef FT_Error
+ (*TT_Load_Directory_Func)( TT_Face face,
+ FT_Stream stream,
+ SFNT_Header sfnt );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Load_Any_Func */
+ /* */
+ /* <Description> */
+ /* Loads any font table into client memory. */
+ /* */
+ /* <Input> */
+ /* face :: The face object to look for. */
+ /* */
+ /* tag :: The tag of table to load. Use the value 0 if you want */
+ /* to access the whole font file, else set this parameter */
+ /* to a valid TrueType table tag that you can forge with */
+ /* the MAKE_TT_TAG macro. */
+ /* */
+ /* offset :: The starting offset in the table (or the file if */
+ /* tag == 0). */
+ /* */
+ /* length :: The address of the decision variable: */
+ /* */
+ /* If length == NULL: */
+ /* Loads the whole table. Returns an error if */
+ /* `offset' == 0! */
+ /* */
+ /* If *length == 0: */
+ /* Exits immediately; returning the length of the given */
+ /* table or of the font file, depending on the value of */
+ /* `tag'. */
+ /* */
+ /* If *length != 0: */
+ /* Loads the next `length' bytes of table or font, */
+ /* starting at offset `offset' (in table or font too). */
+ /* */
+ /* <Output> */
+ /* buffer :: The address of target buffer. */
+ /* */
+ /* <Return> */
+ /* TrueType error code. 0 means success. */
+ /* */
+ typedef FT_Error
+ (*TT_Load_Any_Func)( TT_Face face,
+ FT_ULong tag,
+ FT_Long offset,
+ FT_Byte *buffer,
+ FT_ULong* length );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Load_SBit_Image_Func */
+ /* */
+ /* <Description> */
+ /* Loads a given glyph sbit image from the font resource. This also */
+ /* returns its metrics. */
+ /* */
+ /* <Input> */
+ /* face :: The target face object. */
+ /* */
+ /* x_ppem :: The horizontal resolution in points per EM. */
+ /* */
+ /* y_ppem :: The vertical resolution in points per EM. */
+ /* */
+ /* glyph_index :: The current glyph index. */
+ /* */
+ /* stream :: The input stream. */
+ /* */
+ /* <Output> */
+ /* amap :: The target pixmap. */
+ /* */
+ /* ametrics :: A big sbit metrics structure for the glyph image. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. Returns an error if no */
+ /* glyph sbit exists for the index. */
+ /* */
+ /* <Note> */
+ /* The `map.buffer' field is always freed before the glyph is loaded. */
+ /* */
+ typedef FT_Error
+ (*TT_Load_SBit_Image_Func)( TT_Face face,
+ FT_ULong strike_index,
+ FT_UInt glyph_index,
+ FT_UInt load_flags,
+ FT_Stream stream,
+ FT_Bitmap *amap,
+ TT_SBit_MetricsRec *ametrics );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Set_SBit_Strike_Func */
+ /* */
+ /* <Description> */
+ /* Selects an sbit strike for given horizontal and vertical ppem */
+ /* values. */
+ /* */
+ /* <Input> */
+ /* face :: The target face object. */
+ /* */
+ /* x_ppem :: The horizontal resolution in points per EM. */
+ /* */
+ /* y_ppem :: The vertical resolution in points per EM. */
+ /* */
+ /* <Output> */
+ /* astrike_index :: The index of the sbit strike. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. Returns an error if no */
+ /* sbit strike exists for the selected ppem values. */
+ /* */
+ typedef FT_Error
+ (*TT_Set_SBit_Strike_Func)( TT_Face face,
+ FT_Int x_ppem,
+ FT_Int y_ppem,
+ FT_ULong *astrike_index );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Get_PS_Name_Func */
+ /* */
+ /* <Description> */
+ /* Gets the PostScript glyph name of a glyph. */
+ /* */
+ /* <Input> */
+ /* idx :: The glyph index. */
+ /* */
+ /* PSname :: The address of a string pointer. Will be NULL in case */
+ /* of error, otherwise it is a pointer to the glyph name. */
+ /* */
+ /* You must not modify the returned string! */
+ /* */
+ /* <Output> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ typedef FT_Error
+ (*TT_Get_PS_Name_Func)( TT_Face face,
+ FT_UInt idx,
+ FT_String** PSname );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Load_Metrics_Func */
+ /* */
+ /* <Description> */
+ /* Loads the horizontal or vertical header in a face object. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the target face object. */
+ /* */
+ /* stream :: The input stream. */
+ /* */
+ /* vertical :: A boolean flag. If set, load vertical metrics. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ typedef FT_Error
+ (*TT_Load_Metrics_Func)( TT_Face face,
+ FT_Stream stream,
+ FT_Bool vertical );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_CharMap_Load_Func */
+ /* */
+ /* <Description> */
+ /* Loads a given TrueType character map into memory. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the parent face object. */
+ /* */
+ /* stream :: A handle to the current stream object. */
+ /* */
+ /* <InOut> */
+ /* cmap :: A pointer to a cmap object. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* The function assumes that the stream is already in use (i.e., */
+ /* opened). In case of error, all partially allocated tables are */
+ /* released. */
+ /* */
+ typedef FT_Error
+ (*TT_CharMap_Load_Func)( TT_Face face,
+ TT_CMapTable cmap,
+ FT_Stream input );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_CharMap_Free_Func */
+ /* */
+ /* <Description> */
+ /* Destroys a character mapping table. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the parent face object. */
+ /* */
+ /* cmap :: A handle to a cmap object. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ typedef FT_Error
+ (*TT_CharMap_Free_Func)( TT_Face face,
+ TT_CMapTable cmap );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Load_Table_Func */
+ /* */
+ /* <Description> */
+ /* Loads a given TrueType table. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the target face object. */
+ /* */
+ /* stream :: The input stream. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* The function will use `face->goto_table' to seek the stream to */
+ /* the start of the table. */
+ /* */
+ typedef FT_Error
+ (*TT_Load_Table_Func)( TT_Face face,
+ FT_Stream stream );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Free_Table_Func */
+ /* */
+ /* <Description> */
+ /* Frees a given TrueType table. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the target face object. */
+ /* */
+ typedef void
+ (*TT_Free_Table_Func)( TT_Face face );
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* SFNT_Interface */
+ /* */
+ /* <Description> */
+ /* This structure holds pointers to the functions used to load and */
+ /* free the basic tables that are required in a `sfnt' font file. */
+ /* */
+ /* <Fields> */
+ /* Check the various xxx_Func() descriptions for details. */
+ /* */
+ typedef struct SFNT_Interface_
+ {
+ TT_Loader_GotoTableFunc goto_table;
+
+ TT_Init_Face_Func init_face;
+ TT_Load_Face_Func load_face;
+ TT_Done_Face_Func done_face;
+ SFNT_Get_Interface_Func get_interface;
+
+ TT_Load_Any_Func load_any;
+ TT_Load_SFNT_HeaderRec_Func load_sfnt_header;
+ TT_Load_Directory_Func load_directory;
+
+ /* these functions are called by `load_face' but they can also */
+ /* be called from external modules, if there is a need to do so */
+ TT_Load_Table_Func load_header;
+ TT_Load_Metrics_Func load_metrics;
+ TT_Load_Table_Func load_charmaps;
+ TT_Load_Table_Func load_max_profile;
+ TT_Load_Table_Func load_os2;
+ TT_Load_Table_Func load_psnames;
+
+ TT_Load_Table_Func load_names;
+ TT_Free_Table_Func free_names;
+
+ /* optional tables */
+ TT_Load_Table_Func load_hdmx;
+ TT_Free_Table_Func free_hdmx;
+
+ TT_Load_Table_Func load_kerning;
+ TT_Load_Table_Func load_gasp;
+ TT_Load_Table_Func load_pclt;
+
+ /* see `ttload.h' */
+ TT_Load_Table_Func load_bitmap_header;
+
+ /* see `ttsbit.h' */
+ TT_Set_SBit_Strike_Func set_sbit_strike;
+ TT_Load_Table_Func load_sbits;
+ TT_Load_SBit_Image_Func load_sbit_image;
+ TT_Free_Table_Func free_sbits;
+
+ /* see `ttpost.h' */
+ TT_Get_PS_Name_Func get_psname;
+ TT_Free_Table_Func free_psnames;
+
+ /* see `ttcmap.h' */
+ TT_CharMap_Load_Func load_charmap;
+ TT_CharMap_Free_Func free_charmap;
+
+ } SFNT_Interface;
+
+
+ /* transitional */
+ typedef SFNT_Interface* SFNT_Service;
+
+
+FT_END_HEADER
+
+#endif /* __SFNT_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
new file mode 100644
index 00000000..26253946
--- /dev/null
+++ b/include/freetype/internal/t1types.h
@@ -0,0 +1,199 @@
+/***************************************************************************/
+/* */
+/* t1types.h */
+/* */
+/* Basic Type1/Type2 type definitions and interface (specification */
+/* only). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __T1TYPES_H__
+#define __T1TYPES_H__
+
+
+#include <ft2build.h>
+#include FT_TYPE1_TABLES_H
+#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*** ***/
+ /*** ***/
+ /*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/
+ /*** ***/
+ /*** ***/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* T1_EncodingRec */
+ /* */
+ /* <Description> */
+ /* A structure modeling a custom encoding. */
+ /* */
+ /* <Fields> */
+ /* num_chars :: The number of character codes in the encoding. */
+ /* Usually 256. */
+ /* */
+ /* code_first :: The lowest valid character code in the encoding. */
+ /* */
+ /* code_last :: The highest valid character code in the encoding. */
+ /* */
+ /* char_index :: An array of corresponding glyph indices. */
+ /* */
+ /* char_name :: An array of corresponding glyph names. */
+ /* */
+ typedef struct T1_EncodingRecRec_
+ {
+ FT_Int num_chars;
+ FT_Int code_first;
+ FT_Int code_last;
+
+ FT_UShort* char_index;
+ FT_String** char_name;
+
+ } T1_EncodingRec, *T1_Encoding;
+
+
+ typedef enum T1_EncodingType_
+ {
+ T1_ENCODING_TYPE_NONE = 0,
+ T1_ENCODING_TYPE_ARRAY,
+ T1_ENCODING_TYPE_STANDARD,
+ T1_ENCODING_TYPE_ISOLATIN1,
+ T1_ENCODING_TYPE_EXPERT
+
+ } T1_EncodingType;
+
+
+ typedef struct T1_FontRec_
+ {
+ PS_FontInfoRec font_info; /* font info dictionary */
+ PS_PrivateRec private_dict; /* private dictionary */
+ FT_String* font_name; /* top-level dictionary */
+
+ T1_EncodingType encoding_type;
+ T1_EncodingRec encoding;
+
+ FT_Byte* subrs_block;
+ FT_Byte* charstrings_block;
+ FT_Byte* glyph_names_block;
+
+ FT_Int num_subrs;
+ FT_Byte** subrs;
+ FT_Int* subrs_len;
+
+ FT_Int num_glyphs;
+ FT_String** glyph_names; /* array of glyph names */
+ FT_Byte** charstrings; /* array of glyph charstrings */
+ FT_Int* charstrings_len;
+
+ FT_Byte paint_type;
+ FT_Byte font_type;
+ FT_Matrix font_matrix;
+ FT_Vector font_offset;
+ FT_BBox font_bbox;
+ FT_Long font_id;
+
+ FT_Int stroke_width;
+
+ } T1_FontRec, *T1_Font;
+
+
+ typedef struct CID_SubrsRec_
+ {
+ FT_UInt num_subrs;
+ FT_Byte** code;
+
+ } CID_SubrsRec, *CID_Subrs;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*** ***/
+ /*** ***/
+ /*** ORIGINAL T1_FACE CLASS DEFINITION ***/
+ /*** ***/
+ /*** ***/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* This structure/class is defined here because it is common to the */
+ /* following formats: TTF, OpenType-TT, and OpenType-CFF. */
+ /* */
+ /* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
+ /* are not shared between font drivers, and are thus defined normally in */
+ /* `ttobjs.h'. */
+ /* */
+ /*************************************************************************/
+
+ typedef struct T1_FaceRec_* T1_Face;
+ typedef struct CID_FaceRec_* CID_Face;
+
+
+ typedef struct T1_FaceRec_
+ {
+ FT_FaceRec root;
+ T1_FontRec type1;
+ const void* psnames;
+ const void* psaux;
+ const void* afm_data;
+ FT_CharMapRec charmaprecs[2];
+ FT_CharMap charmaps[2];
+ PS_Unicodes unicode_map;
+
+ /* support for Multiple Masters fonts */
+ PS_Blend blend;
+
+ /* since FT 2.1 - interface to PostScript hinter */
+ const void* pshinter;
+
+ } T1_FaceRec;
+
+
+ typedef struct CID_FaceRec_
+ {
+ FT_FaceRec root;
+ void* psnames;
+ void* psaux;
+ CID_FaceInfoRec cid;
+ void* afm_data;
+ CID_Subrs subrs;
+
+ /* since FT 2.1 - interface to PostScript hinter */
+ void* pshinter;
+
+ } CID_FaceRec;
+
+
+FT_END_HEADER
+
+#endif /* __T1TYPES_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/t42types.h b/include/freetype/internal/t42types.h
new file mode 100644
index 00000000..7562252e
--- /dev/null
+++ b/include/freetype/internal/t42types.h
@@ -0,0 +1,55 @@
+/***************************************************************************/
+/* */
+/* t42types.h */
+/* */
+/* Type 42 font data types (specification only). */
+/* */
+/* Copyright 2002 by Roberto Alameda. */
+/* */
+/* 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 __T42TYPES_H__
+#define __T42TYPES_H__
+
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_TYPE1_TABLES_H
+#include FT_INTERNAL_TYPE1_TYPES_H
+#include FT_INTERNAL_POSTSCRIPT_NAMES_H
+#include FT_INTERNAL_POSTSCRIPT_HINTS_H
+
+
+FT_BEGIN_HEADER
+
+
+ typedef struct T42_FaceRec_
+ {
+ FT_FaceRec root;
+ T1_FontRec type1;
+ const void* psnames;
+ const void* psaux;
+ const void* afm_data;
+ FT_Byte* ttf_data;
+ FT_ULong ttf_size;
+ FT_Face ttf_face;
+ FT_CharMapRec charmaprecs[2];
+ FT_CharMap charmaps[2];
+ PS_Unicodes unicode_map;
+
+ } T42_FaceRec, *T42_Face;
+
+
+FT_END_HEADER
+
+#endif /* __T1TYPES_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
new file mode 100644
index 00000000..4097ac8f
--- /dev/null
+++ b/include/freetype/internal/tttypes.h
@@ -0,0 +1,1669 @@
+/***************************************************************************/
+/* */
+/* tttypes.h */
+/* */
+/* Basic SFNT/TrueType type definitions and interface (specification */
+/* only). */
+/* */
+/* Copyright 1996-2001, 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* 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 __TTTYPES_H__
+#define __TTTYPES_H__
+
+
+#include <ft2build.h>
+#include FT_TRUETYPE_TABLES_H
+#include FT_INTERNAL_OBJECTS_H
+
+
+FT_BEGIN_HEADER
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*** ***/
+ /*** ***/
+ /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
+ /*** ***/
+ /*** ***/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TTC_HeaderRec */
+ /* */
+ /* <Description> */
+ /* TrueType collection header. This table contains the offsets of */
+ /* the font headers of each distinct TrueType face in the file. */
+ /* */
+ /* <Fields> */
+ /* tag :: Must be `ttc ' to indicate a TrueType collection. */
+ /* */
+ /* version :: The version number. */
+ /* */
+ /* count :: The number of faces in the collection. The */
+ /* specification says this should be an unsigned long, but */
+ /* we use a signed long since we need the value -1 for */
+ /* specific purposes. */
+ /* */
+ /* offsets :: The offsets of the font headers, one per face. */
+ /* */
+ typedef struct TTC_HeaderRec_
+ {
+ FT_ULong tag;
+ FT_Fixed version;
+ FT_Long count;
+ FT_ULong* offsets;
+
+ } TTC_HeaderRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* SFNT_HeaderRec */
+ /* */
+ /* <Description> */
+ /* SFNT file format header. */
+ /* */
+ /* <Fields> */
+ /* format_tag :: The font format tag. */
+ /* */
+ /* num_tables :: The number of tables in file. */
+ /* */
+ /* search_range :: Must be `16 * (max power of 2 <= num_tables)'. */
+ /* */
+ /* entry_selector :: Must be log2 of `search_range / 16'. */
+ /* */
+ /* range_shift :: Must be `num_tables * 16 - search_range'. */
+ /* */
+ typedef struct SFNT_HeaderRec_
+ {
+ FT_ULong format_tag;
+ FT_UShort num_tables;
+ FT_UShort search_range;
+ FT_UShort entry_selector;
+ FT_UShort range_shift;
+
+ FT_ULong offset; /* not in file */
+
+ } SFNT_HeaderRec, *SFNT_Header;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_TableDirRec */
+ /* */
+ /* <Description> */
+ /* This structure models a TrueType table directory. It is used to */
+ /* access the various tables of the font face. */
+ /* */
+ /* <Fields> */
+ /* version :: The version number; starts with 0x00010000. */
+ /* */
+ /* numTables :: The number of tables. */
+ /* */
+ /* searchRange :: Unused. */
+ /* */
+ /* entrySelector :: Unused. */
+ /* */
+ /* rangeShift :: Unused. */
+ /* */
+ /* <Note> */
+ /* This structure is only used during font opening. */
+ /* */
+ typedef struct TT_TableDirRec_
+ {
+ FT_Fixed version; /* should be 0x10000 */
+ FT_UShort numTables; /* number of tables */
+
+ FT_UShort searchRange; /* These parameters are only used */
+ FT_UShort entrySelector; /* for a dichotomy search in the */
+ FT_UShort rangeShift; /* directory. We ignore them. */
+
+ } TT_TableDirRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_TableRec */
+ /* */
+ /* <Description> */
+ /* This structure describes a given table of a TrueType font. */
+ /* */
+ /* <Fields> */
+ /* Tag :: A four-bytes tag describing the table. */
+ /* */
+ /* CheckSum :: The table checksum. This value can be ignored. */
+ /* */
+ /* Offset :: The offset of the table from the start of the TrueType */
+ /* font in its resource. */
+ /* */
+ /* Length :: The table length (in bytes). */
+ /* */
+ typedef struct TT_TableRec_
+ {
+ FT_ULong Tag; /* table type */
+ FT_ULong CheckSum; /* table checksum */
+ FT_ULong Offset; /* table file offset */
+ FT_ULong Length; /* table length */
+
+ } TT_TableRec, *TT_Table;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_CMapDirRec */
+ /* */
+ /* <Description> */
+ /* This structure describes the directory of the `cmap' table, */
+ /* containing the font's character mappings table. */
+ /* */
+ /* <Fields> */
+ /* tableVersionNumber :: The version number. */
+ /* */
+ /* numCMaps :: The number of charmaps in the font. */
+ /* */
+ /* <Note> */
+ /* This structure is only used during font loading. */
+ /* */
+ typedef struct TT_CMapDirRec_
+ {
+ FT_UShort tableVersionNumber;
+ FT_UShort numCMaps;
+
+ } TT_CMapDirRec, *TT_CMapDir;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_CMapDirEntryRec */
+ /* */
+ /* <Description> */
+ /* This structure describes a charmap in a TrueType font. */
+ /* */
+ /* <Fields> */
+ /* platformID :: An ID used to specify for which platform this */
+ /* charmap is defined (FreeType manages all platforms). */
+ /* */
+ /* encodingID :: A platform-specific ID used to indicate which source */
+ /* encoding is used in this charmap. */
+ /* */
+ /* offset :: The offset of the charmap relative to the start of */
+ /* the `cmap' table. */
+ /* */
+ /* <Note> */
+ /* This structure is only used during font loading. */
+ /* */
+ typedef struct TT_CMapDirEntryRec_
+ {
+ FT_UShort platformID;
+ FT_UShort platformEncodingID;
+ FT_Long offset;
+
+ } TT_CMapDirEntryRec, *TT_CMapDirEntry;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_LongMetricsRec */
+ /* */
+ /* <Description> */
+ /* A structure modeling the long metrics of the `hmtx' and `vmtx' */
+ /* TrueType tables. The values are expressed in font units. */
+ /* */
+ /* <Fields> */
+ /* advance :: The advance width or height for the glyph. */
+ /* */
+ /* bearing :: The left-side or top-side bearing for the glyph. */
+ /* */
+ typedef struct TT_LongMetricsRec_
+ {
+ FT_UShort advance;
+ FT_Short bearing;
+
+ } TT_LongMetricsRec, *TT_LongMetrics;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Type> */
+ /* TT_ShortMetrics */
+ /* */
+ /* <Description> */
+ /* A simple type to model the short metrics of the `hmtx' and `vmtx' */
+ /* tables. */
+ /* */
+ typedef FT_Short TT_ShortMetrics;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_NameEntryRec */
+ /* */
+ /* <Description> */
+ /* A structure modeling TrueType name records. Name records are used */
+ /* to store important strings like family name, style name, */
+ /* copyright, etc. in _localized_ versions (i.e., language, encoding, */
+ /* etc). */
+ /* */
+ /* <Fields> */
+ /* platformID :: The ID of the name's encoding platform. */
+ /* */
+ /* encodingID :: The platform-specific ID for the name's encoding. */
+ /* */
+ /* languageID :: The platform-specific ID for the name's language. */
+ /* */
+ /* nameID :: The ID specifying what kind of name this is. */
+ /* */
+ /* stringLength :: The length of the string in bytes. */
+ /* */
+ /* stringOffset :: The offset to the string in the `name' table. */
+ /* */
+ /* string :: A pointer to the string's bytes. Note that these */
+ /* are usually UTF-16 encoded characters. */
+ /* */
+ typedef struct TT_NameEntryRec_
+ {
+ FT_UShort platformID;
+ FT_UShort encodingID;
+ FT_UShort languageID;
+ FT_UShort nameID;
+ FT_UShort stringLength;
+ FT_ULong stringOffset;
+
+ /* this last field is not defined in the spec */
+ /* but used by the FreeType engine */
+
+ FT_Byte* string;
+
+ } TT_NameEntryRec, *TT_NameEntry;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_NameTableRec */
+ /* */
+ /* <Description> */
+ /* A structure modeling the TrueType name table. */
+ /* */
+ /* <Fields> */
+ /* format :: The format of the name table. */
+ /* */
+ /* numNameRecords :: The number of names in table. */
+ /* */
+ /* storageOffset :: The offset of the name table in the `name' */
+ /* TrueType table. */
+ /* */
+ /* names :: An array of name records. */
+ /* */
+ /* stream :: the file's input stream. */
+ /* */
+ typedef struct TT_NameTableRec_
+ {
+ FT_UShort format;
+ FT_UInt numNameRecords;
+ FT_UInt storageOffset;
+ TT_NameEntryRec* names;
+ FT_Stream stream;
+
+ } TT_NameTableRec, *TT_NameTable;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*** ***/
+ /*** ***/
+ /*** OPTIONAL TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/
+ /*** ***/
+ /*** ***/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_GaspRangeRec */
+ /* */
+ /* <Description> */
+ /* A tiny structure used to model a gasp range according to the */
+ /* TrueType specification. */
+ /* */
+ /* <Fields> */
+ /* maxPPEM :: The maximum ppem value to which `gaspFlag' applies. */
+ /* */
+ /* gaspFlag :: A flag describing the grid-fitting and anti-aliasing */
+ /* modes to be used. */
+ /* */
+ typedef struct TT_GaspRangeRec_
+ {
+ FT_UShort maxPPEM;
+ FT_UShort gaspFlag;
+
+ } TT_GaspRangeRec, *TT_GaspRange;
+
+
+#define TT_GASP_GRIDFIT 0x01
+#define TT_GASP_DOGRAY 0x02
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_GaspRec */
+ /* */
+ /* <Description> */
+ /* A structure modeling the TrueType `gasp' table used to specify */
+ /* grid-fitting and anti-aliasing behaviour. */
+ /* */
+ /* <Fields> */
+ /* version :: The version number. */
+ /* */
+ /* numRanges :: The number of gasp ranges in table. */
+ /* */
+ /* gaspRanges :: An array of gasp ranges. */
+ /* */
+ typedef struct TT_Gasp_
+ {
+ FT_UShort version;
+ FT_UShort numRanges;
+ TT_GaspRange gaspRanges;
+
+ } TT_GaspRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_HdmxEntryRec */
+ /* */
+ /* <Description> */
+ /* A small structure used to model the pre-computed widths of a given */
+ /* size. They are found in the `hdmx' table. */
+ /* */
+ /* <Fields> */
+ /* ppem :: The pixels per EM value at which these metrics apply. */
+ /* */
+ /* max_width :: The maximum advance width for this metric. */
+ /* */
+ /* widths :: An array of widths. Note: These are 8-bit bytes. */
+ /* */
+ typedef struct TT_HdmxEntryRec_
+ {
+ FT_Byte ppem;
+ FT_Byte max_width;
+ FT_Byte* widths;
+
+ } TT_HdmxEntryRec, *TT_HdmxEntry;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_HdmxRec */
+ /* */
+ /* <Description> */
+ /* A structure used to model the `hdmx' table, which contains */
+ /* pre-computed widths for a set of given sizes/dimensions. */
+ /* */
+ /* <Fields> */
+ /* version :: The version number. */
+ /* */
+ /* num_records :: The number of hdmx records. */
+ /* */
+ /* records :: An array of hdmx records. */
+ /* */
+ typedef struct TT_HdmxRec_
+ {
+ FT_UShort version;
+ FT_Short num_records;
+ TT_HdmxEntry records;
+
+ } TT_HdmxRec, *TT_Hdmx;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_Kern0_PairRec */
+ /* */
+ /* <Description> */
+ /* A structure used to model a kerning pair for the kerning table */
+ /* format 0. The engine now loads this table if it finds one in the */
+ /* font file. */
+ /* */
+ /* <Fields> */
+ /* left :: The index of the left glyph in pair. */
+ /* */
+ /* right :: The index of the right glyph in pair. */
+ /* */
+ /* value :: The kerning distance. A positive value spaces the */
+ /* glyphs, a negative one makes them closer. */
+ /* */
+ typedef struct TT_Kern0_PairRec_
+ {
+ FT_UShort left; /* index of left glyph in pair */
+ FT_UShort right; /* index of right glyph in pair */
+ FT_FWord value; /* kerning value */
+
+ } TT_Kern0_PairRec, *TT_Kern0_Pair;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*** ***/
+ /*** ***/
+ /*** EMBEDDED BITMAPS SUPPORT ***/
+ /*** ***/
+ /*** ***/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_SBit_MetricsRec */
+ /* */
+ /* <Description> */
+ /* A structure used to hold the big metrics of a given glyph bitmap */
+ /* in a TrueType or OpenType font. These are usually found in the */
+ /* `EBDT' (Microsoft) or `bloc' (Apple) table. */
+ /* */
+ /* <Fields> */
+ /* height :: The glyph height in pixels. */
+ /* */
+ /* width :: The glyph width in pixels. */
+ /* */
+ /* horiBearingX :: The horizontal left bearing. */
+ /* */
+ /* horiBearingY :: The horizontal top bearing. */
+ /* */
+ /* horiAdvance :: The horizontal advance. */
+ /* */
+ /* vertBearingX :: The vertical left bearing. */
+ /* */
+ /* vertBearingY :: The vertical top bearing. */
+ /* */
+ /* vertAdvance :: The vertical advance. */
+ /* */
+ typedef struct TT_SBit_MetricsRec_
+ {
+ FT_Byte height;
+ FT_Byte width;
+
+ FT_Char horiBearingX;
+ FT_Char horiBearingY;
+ FT_Byte horiAdvance;
+
+ FT_Char vertBearingX;
+ FT_Char vertBearingY;
+ FT_Byte vertAdvance;
+
+ } TT_SBit_MetricsRec, *TT_SBit_Metrics;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_SBit_SmallMetricsRec */
+ /* */
+ /* <Description> */
+ /* A structure used to hold the small metrics of a given glyph bitmap */
+ /* in a TrueType or OpenType font. These are usually found in the */
+ /* `EBDT' (Microsoft) or the `bdat' (Apple) table. */
+ /* */
+ /* <Fields> */
+ /* height :: The glyph height in pixels. */
+ /* */
+ /* width :: The glyph width in pixels. */
+ /* */
+ /* bearingX :: The left-side bearing. */
+ /* */
+ /* bearingY :: The top-side bearing. */
+ /* */
+ /* advance :: The advance width or height. */
+ /* */
+ typedef struct TT_SBit_Small_Metrics_
+ {
+ FT_Byte height;
+ FT_Byte width;
+
+ FT_Char bearingX;
+ FT_Char bearingY;
+ FT_Byte advance;
+
+ } TT_SBit_SmallMetricsRec, *TT_SBit_SmallMetrics;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_SBit_LineMetricsRec */
+ /* */
+ /* <Description> */
+ /* A structure used to describe the text line metrics of a given */
+ /* bitmap strike, for either a horizontal or vertical layout. */
+ /* */
+ /* <Fields> */
+ /* ascender :: The ascender in pixels. */
+ /* */
+ /* descender :: The descender in pixels. */
+ /* */
+ /* max_width :: The maximum glyph width in pixels. */
+ /* */
+ /* caret_slope_enumerator :: Rise of the caret slope, typically set */
+ /* to 1 for non-italic fonts. */
+ /* */
+ /* caret_slope_denominator :: Rise of the caret slope, typically set */
+ /* to 0 for non-italic fonts. */
+ /* */
+ /* caret_offset :: Offset in pixels to move the caret for */
+ /* proper positioning. */
+ /* */
+ /* min_origin_SB :: Minimum of horiBearingX (resp. */
+ /* vertBearingY). */
+ /* min_advance_SB :: Minimum of */
+ /* */
+ /* horizontal advance - */
+ /* ( horiBearingX + width ) */
+ /* */
+ /* resp. */
+ /* */
+ /* vertical advance - */
+ /* ( vertBearingY + height ) */
+ /* */
+ /* max_before_BL :: Maximum of horiBearingY (resp. */
+ /* vertBearingY). */
+ /* */
+ /* min_after_BL :: Minimum of */
+ /* */
+ /* horiBearingY - height */
+ /* */
+ /* resp. */
+ /* */
+ /* vertBearingX - width */
+ /* */
+ /* pads :: Unused (to make the size of the record */
+ /* a multiple of 32 bits. */
+ /* */
+ typedef struct TT_SBit_LineMetricsRec_
+ {
+ FT_Char ascender;
+ FT_Char descender;
+ FT_Byte max_width;
+ FT_Char caret_slope_numerator;
+ FT_Char caret_slope_denominator;
+ FT_Char caret_offset;
+ FT_Char min_origin_SB;
+ FT_Char min_advance_SB;
+ FT_Char max_before_BL;
+ FT_Char min_after_BL;
+ FT_Char pads[2];
+
+ } TT_SBit_LineMetricsRec, *TT_SBit_LineMetrics;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_SBit_RangeRec */
+ /* */
+ /* <Description> */
+ /* A TrueType/OpenType subIndexTable as defined in the `EBLC' */
+ /* (Microsoft) or `bloc' (Apple) tables. */
+ /* */
+ /* <Fields> */
+ /* first_glyph :: The first glyph index in the range. */
+ /* */
+ /* last_glyph :: The last glyph index in the range. */
+ /* */
+ /* index_format :: The format of index table. Valid values are 1 */
+ /* to 5. */
+ /* */
+ /* image_format :: The format of `EBDT' image data. */
+ /* */
+ /* image_offset :: The offset to image data in `EBDT'. */
+ /* */
+ /* image_size :: For index formats 2 and 5. This is the size in */
+ /* bytes of each glyph bitmap. */
+ /* */
+ /* big_metrics :: For index formats 2 and 5. This is the big */
+ /* metrics for each glyph bitmap. */
+ /* */
+ /* num_glyphs :: For index formats 4 and 5. This is the number of */
+ /* glyphs in the code array. */
+ /* */
+ /* glyph_offsets :: For index formats 1 and 3. */
+ /* */
+ /* glyph_codes :: For index formats 4 and 5. */
+ /* */
+ /* table_offset :: The offset of the index table in the `EBLC' */
+ /* table. Only used during strike loading. */
+ /* */
+ typedef struct TT_SBit_RangeRec
+ {
+ FT_UShort first_glyph;
+ FT_UShort last_glyph;
+
+ FT_UShort index_format;
+ FT_UShort image_format;
+ FT_ULong image_offset;
+
+ FT_ULong image_size;
+ TT_SBit_MetricsRec metrics;
+ FT_ULong num_glyphs;
+
+ FT_ULong* glyph_offsets;
+ FT_UShort* glyph_codes;
+
+ FT_ULong table_offset;
+
+ } TT_SBit_RangeRec, *TT_SBit_Range;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_SBit_StrikeRec */
+ /* */
+ /* <Description> */
+ /* A structure used describe a given bitmap strike in the `EBLC' */
+ /* (Microsoft) or `bloc' (Apple) tables. */
+ /* */
+ /* <Fields> */
+ /* num_index_ranges :: The number of index ranges. */
+ /* */
+ /* index_ranges :: An array of glyph index ranges. */
+ /* */
+ /* color_ref :: Unused. `color_ref' is put in for future */
+ /* enhancements, but these fields are already */
+ /* in use by other platforms (e.g. Newton). */
+ /* For details, please see */
+ /* */
+ /* http://fonts.apple.com/ */
+ /* TTRefMan/RM06/Chap6bloc.html */
+ /* */
+ /* hori :: The line metrics for horizontal layouts. */
+ /* */
+ /* vert :: The line metrics for vertical layouts. */
+ /* */
+ /* start_glyph :: The lowest glyph index for this strike. */
+ /* */
+ /* end_glyph :: The highest glyph index for this strike. */
+ /* */
+ /* x_ppem :: The number of horizontal pixels per EM. */
+ /* */
+ /* y_ppem :: The number of vertical pixels per EM. */
+ /* */
+ /* bit_depth :: The bit depth. Valid values are 1, 2, 4, */
+ /* and 8. */
+ /* */
+ /* flags :: Is this a vertical or horizontal strike? For */
+ /* details, please see */
+ /* */
+ /* http://fonts.apple.com/ */
+ /* TTRefMan/RM06/Chap6bloc.html */
+ /* */
+ typedef struct TT_SBit_StrikeRec_
+ {
+ FT_Int num_ranges;
+ TT_SBit_Range sbit_ranges;
+ FT_ULong ranges_offset;
+
+ FT_ULong color_ref;
+
+ TT_SBit_LineMetricsRec hori;
+ TT_SBit_LineMetricsRec vert;
+
+ FT_UShort start_glyph;
+ FT_UShort end_glyph;
+
+ FT_Byte x_ppem;
+ FT_Byte y_ppem;
+
+ FT_Byte bit_depth;
+ FT_Char flags;
+
+ } TT_SBit_StrikeRec, *TT_SBit_Strike;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_SBit_ComponentRec */
+ /* */
+ /* <Description> */
+ /* A simple structure to describe a compound sbit element. */
+ /* */
+ /* <Fields> */
+ /* glyph_code :: The element's glyph index. */
+ /* */
+ /* x_offset :: The element's left bearing. */
+ /* */
+ /* y_offset :: The element's top bearing. */
+ /* */
+ typedef struct TT_SBit_ComponentRec_
+ {
+ FT_UShort glyph_code;
+ FT_Char x_offset;
+ FT_Char y_offset;
+
+ } TT_SBit_ComponentRec, *TT_SBit_Component;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_SBit_ScaleRec */
+ /* */
+ /* <Description> */
+ /* A structure used describe a given bitmap scaling table, as defined */
+ /* in the `EBSC' table. */
+ /* */
+ /* <Fields> */
+ /* hori :: The horizontal line metrics. */
+ /* */
+ /* vert :: The vertical line metrics. */
+ /* */
+ /* x_ppem :: The number of horizontal pixels per EM. */
+ /* */
+ /* y_ppem :: The number of vertical pixels per EM. */
+ /* */
+ /* x_ppem_substitute :: Substitution x_ppem value. */
+ /* */
+ /* y_ppem_substitute :: Substitution y_ppem value. */
+ /* */
+ typedef struct TT_SBit_ScaleRec_
+ {
+ TT_SBit_LineMetricsRec hori;
+ TT_SBit_LineMetricsRec vert;
+
+ FT_Byte x_ppem;
+ FT_Byte y_ppem;
+
+ FT_Byte x_ppem_substitute;
+ FT_Byte y_ppem_substitute;
+
+ } TT_SBit_ScaleRec, *TT_SBit_Scale;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*** ***/
+ /*** ***/
+ /*** POSTSCRIPT GLYPH NAMES SUPPORT ***/
+ /*** ***/
+ /*** ***/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_Post_20Rec */
+ /* */
+ /* <Description> */
+ /* Postscript names sub-table, format 2.0. Stores the PS name of */
+ /* each glyph in the font face. */
+ /* */
+ /* <Fields> */
+ /* num_glyphs :: The number of named glyphs in the table. */
+ /* */
+ /* num_names :: The number of PS names stored in the table. */
+ /* */
+ /* glyph_indices :: The indices of the glyphs in the names arrays. */
+ /* */
+ /* glyph_names :: The PS names not in Mac Encoding. */
+ /* */
+ typedef struct TT_Post_20Rec_
+ {
+ FT_UShort num_glyphs;
+ FT_UShort num_names;
+ FT_UShort* glyph_indices;
+ FT_Char** glyph_names;
+
+ } TT_Post_20Rec, *TT_Post_20;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_Post_25Rec */
+ /* */
+ /* <Description> */
+ /* Postscript names sub-table, format 2.5. Stores the PS name of */
+ /* each glyph in the font face. */
+ /* */
+ /* <Fields> */
+ /* num_glyphs :: The number of glyphs in the table. */
+ /* */
+ /* offsets :: An array of signed offsets in a normal Mac */
+ /* Postscript name encoding. */
+ /* */
+ typedef struct TT_Post_25_
+ {
+ FT_UShort num_glyphs;
+ FT_Char* offsets;
+
+ } TT_Post_25Rec, *TT_Post_25;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_Post_NamesRec */
+ /* */
+ /* <Description> */
+ /* Postscript names table, either format 2.0 or 2.5. */
+ /* */
+ /* <Fields> */
+ /* loaded :: A flag to indicate whether the PS names are loaded. */
+ /* */
+ /* format_20 :: The sub-table used for format 2.0. */
+ /* */
+ /* format_25 :: The sub-table used for format 2.5. */
+ /* */
+ typedef struct TT_Post_NamesRec_
+ {
+ FT_Bool loaded;
+
+ union
+ {
+ TT_Post_20Rec format_20;
+ TT_Post_25Rec format_25;
+
+ } names;
+
+ } TT_Post_NamesRec, *TT_Post_Names;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*** ***/
+ /*** ***/
+ /*** TRUETYPE CHARMAPS SUPPORT ***/
+ /*** ***/
+ /*** ***/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /* format 0 */
+
+ typedef struct TT_CMap0_
+ {
+ FT_ULong language; /* for Mac fonts (originally ushort) */
+
+ FT_Byte* glyphIdArray;
+
+ } TT_CMap0Rec, *TT_CMap0;
+
+
+ /* format 2 */
+
+ typedef struct TT_CMap2SubHeaderRec_
+ {
+ FT_UShort firstCode; /* first valid low byte */
+ FT_UShort entryCount; /* number of valid low bytes */
+ FT_Short idDelta; /* delta value to glyphIndex */
+ FT_UShort idRangeOffset; /* offset from here to 1st code */
+
+ } TT_CMap2SubHeaderRec, *TT_CMap2SubHeader;
+
+
+ typedef struct TT_CMap2Rec_
+ {
+ FT_ULong language; /* for Mac fonts (originally ushort) */
+
+ FT_UShort* subHeaderKeys; /* high byte mapping table */
+ /* value = subHeader index * 8 */
+ TT_CMap2SubHeader subHeaders;
+ FT_UShort* glyphIdArray;
+ FT_UShort numGlyphId; /* control value */
+
+ } TT_CMap2Rec, *TT_CMap2;
+
+
+ /* format 4 */
+
+ typedef struct TT_CMap4Segment_
+ {
+ FT_UShort endCount;
+ FT_UShort startCount;
+ FT_Short idDelta;
+ FT_UShort idRangeOffset;
+
+ } TT_CMap4SegmentRec, *TT_CMap4Segment;
+
+
+ typedef struct TT_CMap4Rec_
+ {
+ FT_ULong language; /* for Mac fonts (originally ushort) */
+
+ FT_UShort segCountX2; /* number of segments * 2 */
+ FT_UShort searchRange; /* these parameters can be used */
+ FT_UShort entrySelector; /* for a binary search */
+ FT_UShort rangeShift;
+
+ TT_CMap4Segment segments;
+ FT_UShort* glyphIdArray;
+ FT_UShort numGlyphId; /* control value */
+
+ TT_CMap4Segment last_segment; /* last used segment; this is a small */
+ /* cache to potentially increase speed */
+ } TT_CMap4Rec, *TT_CMap4;
+
+
+ /* format 6 */
+
+ typedef struct TT_CMap6_
+ {
+ FT_ULong language; /* for Mac fonts (originally ushort) */
+
+ FT_UShort firstCode; /* first character code of subrange */
+ FT_UShort entryCount; /* number of character codes in subrange */
+
+ FT_UShort* glyphIdArray;
+
+ } TT_CMap6Rec, *TT_CMap6;
+
+
+ /* auxiliary table for format 8 and 12 */
+
+ typedef struct TT_CMapGroupRec_
+ {
+ FT_ULong startCharCode;
+ FT_ULong endCharCode;
+ FT_ULong startGlyphID;
+
+ } TT_CMapGroupRec, *TT_CMapGroup;
+
+
+ /* FreeType handles format 8 and 12 identically. It is not necessary to
+ cover mixed 16bit and 32bit codes since FreeType always uses FT_ULong
+ for input character codes -- converting Unicode surrogates to 32bit
+ character codes must be done by the application. */
+
+ typedef struct TT_CMap8_12Rec_
+ {
+ FT_ULong language; /* for Mac fonts */
+
+ FT_ULong nGroups;
+ TT_CMapGroup groups;
+
+ TT_CMapGroup last_group; /* last used group; this is a small */
+ /* cache to potentially increase speed */
+ } TT_CMap8_12Rec, *TT_CMap8_12;
+
+
+ /* format 10 */
+
+ typedef struct TT_CMap10Rec_
+ {
+ FT_ULong language; /* for Mac fonts */
+
+ FT_ULong startCharCode; /* first character covered */
+ FT_ULong numChars; /* number of characters covered */
+
+ FT_UShort* glyphs;
+
+ } TT_CMap10Rec, *TT_CMap10;
+
+
+ typedef struct TT_CMapTableRec_* TT_CMapTable;
+
+
+ typedef FT_UInt
+ (*TT_CharMap_Func)( TT_CMapTable charmap,
+ FT_ULong char_code );
+
+ typedef FT_ULong
+ (*TT_CharNext_Func)( TT_CMapTable charmap,
+ FT_ULong char_code );
+
+
+ /* charmap table */
+ typedef struct TT_CMapTableRec_
+ {
+ FT_UShort platformID;
+ FT_UShort platformEncodingID;
+ FT_UShort format;
+ FT_ULong length; /* must be ulong for formats 8, 10, and 12 */
+
+ FT_Bool loaded;
+ FT_ULong offset;
+
+ union
+ {
+ TT_CMap0Rec cmap0;
+ TT_CMap2Rec cmap2;
+ TT_CMap4Rec cmap4;
+ TT_CMap6Rec cmap6;
+ TT_CMap8_12Rec cmap8_12;
+ TT_CMap10Rec cmap10;
+ } c;
+
+ TT_CharMap_Func get_index;
+ TT_CharNext_Func get_next_char;
+
+ } TT_CMapTableRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_CharMapRec */
+ /* */
+ /* <Description> */
+ /* The TrueType character map object type. */
+ /* */
+ /* <Fields> */
+ /* root :: The parent character map structure. */
+ /* */
+ /* cmap :: The used character map. */
+ /* */
+ typedef struct TT_CharMapRec_
+ {
+ FT_CharMapRec root;
+ TT_CMapTableRec cmap;
+
+ } TT_CharMapRec;
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*** ***/
+ /*** ***/
+ /*** ORIGINAL TT_FACE CLASS DEFINITION ***/
+ /*** ***/
+ /*** ***/
+ /*************************************************************************/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* This structure/class is defined here because it is common to the */
+ /* following formats: TTF, OpenType-TT, and OpenType-CFF. */
+ /* */
+ /* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
+ /* are not shared between font drivers, and are thus defined in */
+ /* `ttobjs.h'. */
+ /* */
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* <Type> */
+ /* TT_Face */
+ /* */
+ /* <Description> */
+ /* A handle to a TrueType face/font object. A TT_Face encapsulates */
+ /* the resolution and scaling independent parts of a TrueType font */
+ /* resource. */
+ /* */
+ /* <Note> */
+ /* The TT_Face structure is also used as a `parent class' for the */
+ /* OpenType-CFF class (T2_Face). */
+ /* */
+ typedef struct TT_FaceRec_* TT_Face;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Type> */
+ /* TT_CharMap */
+ /* */
+ /* <Description> */
+ /* A handle to a TrueType character mapping object. */
+ /* */
+ typedef struct TT_CharMapRec_* TT_CharMap;
+
+
+ /* a function type used for the truetype bytecode interpreter hooks */
+ typedef FT_Error
+ (*TT_Interpreter)( void* exec_context );
+
+ /* forward declaration */
+ typedef struct TT_LoaderRec_* TT_Loader;
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Loader_GotoTableFunc */
+ /* */
+ /* <Description> */
+ /* Seeks a stream to the start of a given TrueType table. */
+ /* */
+ /* <Input> */
+ /* face :: A handle to the target face object. */
+ /* */
+ /* tag :: A 4-byte tag used to name the table. */
+ /* */
+ /* stream :: The input stream. */
+ /* */
+ /* <Output> */
+ /* length :: The length of the table in bytes. Set to 0 if not */
+ /* needed. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* The stream cursor must be at the font file's origin. */
+ /* */
+ typedef FT_Error
+ (*TT_Loader_GotoTableFunc)( TT_Face face,
+ FT_ULong tag,
+ FT_Stream stream,
+ FT_ULong* length );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Loader_StartGlyphFunc */
+ /* */
+ /* <Description> */
+ /* Seeks a stream to the start of a given glyph element, and opens a */
+ /* frame for it. */
+ /* */
+ /* <Input> */
+ /* loader :: The current TrueType glyph loader object. */
+ /* */
+ /* glyph index :: The index of the glyph to access. */
+ /* */
+ /* offset :: The offset of the glyph according to the */
+ /* `locations' table. */
+ /* */
+ /* byte_count :: The size of the frame in bytes. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ /* <Note> */
+ /* This function is normally equivalent to FT_STREAM_SEEK(offset) */
+ /* followed by FT_FRAME_ENTER(byte_count) with the loader's stream, */
+ /* but alternative formats (e.g. compressed ones) might use something */
+ /* different. */
+ /* */
+ typedef FT_Error
+ (*TT_Loader_StartGlyphFunc)( TT_Loader loader,
+ FT_UInt glyph_index,
+ FT_ULong offset,
+ FT_UInt byte_count );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Loader_ReadGlyphFunc */
+ /* */
+ /* <Description> */
+ /* Reads one glyph element (its header, a simple glyph, or a */
+ /* composite) from the loader's current stream frame. */
+ /* */
+ /* <Input> */
+ /* loader :: The current TrueType glyph loader object. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ typedef FT_Error
+ (*TT_Loader_ReadGlyphFunc)( TT_Loader loader );
+
+
+ /*************************************************************************/
+ /* */
+ /* <FuncType> */
+ /* TT_Loader_EndGlyphFunc */
+ /* */
+ /* <Description> */
+ /* Closes the current loader stream frame for the glyph. */
+ /* */
+ /* <Input> */
+ /* loader :: The current TrueType glyph loader object. */
+ /* */
+ typedef void
+ (*TT_Loader_EndGlyphFunc)( TT_Loader loader );
+
+
+ /*************************************************************************/
+ /* */
+ /* TrueType Face Type */
+ /* */
+ /* <Struct> */
+ /* TT_Face */
+ /* */
+ /* <Description> */
+ /* The TrueType face class. These objects model the resolution and */
+ /* point-size independent data found in a TrueType font file. */
+ /* */
+ /* <Fields> */
+ /* root :: The base FT_Face structure, managed by the */
+ /* base layer. */
+ /* */
+ /* ttc_header :: The TrueType collection header, used when */
+ /* the file is a `ttc' rather than a `ttf'. */
+ /* For ordinary font files, the field */
+ /* `ttc_header.count' is set to 0. */
+ /* */
+ /* format_tag :: The font format tag. */
+ /* */
+ /* num_tables :: The number of TrueType tables in this font */
+ /* file. */
+ /* */
+ /* dir_tables :: The directory of TrueType tables for this */
+ /* font file. */
+ /* */
+ /* header :: The font's font header (`head' table). */
+ /* Read on font opening. */
+ /* */
+ /* horizontal :: The font's horizontal header (`hhea' */
+ /* table). This field also contains the */
+ /* associated horizontal metrics table */
+ /* (`hmtx'). */
+ /* */
+ /* max_profile :: The font's maximum profile table. Read on */
+ /* font opening. Note that some maximum */
+ /* values cannot be taken directly from this */
+ /* table. We thus define additional fields */
+ /* below to hold the computed maxima. */
+ /* */
+ /* max_components :: The maximum number of glyph components */
+ /* required to load any composite glyph from */
+ /* this font. Used to size the load stack. */
+ /* */
+ /* vertical_info :: A boolean which is set when the font file */
+ /* contains vertical metrics. If not, the */
+ /* value of the `vertical' field is */
+ /* undefined. */
+ /* */
+ /* vertical :: The font's vertical header (`vhea' table). */
+ /* This field also contains the associated */
+ /* vertical metrics table (`vmtx'), if found. */
+ /* IMPORTANT: The contents of this field is */
+ /* undefined if the `verticalInfo' field is */
+ /* unset. */
+ /* */
+ /* num_names :: The number of name records within this */
+ /* TrueType font. */
+ /* */
+ /* name_table :: The table of name records (`name'). */
+ /* */
+ /* os2 :: The font's OS/2 table (`OS/2'). */
+ /* */
+ /* postscript :: The font's PostScript table (`post' */
+ /* table). The PostScript glyph names are */
+ /* not loaded by the driver on face opening. */
+ /* See the `ttpost' module for more details. */
+ /* */
+ /* cmap_table :: Address of the face's `cmap' SFNT table */
+ /* in memory (it's an extracted frame). */
+ /* */
+ /* cmap_size :: The size in bytes of the `cmap_table' */
+ /* described above. */
+ /* */
+ /* num_charmaps :: The number of character mappings in the */
+ /* font. */
+ /* */
+ /* charmaps :: The array of charmap objects for this font */
+ /* file. Note that this field is a typeless */
+ /* pointer. The Reason is that the format of */
+ /* charmaps varies with the underlying font */
+ /* format and cannot be determined here. */
+ /* */
+ /* goto_table :: A function called by each TrueType table */
+ /* loader to position a stream's cursor to */
+ /* the start of a given table according to */
+ /* its tag. It defaults to TT_Goto_Face but */
+ /* can be different for strange formats (e.g. */
+ /* Type 42). */
+ /* */
+ /* access_glyph_frame :: A function used to access the frame of a */
+ /* given glyph within the face's font file. */
+ /* */
+ /* forget_glyph_frame :: A function used to forget the frame of a */
+ /* given glyph when all data has been loaded. */
+ /* */
+ /* read_glyph_header :: A function used to read a glyph header. */
+ /* It must be called between an `access' and */
+ /* `forget'. */
+ /* */
+ /* read_simple_glyph :: A function used to read a simple glyph. */
+ /* It must be called after the header was */
+ /* read, and before the `forget'. */
+ /* */
+ /* read_composite_glyph :: A function used to read a composite glyph. */
+ /* It must be called after the header was */
+ /* read, and before the `forget'. */
+ /* */
+ /* sfnt :: A pointer to the SFNT `driver' interface. */
+ /* */
+ /* psnames :: A pointer to the `PSNames' module */
+ /* interface. */
+ /* */
+ /* hdmx :: The face's horizontal device metrics */
+ /* (`hdmx' table). This table is optional in */
+ /* TrueType/OpenType fonts. */
+ /* */
+ /* gasp :: The grid-fitting and scaling properties */
+ /* table (`gasp'). This table is optional in */
+ /* TrueType/OpenType fonts. */
+ /* */
+ /* pclt :: The `pclt' SFNT table. */
+ /* */
+ /* num_sbit_strikes :: The number of sbit strikes, i.e., bitmap */
+ /* sizes, embedded in this font. */
+ /* */
+ /* sbit_strikes :: An array of sbit strikes embedded in this */
+ /* font. This table is optional in a */
+ /* TrueType/OpenType font. */
+ /* */
+ /* num_sbit_scales :: The number of sbit scales for this font. */
+ /* */
+ /* sbit_scales :: Array of sbit scales embedded in this */
+ /* font. This table is optional in a */
+ /* TrueType/OpenType font. */
+ /* */
+ /* postscript_names :: A table used to store the Postscript names */
+ /* of the glyphs for this font. See the */
+ /* file `ttconfig.h' for comments on the */
+ /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES option. */
+ /* */
+ /* num_locations :: The number of glyph locations in this */
+ /* TrueType file. This should be */
+ /* identical to the number of glyphs. */
+ /* Ignored for Type 2 fonts. */
+ /* */
+ /* glyph_locations :: An array of longs. These are offsets to */
+ /* glyph data within the `glyf' table. */
+ /* Ignored for Type 2 font faces. */
+ /* */
+ /* font_program_size :: Size in bytecodes of the face's font */
+ /* program. 0 if none defined. Ignored for */
+ /* Type 2 fonts. */
+ /* */
+ /* font_program :: The face's font program (bytecode stream) */
+ /* executed at load time, also used during */
+ /* glyph rendering. Comes from the `fpgm' */
+ /* table. Ignored for Type 2 font fonts. */
+ /* */
+ /* cvt_program_size :: The size in bytecodes of the face's cvt */
+ /* program. Ignored for Type 2 fonts. */
+ /* */
+ /* cvt_program :: The face's cvt program (bytecode stream) */
+ /* executed each time an instance/size is */
+ /* changed/reset. Comes from the `prep' */
+ /* table. Ignored for Type 2 fonts. */
+ /* */
+ /* cvt_size :: Size of the control value table (in */
+ /* entries). Ignored for Type 2 fonts. */
+ /* */
+ /* cvt :: The face's original control value table. */
+ /* Coordinates are expressed in unscaled font */
+ /* units. Comes from the `cvt ' table. */
+ /* Ignored for Type 2 fonts. */
+ /* */
+ /* num_kern_pairs :: The number of kerning pairs present in the */
+ /* font file. The engine only loads the */
+ /* first horizontal format 0 kern table it */
+ /* finds in the font file. Ignored for */
+ /* Type 2 fonts. */
+ /* */
+ /* kern_table_index :: The index of the kerning table in the font */
+ /* kerning directory. Ignored for Type 2 */
+ /* fonts. */
+ /* */
+ /* interpreter :: A pointer to the TrueType bytecode */
+ /* interpreters field is also used to hook */
+ /* the debugger in `ttdebug'. */
+ /* */
+ /* extra :: Reserved for third-party font drivers. */
+ /* */
+ typedef struct TT_FaceRec_
+ {
+ FT_FaceRec root;
+
+ TTC_HeaderRec ttc_header;
+
+ FT_ULong format_tag;
+ FT_UShort num_tables;
+ TT_Table dir_tables;
+
+ TT_Header header; /* TrueType header table */
+ TT_HoriHeader horizontal; /* TrueType horizontal header */
+
+ TT_MaxProfile max_profile;
+ FT_ULong max_components;
+
+ FT_Bool vertical_info;
+ TT_VertHeader vertical; /* TT Vertical header, if present */
+
+ FT_UShort num_names; /* number of name records */
+ TT_NameTableRec name_table; /* name table */
+
+ TT_OS2 os2; /* TrueType OS/2 table */
+ TT_Postscript postscript; /* TrueType Postscript table */
+
+ FT_Byte* cmap_table; /* extracted 'cmap' table */
+ FT_ULong cmap_size;
+
+ TT_Loader_GotoTableFunc goto_table;
+
+ TT_Loader_StartGlyphFunc access_glyph_frame;
+ TT_Loader_EndGlyphFunc forget_glyph_frame;
+ TT_Loader_ReadGlyphFunc read_glyph_header;
+ TT_Loader_ReadGlyphFunc read_simple_glyph;
+ TT_Loader_ReadGlyphFunc read_composite_glyph;
+
+ /* a typeless pointer to the SFNT_Interface table used to load */
+ /* the basic TrueType tables in the face object */
+ void* sfnt;
+
+ /* a typeless pointer to the PSNames_Interface table used to */
+ /* handle glyph names <-> unicode & Mac values */
+ void* psnames;
+
+ /***********************************************************************/
+ /* */
+ /* Optional TrueType/OpenType tables */
+ /* */
+ /***********************************************************************/
+
+ /* horizontal device metrics */
+ TT_HdmxRec hdmx;
+
+ /* grid-fitting and scaling table */
+ TT_GaspRec gasp; /* the `gasp' table */
+
+ /* PCL 5 table */
+ TT_PCLT pclt;
+
+ /* embedded bitmaps support */
+ FT_ULong num_sbit_strikes;
+ TT_SBit_Strike sbit_strikes;
+
+ FT_ULong num_sbit_scales;
+ TT_SBit_Scale sbit_scales;
+
+ /* postscript names table */
+ TT_Post_NamesRec postscript_names;
+
+
+ /***********************************************************************/
+ /* */
+ /* TrueType-specific fields (ignored by the OTF-Type2 driver) */
+ /* */
+ /***********************************************************************/
+
+ /* the glyph locations */
+ FT_UShort num_locations;
+ FT_Long* glyph_locations;
+
+ /* the font program, if any */
+ FT_ULong font_program_size;
+ FT_Byte* font_program;
+
+ /* the cvt program, if any */
+ FT_ULong cvt_program_size;
+ FT_Byte* cvt_program;
+
+ /* the original, unscaled, control value table */
+ FT_ULong cvt_size;
+ FT_Short* cvt;
+
+ /* the format 0 kerning table, if any */
+ FT_Int num_kern_pairs;
+ FT_Int kern_table_index;
+ TT_Kern0_Pair kern_pairs;
+
+ /* A pointer to the bytecode interpreter to use. This is also */
+ /* used to hook the debugger for the `ttdebug' utility. */
+ TT_Interpreter interpreter;
+
+
+ /***********************************************************************/
+ /* */
+ /* Other tables or fields. This is used by derivative formats like */
+ /* OpenType. */
+ /* */
+ /***********************************************************************/
+
+ FT_Generic extra;
+
+ } TT_FaceRec;
+
+
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* TT_GlyphZoneRec */
+ /* */
+ /* <Description> */
+ /* A glyph zone is used to load, scale and hint glyph outline */
+ /* coordinates. */
+ /* */
+ /* <Fields> */
+ /* memory :: A handle to the memory manager. */
+ /* */
+ /* max_points :: The maximal size in points of the zone. */
+ /* */
+ /* max_contours :: Max size in links contours of thez one. */
+ /* */
+ /* n_points :: The current number of points in the zone. */
+ /* */
+ /* n_contours :: The current number of contours in the zone. */
+ /* */
+ /* org :: The original glyph coordinates (font */
+ /* units/scaled). */
+ /* */
+ /* cur :: The current glyph coordinates (scaled/hinted). */
+ /* */
+ /* tags :: The point control tags. */
+ /* */
+ /* contours :: The contours end points. */
+ /* */
+ typedef struct TT_GlyphZoneRec_
+ {
+ FT_Memory memory;
+ FT_UShort max_points;
+ FT_UShort max_contours;
+ FT_UShort n_points; /* number of points in zone */
+ FT_Short n_contours; /* number of contours */
+
+ FT_Vector* org; /* original point coordinates */
+ FT_Vector* cur; /* current point coordinates */
+
+ FT_Byte* tags; /* current touch flags */
+ FT_UShort* contours; /* contour end points */
+
+ } TT_GlyphZoneRec, *TT_GlyphZone;
+
+
+ /* handle to execution context */
+ typedef struct TT_ExecContextRec_* TT_ExecContext;
+
+ /* glyph loader structure */
+ typedef struct TT_LoaderRec_
+ {
+ FT_Face face;
+ FT_Size size;
+ FT_GlyphSlot glyph;
+ FT_GlyphLoader gloader;
+
+ FT_ULong load_flags;
+ FT_UInt glyph_index;
+
+ FT_Stream stream;
+ FT_Int byte_len;
+
+ FT_Short n_contours;
+ FT_BBox bbox;
+ FT_Int left_bearing;
+ FT_Int advance;
+ FT_Int linear;
+ FT_Bool linear_def;
+ FT_Bool preserve_pps;
+ FT_Vector pp1;
+ FT_Vector pp2;
+
+ FT_ULong glyf_offset;
+
+ /* the zone where we load our glyphs */
+ TT_GlyphZoneRec base;
+ TT_GlyphZoneRec zone;
+
+ TT_ExecContext exec;
+ FT_Byte* instructions;
+ FT_ULong ins_pos;
+
+ /* for possible extensibility in other formats */
+ void* other;
+
+ } TT_LoaderRec;
+
+
+FT_END_HEADER
+
+#endif /* __TTTYPES_H__ */
+
+
+/* END */