00001 /***************************************************************************/ 00002 /* */ 00003 /* pshrec.h */ 00004 /* */ 00005 /* Postscript (Type1/Type2) hints recorder (specification). */ 00006 /* */ 00007 /* Copyright 2001, 2002, 2003, 2006, 2008 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 /**************************************************************************/ 00020 /* */ 00021 /* The functions defined here are called from the Type 1, CID and CFF */ 00022 /* font drivers to record the hints of a given character/glyph. */ 00023 /* */ 00024 /* The hints are recorded in a unified format, and are later processed */ 00025 /* by the `optimizer' and `fitter' to adjust the outlines to the pixel */ 00026 /* grid. */ 00027 /* */ 00028 /**************************************************************************/ 00029 00030 00031 #ifndef __PSHREC_H__ 00032 #define __PSHREC_H__ 00033 00034 00035 #include <ft2build.h> 00036 #include FT_INTERNAL_POSTSCRIPT_HINTS_H 00037 #include "pshglob.h" 00038 00039 00040 FT_BEGIN_HEADER 00041 00042 00043 /*************************************************************************/ 00044 /*************************************************************************/ 00045 /***** *****/ 00046 /***** GLYPH HINTS RECORDER INTERNALS *****/ 00047 /***** *****/ 00048 /*************************************************************************/ 00049 /*************************************************************************/ 00050 00051 /* handle to hint record */ 00052 typedef struct PS_HintRec_* PS_Hint; 00053 00054 /* hint types */ 00055 typedef enum PS_Hint_Type_ 00056 { 00057 PS_HINT_TYPE_1 = 1, 00058 PS_HINT_TYPE_2 = 2 00059 00060 } PS_Hint_Type; 00061 00062 00063 /* hint flags */ 00064 typedef enum PS_Hint_Flags_ 00065 { 00066 PS_HINT_FLAG_GHOST = 1, 00067 PS_HINT_FLAG_BOTTOM = 2 00068 00069 } PS_Hint_Flags; 00070 00071 00072 /* hint descriptor */ 00073 typedef struct PS_HintRec_ 00074 { 00075 FT_Int pos; 00076 FT_Int len; 00077 FT_UInt flags; 00078 00079 } PS_HintRec; 00080 00081 00082 #define ps_hint_is_active( x ) ( (x)->flags & PS_HINT_FLAG_ACTIVE ) 00083 #define ps_hint_is_ghost( x ) ( (x)->flags & PS_HINT_FLAG_GHOST ) 00084 #define ps_hint_is_bottom( x ) ( (x)->flags & PS_HINT_FLAG_BOTTOM ) 00085 00086 00087 /* hints table descriptor */ 00088 typedef struct PS_Hint_TableRec_ 00089 { 00090 FT_UInt num_hints; 00091 FT_UInt max_hints; 00092 PS_Hint hints; 00093 00094 } PS_Hint_TableRec, *PS_Hint_Table; 00095 00096 00097 /* hint and counter mask descriptor */ 00098 typedef struct PS_MaskRec_ 00099 { 00100 FT_UInt num_bits; 00101 FT_UInt max_bits; 00102 FT_Byte* bytes; 00103 FT_UInt end_point; 00104 00105 } PS_MaskRec, *PS_Mask; 00106 00107 00108 /* masks and counters table descriptor */ 00109 typedef struct PS_Mask_TableRec_ 00110 { 00111 FT_UInt num_masks; 00112 FT_UInt max_masks; 00113 PS_Mask masks; 00114 00115 } PS_Mask_TableRec, *PS_Mask_Table; 00116 00117 00118 /* dimension-specific hints descriptor */ 00119 typedef struct PS_DimensionRec_ 00120 { 00121 PS_Hint_TableRec hints; 00122 PS_Mask_TableRec masks; 00123 PS_Mask_TableRec counters; 00124 00125 } PS_DimensionRec, *PS_Dimension; 00126 00127 00128 /* glyph hints descriptor */ 00129 /* dimension 0 => X coordinates + vertical hints/stems */ 00130 /* dimension 1 => Y coordinates + horizontal hints/stems */ 00131 typedef struct PS_HintsRec_ 00132 { 00133 FT_Memory memory; 00134 FT_Error error; 00135 FT_UInt32 magic; 00136 PS_Hint_Type hint_type; 00137 PS_DimensionRec dimension[2]; 00138 00139 } PS_HintsRec, *PS_Hints; 00140 00141 /* */ 00142 00143 /* initialize hints recorder */ 00144 FT_LOCAL( FT_Error ) 00145 ps_hints_init( PS_Hints hints, 00146 FT_Memory memory ); 00147 00148 /* finalize hints recorder */ 00149 FT_LOCAL( void ) 00150 ps_hints_done( PS_Hints hints ); 00151 00152 /* initialize Type1 hints recorder interface */ 00153 FT_LOCAL( void ) 00154 t1_hints_funcs_init( T1_Hints_FuncsRec* funcs ); 00155 00156 /* initialize Type2 hints recorder interface */ 00157 FT_LOCAL( void ) 00158 t2_hints_funcs_init( T2_Hints_FuncsRec* funcs ); 00159 00160 00161 #ifdef DEBUG_HINTER 00162 extern PS_Hints ps_debug_hints; 00163 extern int ps_debug_no_horz_hints; 00164 extern int ps_debug_no_vert_hints; 00165 #endif 00166 00167 /* */ 00168 00169 00170 FT_END_HEADER 00171 00172 00173 #endif /* __PS_HINTER_RECORD_H__ */ 00174 00175 00176 /* END */