1 /* Copyright (C) 2001-2012 Artifex Software, Inc. 2 All Rights Reserved. 3 4 This software is provided AS-IS with no warranty, either express or 5 implied. 6 7 This software is distributed under license and may not be copied, 8 modified or distributed except as expressly authorized under the terms 9 of the license contained in the file LICENSE in this distribution. 10 11 Refer to licensing information at http://www.artifex.com or contact 12 Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, 13 CA 94903, U.S.A., +1(415)492-9861, for further information. 14 */ 15 16 17 /* Table definitions for TrueType fonts */ 18 19 #ifndef gxttf_INCLUDED 20 # define gxttf_INCLUDED 21 22 /* ------ Composite glyf component flags ------ */ 23 24 #define TT_CG_ARGS_ARE_WORDS (1<<0) 25 #define TT_CG_ARGS_ARE_XY_VALUES (1<<1) 26 #define TT_CG_ROUND_XY_TO_GRID (1<<2) 27 #define TT_CG_HAVE_SCALE (1<<3) 28 #define TT_CG_MORE_COMPONENTS (1<<5) 29 #define TT_CG_HAVE_XY_SCALE (1<<6) 30 #define TT_CG_HAVE_2X2 (1<<7) 31 #define TT_CG_HAVE_INSTRUCTIONS (1<<8) 32 #define TT_CG_USE_MY_METRICS (1<<9) 33 34 /* ------ head ------ */ 35 36 typedef struct ttf_head_s { 37 byte 38 version[4], /* version 1.0 */ 39 fontRevision[4], 40 checkSumAdjustment[4], 41 magicNumber[4], 42 flags[2], 43 unitsPerEm[2], 44 created[8], 45 modified[8], 46 xMin[2], 47 yMin[2], 48 xMax[2], 49 yMax[2], 50 macStyle[2], 51 lowestRecPPM[2], 52 fontDirectionHint[2], 53 indexToLocFormat[2], 54 glyphDataFormat[2]; 55 } ttf_head_t; 56 57 /* ------ hhea ------ */ 58 59 typedef struct ttf_hhea_s { 60 byte 61 version[4], /* version 1.0 */ 62 ascender[2], /* FWord */ 63 descender[2], /* FWord */ 64 lineGap[2], /* FWord */ 65 advanceWidthMax[2], /* uFWord */ 66 minLeftSideBearing[2], /* FWord */ 67 minRightSideBearing[2], /* FWord */ 68 xMaxExtent[2], /* FWord */ 69 caretSlopeRise[2], 70 caretSlopeRun[2], 71 caretOffset[2], 72 reserved[8], 73 metricDataFormat[2], /* 0 */ 74 numHMetrics[2]; 75 } ttf_hhea_t; 76 77 /* ------ hmtx ------ */ 78 79 typedef struct longHorMetric_s { 80 byte 81 advanceWidth[2], /* uFWord */ 82 lsb[2]; /* FWord */ 83 } longHorMetric_t; 84 85 /* ------ maxp ------ */ 86 87 typedef struct ttf_maxp_s { 88 byte 89 version[4], /* 1.0 */ 90 numGlyphs[2], 91 maxPoints[2], 92 maxContours[2], 93 maxCompositePoints[2], 94 maxCompositeContours[2], 95 maxZones[2], 96 maxTwilightPoints[2], 97 maxStorage[2], 98 maxFunctionDefs[2], 99 maxInstructionDefs[2], 100 maxStackElements[2], 101 maxSizeOfInstructions[2], 102 maxComponentElements[2], 103 maxComponentDepth[2]; 104 } ttf_maxp_t; 105 106 /* ------ OS/2 ------ */ 107 108 typedef struct ttf_OS_2_s { 109 byte 110 version[2], /* version 1 */ 111 xAvgCharWidth[2], 112 usWeightClass[2], 113 usWidthClass[2], 114 fsType[2], 115 ySubscriptXSize[2], 116 ySubscriptYSize[2], 117 ySubscriptXOffset[2], 118 ySubscriptYOffset[2], 119 ySuperscriptXSize[2], 120 ySuperscriptYSize[2], 121 ySuperscriptXOffset[2], 122 ySuperscriptYOffset[2], 123 yStrikeoutSize[2], 124 yStrikeoutPosition[2], 125 sFamilyClass[2], 126 /*panose:*/ 127 bFamilyType, bSerifStyle, bWeight, bProportion, bContrast, 128 bStrokeVariation, bArmStyle, bLetterform, bMidline, bXHeight, 129 ulUnicodeRanges[16], 130 achVendID[4], 131 fsSelection[2], 132 usFirstCharIndex[2], 133 usLastCharIndex[2], 134 sTypoAscender[2], 135 sTypoDescender[2], 136 sTypoLineGap[2], 137 usWinAscent[2], 138 usWinDescent[2], 139 ulCodePageRanges[8], 140 141 sxHeight[2], /* version 2 */ 142 sCapHeight[2], 143 usDefaultChar[2], 144 usBreakChar[2], 145 usMaxContext[2]; 146 } ttf_OS_2_t; 147 148 /* ------ vhea ------ */ 149 150 typedef struct ttf_vhea_s { 151 byte 152 version[4], /* version 1.0 */ 153 ascent[2], /* FWord */ 154 descent[2], /* FWord */ 155 lineGap[2], /* FWord */ 156 advanceHeightMax[2], /* uFWord */ 157 minTopSideBearing[2], /* FWord */ 158 minBottomSideBearing[2], /* FWord */ 159 yMaxExtent[2], /* FWord */ 160 caretSlopeRise[2], 161 caretSlopeRun[2], 162 caretOffset[2], 163 reserved[8], 164 metricDataFormat[2], /* 0 */ 165 numVMetrics[2]; 166 } ttf_vhea_t; 167 168 /* ------ vmtx ------ */ 169 170 typedef struct longVerMetric_s { 171 byte 172 advanceHeight[2], /* uFWord */ 173 topSideBearing[2]; /* FWord */ 174 } longVerMetric_t; 175 176 #endif /* gxttf_INCLUDED */ 177