summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/tt_table.h
blob: 8b7732c2b8f2a00e5adee60533f6bbf557f2381e (plain)
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.

    Copyright (C) 2007-2016 by Jin-Hwan Cho and Shunsaku Hirata,
    the dvipdfmx project team.
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/

#ifndef _TT_TABLE_H_
#define _TT_TABLE_H_

#include "sfnt.h"

#define TT_HEAD_TABLE_SIZE 54UL
#define TT_MAXP_TABLE_SIZE 32UL
#define TT_HHEA_TABLE_SIZE 36UL
#define TT_VHEA_TABLE_SIZE 36UL

struct tt_head_table
{
  Fixed  version;
  Fixed  fontRevision;
  ULONG  checkSumAdjustment;
  ULONG  magicNumber;
  USHORT flags;
  USHORT unitsPerEm;
  BYTE   created[8];
  BYTE   modified[8];
  FWord  xMin, yMin, xMax, yMax;
  USHORT macStyle;
  USHORT lowestRecPPEM;
  SHORT  fontDirectionHint;
  SHORT  indexToLocFormat;
  SHORT  glyphDataFormat;
};

struct tt_hhea_table
{
  Fixed  version;
  FWord  ascent;
  FWord  descent;
  FWord  lineGap;
  uFWord advanceWidthMax;
  FWord  minLeftSideBearing;
  FWord  minRightSideBearing;
  FWord  xMaxExtent;
  SHORT  caretSlopeRise;
  SHORT  caretSlopeRun;
  FWord  caretOffset;
  SHORT  reserved[4]; /* set to 0 */
  SHORT  metricDataFormat;
  USHORT numOfLongHorMetrics;
  USHORT numOfExSideBearings; /* extra information */
};

struct tt_vhea_table
{
  Fixed  version;
  SHORT  vertTypoAscender;  /* v.1.1 name */
  SHORT  vertTypoDescender; /* v.1.1 name */
  SHORT  vertTypoLineGap;   /* v.1.1 name */ 
  SHORT  advanceHeightMax;
  SHORT  minTopSideBearing;
  SHORT  minBottomSideBearing;
  SHORT  yMaxExtent;
  SHORT  caretSlopeRise;
  SHORT  caretSlopeRun;
  SHORT  caretOffset;
  SHORT  reserved[4]; /* set to 0 */
  SHORT  metricDataFormat;
  USHORT numOfLongVerMetrics;
  USHORT numOfExSideBearings; /* extra information */
};

struct tt_maxp_table
{
  Fixed  version;
  USHORT numGlyphs;
  USHORT maxPoints;
  USHORT maxContours;
  USHORT maxComponentPoints;
  USHORT maxComponentContours;
  USHORT maxZones;
  USHORT maxTwilightPoints;
  USHORT maxStorage;
  USHORT maxFunctionDefs;
  USHORT maxInstructionDefs;
  USHORT maxStackElements;
  USHORT maxSizeOfInstructions;
  USHORT maxComponentElements;
  USHORT maxComponentDepth;
};

struct tt_os2__table
{
  USHORT  version; /* 0x0001 or 0x0002 */
  SHORT   xAvgCharWidth;  
  USHORT  usWeightClass;  
  USHORT  usWidthClass;   
  SHORT   fsType;  /* if (faType & 0x08) editable_embedding */
  SHORT   ySubscriptXSize;        
  SHORT   ySubscriptYSize;      
  SHORT   ySubscriptXOffset;
  SHORT   ySubscriptYOffset;      
  SHORT   ySuperscriptXSize;      
  SHORT   ySuperscriptYSize;      
  SHORT   ySuperscriptXOffset;    
  SHORT   ySuperscriptYOffset;    
  SHORT   yStrikeoutSize; 
  SHORT   yStrikeoutPosition;     
  SHORT   sFamilyClass;   
  BYTE    panose[10];
  ULONG   ulUnicodeRange1;
  ULONG   ulUnicodeRange2;
  ULONG   ulUnicodeRange3;
  ULONG   ulUnicodeRange4;
  CHAR    achVendID[4];   
  USHORT  fsSelection;    
  USHORT  usFirstCharIndex;
  USHORT  usLastCharIndex;
  SHORT   sTypoAscender;  /* TTF spec. from MS is wrong */
  SHORT   sTypoDescender; /* TTF spec. from MS is wrong */
  SHORT   sTypoLineGap;   /* TTF spec. from MS is wrong */
  USHORT  usWinAscent;   
  USHORT  usWinDescent;    
  ULONG   ulCodePageRange1;
  ULONG   ulCodePageRange2;
  /* version 0x0002 */
  SHORT   sxHeight;
  SHORT   sCapHeight;
  USHORT  usDefaultChar;
  USHORT  usBreakChar;
  USHORT  usMaxContext;
};

struct tt_vertOriginYMetrics {
  USHORT glyphIndex;
  SHORT  vertOriginY;
};

struct tt_VORG_table {
  SHORT  defaultVertOriginY;
  USHORT numVertOriginYMetrics;
  struct tt_vertOriginYMetrics *vertOriginYMetrics;
};

/* hmtx and vmtx */
struct tt_longMetrics
{
  USHORT advance;
  SHORT  sideBearing;
};


/* head, hhea, maxp */
extern char  *tt_pack_head_table (struct tt_head_table *table);
extern struct tt_head_table *tt_read_head_table (sfnt *sfont);
extern char  *tt_pack_hhea_table (struct tt_hhea_table *table);
extern struct tt_hhea_table *tt_read_hhea_table (sfnt *sfont);
extern char  *tt_pack_maxp_table (struct tt_maxp_table *table);
extern struct tt_maxp_table *tt_read_maxp_table (sfnt *sfont);

/* vhea */
#if 0
extern char  *tt_pack_vhea_table (struct tt_vhea_table *table);
#endif
extern struct tt_vhea_table *tt_read_vhea_table (sfnt *sfont);

/* VORG */
extern struct tt_VORG_table *tt_read_VORG_table (sfnt *sfont);

/* hmtx and vmtx */
extern struct tt_longMetrics *tt_read_longMetrics (sfnt *sfont,
						   USHORT numGlyphs, USHORT numLongMetrics, USHORT numExSideBearings);

/* OS/2 table */
extern struct tt_os2__table *tt_read_os2__table (sfnt *sfont);

/* name table */
extern USHORT tt_get_ps_fontname (sfnt *sfont, char *dest, USHORT destlen);

#endif /* _TT_TABLE_H_ */