1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
/*
* see COPYRIGHT
*/
/* these definitions are mostly taken from Microsoft's True Type
documentation.
*/
#define BYTE unsigned char
#define CHAR signed char
#define USHORT unsigned short
#define SHORT signed short
#define ULONG unsigned int
#define LONG signed int
#define FWORD SHORT
#define UFWORD USHORT
#define ONOROFF 0x01
#define XSHORT 0x02
#define YSHORT 0x04
#define REPEAT 0x08
#define XSAME 0x10
#define YSAME 0x20
#define ARG_1_AND_2_ARE_WORDS 0x0001
#define ARGS_ARE_XY_VALUES 0x0002
#define XY_BOUND_TO_GRID 0x0004
#define WE_HAVE_A_SCALE 0x0008
#define MORE_COMPONENTS 0x0020
#define WE_HAVE_AN_X_AND_Y_SCALE 0x0040
#define WE_HAVE_A_TWO_BY_TWO 0x0080
#define WE_HAVE_INSTRUCTIONS 0x0100
#define USE_MY_METRICS 0x0200
typedef struct short_2 {
SHORT upper;
USHORT lower;
} FIXED ;
typedef struct longhormetric {
UFWORD advanceWidth;
FWORD lsb;
} LONGHORMETRIC;
typedef struct ttf_hhea {
BYTE version[4];
SHORT ascender, descender, lineGap;
USHORT advnaceWidthMax;
SHORT minLSB, minRSB, xMaxExtent;
SHORT caretSlopeRise, caretSlopeRun;
SHORT reserved[5];
SHORT metricDataFormat;
USHORT numberOfHMetrics;
} TTF_HHEA;
typedef struct ttf_dir_entry {
char tag[4];
ULONG checksum;
ULONG offset;
ULONG length;
} TTF_DIR_ENTRY ;
typedef struct ttf_directory {
ULONG sfntVersion;
USHORT numTables;
USHORT searchRange;
USHORT entrySelector;
USHORT rangeShift;
TTF_DIR_ENTRY list;
} TTF_DIRECTORY ;
typedef struct ttf_name_rec {
USHORT platformID;
USHORT encodingID;
USHORT languageID;
USHORT nameID;
USHORT stringLength;
USHORT stringOffset;
} TTF_NAME_REC;
typedef struct ttf_name {
USHORT format;
USHORT numberOfNameRecords;
USHORT offset;
TTF_NAME_REC nameRecords;
} TTF_NAME ;
typedef struct ttf_head {
ULONG version;
ULONG fontRevision;
ULONG checksumAdjust;
ULONG magicNo;
USHORT flags;
USHORT unitsPerEm;
BYTE created[8];
BYTE modified[8];
FWORD xMin, yMin, xMax, yMax;
USHORT macStyle, lowestRecPPEM;
SHORT fontDirection, indexToLocFormat, glyphDataFormat;
} TTF_HEAD ;
typedef struct ttf_kern {
USHORT version, nTables;
} TTF_KERN ;
typedef struct ttf_kern_sub {
USHORT version, length, coverage;
USHORT nPairs, searchRange, entrySelector, rangeShift;
} TTF_KERN_SUB;
typedef struct ttf_kern_entry {
USHORT left, right;
FWORD value;
} TTF_KERN_ENTRY;
typedef struct ttf_cmap_fmt0 {
USHORT format;
USHORT length;
USHORT version;
BYTE glyphIdArray[256];
} TTF_CMAP_FMT0;
typedef struct ttf_cmap_fmt4 {
USHORT format;
USHORT length;
USHORT version;
USHORT segCountX2;
USHORT searchRange;
USHORT entrySelector;
USHORT rangeShift;
} TTF_CMAP_FMT4;
typedef struct ttf_cmap_entry {
USHORT platformID;
USHORT encodingID;
ULONG offset;
} TTF_CMAP_ENTRY;
typedef struct ttf_cmap {
USHORT version;
USHORT numberOfEncodingTables;
TTF_CMAP_ENTRY encodingTable[1];
} TTF_CMAP ;
typedef struct ttf_glyf {
SHORT numberOfContours;
FWORD xMin, yMin, xMax, yMax;
} TTF_GLYF ;
typedef struct ttf_maxp {
ULONG version;
USHORT numGlyphs, maxPoints, maxContours;
USHORT maxCompositePoints, maxCompositeContours;
USHORT maxZones, maxTwilightPoints, maxStorage;
USHORT maxFunctionDefs, maxInstructionsDefs;
USHORT maxSizeOfInstructions, maxComponentElements;
USHORT maxComponentDepth;
} TTF_MAXP ;
typedef struct ttf_post_head {
ULONG formatType;
FIXED italicAngle;
FWORD underlinePosition;
FWORD underlineThickness;
ULONG isFixedPitch;
ULONG minMemType42;
ULONG maxMemType42;
ULONG minMemType1;
ULONG maxMemType1;
USHORT numGlyphs;
USHORT glyphNameIndex;
} TTF_POST_HEAD ;
|