| 1 |
/* tt_table.h |
| 2 |
|
| 3 |
Copyright 2002 by Jin-Hwan Cho and Shunsaku Hirata, |
| 4 |
the dvipdfmx project team <[email protected]> |
| 5 |
Copyright 2006-2008 Taco Hoekwater <[email protected]> |
| 6 |
|
| 7 |
This file is part of LuaTeX. |
| 8 |
|
| 9 |
LuaTeX is free software; you can redistribute it and/or modify it under |
| 10 |
the terms of the GNU General Public License as published by the Free |
| 11 |
Software Foundation; either version 2 of the License, or (at your |
| 12 |
option) any later version. |
| 13 |
|
| 14 |
LuaTeX is distributed in the hope that it will be useful, but WITHOUT |
| 15 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 16 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
| 17 |
License for more details. |
| 18 |
|
| 19 |
You should have received a copy of the GNU General Public License along |
| 20 |
with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ |
| 21 |
|
| 22 |
|
| 23 |
#ifndef _TT_TABLE_H_ |
| 24 |
# define _TT_TABLE_H_ |
| 25 |
|
| 26 |
# include "sfnt.h" |
| 27 |
|
| 28 |
# define TT_HEAD_TABLE_SIZE 54UL |
| 29 |
# define TT_MAXP_TABLE_SIZE 32UL |
| 30 |
# define TT_HHEA_TABLE_SIZE 36UL |
| 31 |
# define TT_VHEA_TABLE_SIZE 36UL |
| 32 |
|
| 33 |
struct tt_head_table { |
| 34 |
Fixed version; |
| 35 |
Fixed fontRevision; |
| 36 |
ULONG checkSumAdjustment; |
| 37 |
ULONG magicNumber; |
| 38 |
USHORT flags; |
| 39 |
USHORT unitsPerEm; |
| 40 |
BYTE created[8]; |
| 41 |
BYTE modified[8]; |
| 42 |
FWord xMin, yMin, xMax, yMax; |
| 43 |
USHORT macStyle; |
| 44 |
USHORT lowestRecPPEM; |
| 45 |
SHORT fontDirectionHint; |
| 46 |
SHORT indexToLocFormat; |
| 47 |
SHORT glyphDataFormat; |
| 48 |
}; |
| 49 |
|
| 50 |
struct tt_hhea_table { |
| 51 |
Fixed version; |
| 52 |
FWord Ascender; |
| 53 |
FWord Descender; |
| 54 |
FWord LineGap; |
| 55 |
uFWord advanceWidthMax; |
| 56 |
FWord minLeftSideBearing; |
| 57 |
FWord minRightSideBearing; |
| 58 |
FWord xMaxExtent; |
| 59 |
SHORT caretSlopeRise; |
| 60 |
SHORT caretSlopeRun; |
| 61 |
SHORT reserved[5]; /* set to 0 */ |
| 62 |
SHORT metricDataFormat; |
| 63 |
USHORT numberOfHMetrics; |
| 64 |
}; |
| 65 |
|
| 66 |
struct tt_vhea_table { |
| 67 |
Fixed version; |
| 68 |
SHORT vertTypoAscender; /* v.1.1 name */ |
| 69 |
SHORT vertTypoDescender; /* v.1.1 name */ |
| 70 |
SHORT vertTypoLineGap; /* v.1.1 name */ |
| 71 |
SHORT advanceHeightMax; |
| 72 |
SHORT minTopSideBearing; |
| 73 |
SHORT minBottomSideBearing; |
| 74 |
SHORT yMaxExtent; |
| 75 |
SHORT caretSlopeRise; |
| 76 |
SHORT caretSlopeRun; |
| 77 |
SHORT caretOffset; |
| 78 |
SHORT reserved[5]; /* set to 0 */ |
| 79 |
USHORT numOfLongVerMetrics; |
| 80 |
}; |
| 81 |
|
| 82 |
struct tt_maxp_table { |
| 83 |
Fixed version; |
| 84 |
USHORT numGlyphs; |
| 85 |
USHORT maxPoints; |
| 86 |
USHORT maxContours; |
| 87 |
USHORT maxComponentPoints; |
| 88 |
USHORT maxComponentContours; |
| 89 |
USHORT maxZones; |
| 90 |
USHORT maxTwilightPoints; |
| 91 |
USHORT maxStorage; |
| 92 |
USHORT maxFunctionDefs; |
| 93 |
USHORT maxInstructionDefs; |
| 94 |
USHORT maxStackElements; |
| 95 |
USHORT maxSizeOfInstructions; |
| 96 |
USHORT maxComponentElements; |
| 97 |
USHORT maxComponentDepth; |
| 98 |
}; |
| 99 |
|
| 100 |
struct tt_os2__table { |
| 101 |
USHORT version; /* 0x0001 or 0x0002 */ |
| 102 |
SHORT xAvgCharWidth; |
| 103 |
USHORT usWeightClass; |
| 104 |
USHORT usWidthClass; |
| 105 |
SHORT fsType; /* if (faType & 0x08) editable_embedding */ |
| 106 |
SHORT ySubscriptXSize; |
| 107 |
SHORT ySubscriptYSize; |
| 108 |
SHORT ySubscriptXOffset; |
| 109 |
SHORT ySubscriptYOffset; |
| 110 |
SHORT ySuperscriptXSize; |
| 111 |
SHORT ySuperscriptYSize; |
| 112 |
SHORT ySuperscriptXOffset; |
| 113 |
SHORT ySuperscriptYOffset; |
| 114 |
SHORT yStrikeoutSize; |
| 115 |
SHORT yStrikeoutPosition; |
| 116 |
SHORT sFamilyClass; |
| 117 |
BYTE panose[10]; |
| 118 |
ULONG ulUnicodeRange1; |
| 119 |
ULONG ulUnicodeRange2; |
| 120 |
ULONG ulUnicodeRange3; |
| 121 |
ULONG ulUnicodeRange4; |
| 122 |
ICHAR achVendID[4]; |
| 123 |
USHORT fsSelection; |
| 124 |
USHORT usFirstCharIndex; |
| 125 |
USHORT usLastCharIndex; |
| 126 |
SHORT sTypoAscender; /* TTF spec. from MS is wrong */ |
| 127 |
SHORT sTypoDescender; /* TTF spec. from MS is wrong */ |
| 128 |
SHORT sTypoLineGap; /* TTF spec. from MS is wrong */ |
| 129 |
USHORT usWinAscent; |
| 130 |
USHORT usWinDescent; |
| 131 |
ULONG ulCodePageRange1; |
| 132 |
ULONG ulCodePageRange2; |
| 133 |
/* version 0x0002 */ |
| 134 |
SHORT sxHeight; |
| 135 |
SHORT sCapHeight; |
| 136 |
USHORT usDefaultChar; |
| 137 |
USHORT usBreakChar; |
| 138 |
USHORT usMaxContext; |
| 139 |
}; |
| 140 |
|
| 141 |
struct tt_vertOriginYMetrics { |
| 142 |
USHORT glyphIndex; |
| 143 |
SHORT vertOriginY; |
| 144 |
}; |
| 145 |
|
| 146 |
struct tt_VORG_table { |
| 147 |
SHORT defaultVertOriginY; |
| 148 |
USHORT numVertOriginYMetrics; |
| 149 |
struct tt_vertOriginYMetrics *vertOriginYMetrics; |
| 150 |
}; |
| 151 |
|
| 152 |
/* hmtx and vmtx */ |
| 153 |
struct tt_longMetrics { |
| 154 |
USHORT advance; |
| 155 |
SHORT sideBearing; |
| 156 |
}; |
| 157 |
|
| 158 |
|
| 159 |
/* head, hhea, maxp */ |
| 160 |
extern char *tt_pack_head_table(struct tt_head_table *table); |
| 161 |
extern struct tt_head_table *tt_read_head_table(sfnt * sfont); |
| 162 |
extern char *tt_pack_hhea_table(struct tt_hhea_table *table); |
| 163 |
extern struct tt_hhea_table *tt_read_hhea_table(sfnt * sfont); |
| 164 |
extern char *tt_pack_maxp_table(struct tt_maxp_table *table); |
| 165 |
extern struct tt_maxp_table *tt_read_maxp_table(sfnt * sfont); |
| 166 |
|
| 167 |
/* vhea */ |
| 168 |
extern char *tt_pack_vhea_table(struct tt_vhea_table *table); |
| 169 |
extern struct tt_vhea_table *tt_read_vhea_table(sfnt * sfont); |
| 170 |
|
| 171 |
/* VORG */ |
| 172 |
extern struct tt_VORG_table *tt_read_VORG_table(sfnt * sfont); |
| 173 |
|
| 174 |
/* hmtx and vmtx */ |
| 175 |
extern struct tt_longMetrics *tt_read_longMetrics(sfnt * sfont, |
| 176 |
USHORT numGlyphs, |
| 177 |
USHORT numLongMetrics); |
| 178 |
|
| 179 |
/* OS/2 table */ |
| 180 |
extern struct tt_os2__table *tt_read_os2__table(sfnt * sfont); |
| 181 |
|
| 182 |
/* name table */ |
| 183 |
extern USHORT tt_get_name(sfnt * sfont, char *dest, USHORT destlen, |
| 184 |
USHORT plat_id, USHORT enco_id, |
| 185 |
USHORT lang_id, USHORT name_id); |
| 186 |
extern USHORT tt_get_ps_fontname(sfnt * sfont, char *dest, USHORT destlen); |
| 187 |
|
| 188 |
#endif /* _TT_TABLE_H_ */ |