Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members  

ttf42_types.h

Go to the documentation of this file.
00001 /*  $Id: ttf42_types.h,v 1.2 2000/11/30 02:25:10 dbryson Exp $ */
00002 
00006 #ifndef INCLUDE_TTF42_TYPES
00007 #define INCLUDE_TTF42_TYPES
00008 
00009 #ifdef __cplusplus
00010 extern "C" {
00011 #endif
00012 
00013 /* Copyright (c) 1997-1998 by Juliusz Chroboczek */
00014 
00015 typedef unsigned char BYTE;
00016 typedef signed char CHAR;
00017 typedef unsigned short USHORT;
00018 typedef short SHORT;
00019 typedef unsigned long ULONG;
00020 typedef long LONG;
00021 
00022 /* Endianness conversions */
00023 #ifndef WORDS_BIGENDIAN
00024 #define H(x) ((SHORT)((((SHORT)(x))&0xFF)<<8)+(((USHORT)(x))>>8))
00025 #define UH(x) ((USHORT)((((USHORT)(x))&0xFF)<<8)+(((USHORT)(x))>>8))
00026 #define L(x) ((LONG)(((LONG)UH((x)&0xFFFF))<<16)+UH(((ULONG)(x))>>16))
00027 #define UL(x) ((ULONG)(((ULONG)UH((x)&0xFFFF))<<16)+UH(((ULONG)(x))>>16))
00028 #else
00029 #define H(x) ((SHORT)x)
00030 #define UH(x) ((USHORT)x)
00031 #define L(x) ((LONG)x)
00032 #define UL(x) ((ULONG)x)
00033 #endif
00034 
00035 #define FIX_H(x) x=H(x)
00036 #define FIX_UH(x) x=UH(x)
00037 #define FIX_L(x) x=L(x)
00038 #define FIX_UL(x) x=UL(x)
00039 
00040 /* We are assuming that the compiler will not pad the following
00041  * structures; note that their members are intrinsically properly
00042  * aligned.  This will probably break on some machines. */
00043 
00044 typedef struct {
00045   SHORT mantissa;
00046   USHORT fraction;
00047 } Fixed;
00048 
00049 #define FIX_Fixed(x) {(x).mantissa=H((x).mantissa); (x).fraction=UH((x).fraction);}
00050 
00051 typedef struct { BYTE data[8];} longDateTime;
00052 
00053 typedef USHORT uFWord;
00054 typedef SHORT FWord;
00055 typedef USHORT F2Dot14;
00056 
00057 #define MAKE_ULONG(a,b,c,d) ((ULONG)(((ULONG)(a)<<24)|((b)<<16)|((c)<<8)|(d)))
00058 
00059 /*------------------------------------------------------------*/
00060 
00061 struct OffsetTable {
00062   Fixed version;
00063   USHORT numTables;
00064   USHORT searchRange;
00065   USHORT entrySelector;
00066   USHORT rangeShift;
00067 };
00068 #define FIX_OffsetTable(x) \
00069   {FIX_Fixed((x).version);\
00070    FIX_UH((x).numTables);\
00071    FIX_UH((x).searchRange);\
00072    FIX_UH((x).entrySelector);}                            
00073 
00074 struct TableDirectoryEntry {
00075   ULONG tag;
00076   ULONG checkSum;
00077   ULONG offset;
00078   ULONG length;
00079 };
00080 #define FIX_TableDirectoryEntry(x) \
00081   {FIX_UL((x).tag); FIX_UL((x).checkSum);\
00082    FIX_UL((x).offset); FIX_UL((x).length);}
00083 
00084 /*------------------------------------------------------------*/
00085 
00086 struct HeadTable {
00087   Fixed version;
00088   Fixed fontRevision;
00089   ULONG checkSumAdjustment;
00090   ULONG magicNumber;
00091   USHORT flags;
00092   USHORT unitsPerEm;
00093   longDateTime created;
00094   longDateTime modified;
00095   FWord xMin;
00096   FWord yMin;
00097   FWord xMax;
00098   FWord yMax;
00099   USHORT macStyle;
00100   USHORT lowestRecPPEM;
00101   SHORT fontDirectionHint;
00102   SHORT indexToLocFormat;
00103   SHORT glyphDataFormat;
00104 };
00105 #define FIX_HeadTable(x) \
00106   {FIX_Fixed((x).version); FIX_Fixed((x).fontRevision);\
00107    FIX_UL((x).checkSumAdjustment); FIX_UL((x).magicNumber);\
00108    FIX_UH((x).flags); FIX_UH((x).unitsPerEm);\
00109    FIX_UH((x).xMin); FIX_UH((x).yMin); FIX_UH((x).xMax); FIX_UH((x).yMax);\
00110    FIX_UH((x).macStyle); FIX_UH((x).lowestRecPPEM);\
00111    FIX_H((x).fontDirectionHint); FIX_H((x).indexToLocFormat);\
00112    FIX_H((x).glyphDataFormat);}
00113 
00114 
00115 /*------------------------------------------------------------*/
00116 
00117 struct NameRecord {
00118   USHORT platformID;
00119   USHORT encodingID;
00120   USHORT languageID;
00121   USHORT nameID;
00122   USHORT length;
00123   USHORT offset;
00124 };
00125 #define FIX_NameRecord(x) \
00126   {FIX_UH((x).platformID); FIX_UH((x).encodingID); FIX_UH((x).languageID);\
00127    FIX_UH((x).nameID); FIX_UH((x).length); FIX_UH((x).offset);}
00128 
00129 
00130 
00131 /*------------------------------------------------------------*/
00132 
00133 struct PostTable {
00134 Fixed formatType;
00135 Fixed italicAngle;
00136 FWord underlinePosition;
00137 FWord underlineThickness;
00138 ULONG isFixedPitch;
00139 ULONG minMemType42;
00140 ULONG maxMemType42;
00141 ULONG minMemType1;
00142 ULONG maxMemType1;
00143 };
00144 #define FIX_PostTable(x) \
00145   {FIX_Fixed((x).formatType); FIX_Fixed((x).italicAngle);\
00146    FIX_H((x).underlinePosition); FIX_H((x).underlineThickness);\
00147    FIX_UL((x).isFixedPitch);\
00148    FIX_UL((x).minMemType42); FIX_UL((x).maxMemType42);\
00149    FIX_UL((x).minMemType1); FIX_UL((x).maxMemType1); }
00150 
00151 struct GlyphName {
00152   int type;
00153   union {
00154     int index;
00155     char *name;
00156   } name;
00157 };
00158 
00159 /*-----------------------------------------------------------------*/
00160 struct HheaTable {
00161   Fixed version;
00162   FWord Ascender;
00163   FWord Descender;
00164   FWord LineGap;
00165   uFWord advanceWidthMax;
00166   FWord minLeftSideBearing;
00167   FWord minRightSideBearing;
00168   FWord xMaxExtent;
00169   SHORT caretSlopeRise;
00170   SHORT caretSlopeRun;
00171   SHORT reserved[5];
00172   SHORT metricDataFormat;
00173   USHORT numberOfHMetrics;
00174 };
00175 #define FIX_HheaTable(x) \
00176   {FIX_Fixed((x).version); FIX_H((x).Ascender); FIX_H((x).Descender); FIX_H((x).LineGap);\
00177    FIX_UH((x).advanceWidthMax);\
00178    FIX_H((x).minLeftSideBearing); FIX_H((x).minRightSideBearing);\
00179    FIX_H((x).xMaxExtent); FIX_H((x).caretSlopeRise); FIX_H((x).caretSlopeRun);\
00180    FIX_H((x).metricDataFormat); FIX_UH((x).numberOfHMetrics);}
00181 
00182 struct Box {
00183   FWord xMin;
00184   FWord yMin;
00185   FWord xMax;
00186   FWord yMax;
00187 };
00188 #define FIX_Box(x) {FIX_H((x).xMin); FIX_H((x).yMin); FIX_H((x).xMax); FIX_H((x).yMax);}
00189 
00190 typedef struct {
00191   uFWord advanceWidth;
00192   FWord lsb;
00193 } longHorMetric;
00194 #define FIX_longHorMetric(x) {FIX_UH((x).advanceWidth); FIX_H((x).lsb);}
00195 
00196 /*------------------------------------------------------------*/
00197 struct KernTable {
00198   USHORT version;
00199   USHORT nTables;
00200 };
00201 #define FIX_KernTable(x) {FIX_UH((x).version); FIX_UH((x).nTables);}
00202 
00203 struct KernSubTableHeader {
00204   USHORT version;
00205   USHORT length;
00206   USHORT coverage;
00207 };
00208 #define FIX_KernSubTableHeader(x) \
00209   {FIX_UH((x).version); FIX_UH((x).length); FIX_UH((x).coverage);}
00210 
00211 
00212 #define kernHorizontal 0x0001
00213 #define kernMinimum 0x0002
00214 #define kernCrossStream 0x0004
00215 #define kernOverride 0x0008
00216 #define kernFormat(coverage) ((coverage)>>8)
00217 
00218 struct KernSubTable0 {
00219   USHORT nPairs;
00220   USHORT searchRange;
00221   USHORT entrySelector;
00222   USHORT rangeShift;
00223 };
00224 
00225 #define FIX_KernSubTable0(x) \
00226   {FIX_UH((x).nPairs); FIX_UH((x).searchRange);\
00227    FIX_UH((x).entrySelector); FIX_UH((x).rangeShift);}
00228 
00229 struct KernEntry0 {
00230   USHORT left;
00231   USHORT right;
00232   FWord value;
00233 };
00234 #define FIX_KernEntry0(x) \
00235   {FIX_UH((x).left); FIX_UH((x).right); FIX_H((x).value);}
00236 
00237 
00238 /*------------------------------------------------------------*/
00239 /* Hashtables */
00240 
00241 struct hashtable_entry {
00242   char *key;
00243   int value;
00244 };
00245 
00246 struct hashtable_bucket {
00247   int size;
00248   int nentries;
00249   struct hashtable_entry *entries;
00250 };
00251 
00252 struct hashtable {
00253   int size;
00254   struct hashtable_bucket **buckets;
00255 };
00256 
00257 #ifdef __cplusplus
00258 }
00259 #endif
00260 
00261 #endif /* INCLUDE_TTF42_TYPES */

Generated at Mon Dec 11 22:46:28 2000 for Postscript Utility Library by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000