00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __PCF_H__
00029 #define __PCF_H__
00030
00031
00032 #include <ft2build.h>
00033 #include FT_INTERNAL_DRIVER_H
00034 #include FT_INTERNAL_STREAM_H
00035
00036
00037 FT_BEGIN_HEADER
00038
00039 typedef struct PCF_TableRec_
00040 {
00041 FT_ULong type;
00042 FT_ULong format;
00043 FT_ULong size;
00044 FT_ULong offset;
00045
00046 } PCF_TableRec, *PCF_Table;
00047
00048
00049 typedef struct PCF_TocRec_
00050 {
00051 FT_ULong version;
00052 FT_ULong count;
00053 PCF_Table tables;
00054
00055 } PCF_TocRec, *PCF_Toc;
00056
00057
00058 typedef struct PCF_ParsePropertyRec_
00059 {
00060 FT_Long name;
00061 FT_Byte isString;
00062 FT_Long value;
00063
00064 } PCF_ParsePropertyRec, *PCF_ParseProperty;
00065
00066
00067 typedef struct PCF_PropertyRec_
00068 {
00069 FT_String* name;
00070 FT_Byte isString;
00071
00072 union
00073 {
00074 FT_String* atom;
00075 FT_Long l;
00076 FT_ULong ul;
00077
00078 } value;
00079
00080 } PCF_PropertyRec, *PCF_Property;
00081
00082
00083 typedef struct PCF_Compressed_MetricRec_
00084 {
00085 FT_Byte leftSideBearing;
00086 FT_Byte rightSideBearing;
00087 FT_Byte characterWidth;
00088 FT_Byte ascent;
00089 FT_Byte descent;
00090
00091 } PCF_Compressed_MetricRec, *PCF_Compressed_Metric;
00092
00093
00094 typedef struct PCF_MetricRec_
00095 {
00096 FT_Short leftSideBearing;
00097 FT_Short rightSideBearing;
00098 FT_Short characterWidth;
00099 FT_Short ascent;
00100 FT_Short descent;
00101 FT_Short attributes;
00102 FT_ULong bits;
00103
00104 } PCF_MetricRec, *PCF_Metric;
00105
00106
00107 typedef struct PCF_AccelRec_
00108 {
00109 FT_Byte noOverlap;
00110 FT_Byte constantMetrics;
00111 FT_Byte terminalFont;
00112 FT_Byte constantWidth;
00113 FT_Byte inkInside;
00114 FT_Byte inkMetrics;
00115 FT_Byte drawDirection;
00116 FT_Long fontAscent;
00117 FT_Long fontDescent;
00118 FT_Long maxOverlap;
00119 PCF_MetricRec minbounds;
00120 PCF_MetricRec maxbounds;
00121 PCF_MetricRec ink_minbounds;
00122 PCF_MetricRec ink_maxbounds;
00123
00124 } PCF_AccelRec, *PCF_Accel;
00125
00126
00127 typedef struct PCF_EncodingRec_
00128 {
00129 FT_Long enc;
00130 FT_UShort glyph;
00131
00132 } PCF_EncodingRec, *PCF_Encoding;
00133
00134
00135 typedef struct PCF_FaceRec_
00136 {
00137 FT_FaceRec root;
00138
00139 FT_StreamRec gzip_stream;
00140 FT_Stream gzip_source;
00141
00142 char* charset_encoding;
00143 char* charset_registry;
00144
00145 PCF_TocRec toc;
00146 PCF_AccelRec accel;
00147
00148 int nprops;
00149 PCF_Property properties;
00150
00151 FT_Long nmetrics;
00152 PCF_Metric metrics;
00153 FT_Long nencodings;
00154 PCF_Encoding encodings;
00155
00156 FT_Short defaultChar;
00157
00158 FT_ULong bitmapsFormat;
00159
00160 FT_CharMap charmap_handle;
00161 FT_CharMapRec charmap;
00162
00163 } PCF_FaceRec, *PCF_Face;
00164
00165
00166
00167
00168 #define LSBFirst 0
00169 #define MSBFirst 1
00170
00171 #define PCF_FILE_VERSION ( ( 'p' << 24 ) | \
00172 ( 'c' << 16 ) | \
00173 ( 'f' << 8 ) | 1 )
00174 #define PCF_FORMAT_MASK 0xFFFFFF00UL
00175
00176 #define PCF_DEFAULT_FORMAT 0x00000000UL
00177 #define PCF_INKBOUNDS 0x00000200UL
00178 #define PCF_ACCEL_W_INKBOUNDS 0x00000100UL
00179 #define PCF_COMPRESSED_METRICS 0x00000100UL
00180
00181 #define PCF_FORMAT_MATCH( a, b ) \
00182 ( ( (a) & PCF_FORMAT_MASK ) == ( (b) & PCF_FORMAT_MASK ) )
00183
00184 #define PCF_GLYPH_PAD_MASK ( 3 << 0 )
00185 #define PCF_BYTE_MASK ( 1 << 2 )
00186 #define PCF_BIT_MASK ( 1 << 3 )
00187 #define PCF_SCAN_UNIT_MASK ( 3 << 4 )
00188
00189 #define PCF_BYTE_ORDER( f ) \
00190 ( ( (f) & PCF_BYTE_MASK ) ? MSBFirst : LSBFirst )
00191 #define PCF_BIT_ORDER( f ) \
00192 ( ( (f) & PCF_BIT_MASK ) ? MSBFirst : LSBFirst )
00193 #define PCF_GLYPH_PAD_INDEX( f ) \
00194 ( (f) & PCF_GLYPH_PAD_MASK )
00195 #define PCF_GLYPH_PAD( f ) \
00196 ( 1 << PCF_GLYPH_PAD_INDEX( f ) )
00197 #define PCF_SCAN_UNIT_INDEX( f ) \
00198 ( ( (f) & PCF_SCAN_UNIT_MASK ) >> 4 )
00199 #define PCF_SCAN_UNIT( f ) \
00200 ( 1 << PCF_SCAN_UNIT_INDEX( f ) )
00201 #define PCF_FORMAT_BITS( f ) \
00202 ( (f) & ( PCF_GLYPH_PAD_MASK | \
00203 PCF_BYTE_MASK | \
00204 PCF_BIT_MASK | \
00205 PCF_SCAN_UNIT_MASK ) )
00206
00207 #define PCF_SIZE_TO_INDEX( s ) ( (s) == 4 ? 2 : (s) == 2 ? 1 : 0 )
00208 #define PCF_INDEX_TO_SIZE( b ) ( 1 << b )
00209
00210 #define PCF_FORMAT( bit, byte, glyph, scan ) \
00211 ( ( PCF_SIZE_TO_INDEX( scan ) << 4 ) | \
00212 ( ( (bit) == MSBFirst ? 1 : 0 ) << 3 ) | \
00213 ( ( (byte) == MSBFirst ? 1 : 0 ) << 2 ) | \
00214 ( PCF_SIZE_TO_INDEX( glyph ) << 0 ) )
00215
00216 #define PCF_PROPERTIES ( 1 << 0 )
00217 #define PCF_ACCELERATORS ( 1 << 1 )
00218 #define PCF_METRICS ( 1 << 2 )
00219 #define PCF_BITMAPS ( 1 << 3 )
00220 #define PCF_INK_METRICS ( 1 << 4 )
00221 #define PCF_BDF_ENCODINGS ( 1 << 5 )
00222 #define PCF_SWIDTHS ( 1 << 6 )
00223 #define PCF_GLYPH_NAMES ( 1 << 7 )
00224 #define PCF_BDF_ACCELERATORS ( 1 << 8 )
00225
00226 #define GLYPHPADOPTIONS 4
00227
00228 FT_LOCAL( FT_Error )
00229 pcf_load_font( FT_Stream,
00230 PCF_Face );
00231
00232 FT_END_HEADER
00233
00234 #endif
00235
00236
00237