w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

TtfTypes.h
Go to the documentation of this file.
1 /* GRAPHITE2 LICENSING
2 
3  Copyright 2010, SIL International
4  All rights reserved.
5 
6  This library is free software; you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation; either version 2.1 of License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should also have received a copy of the GNU Lesser General Public
17  License along with this library in the file named "LICENSE".
18  If not, write to the Free Software Foundation, 51 Franklin Street,
19  Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
20  internet at http://www.fsf.org/licenses/lgpl.html.
21 
22 Alternatively, the contents of this file may be used under the terms of the
23 Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public
24 License, as published by the Free Software Foundation, either version 2
25 of the License or (at your option) any later version.
26 */
27 #pragma once
28 /*--------------------------------------------------------------------*//*:Ignore this sentence.
29 
30 File: TtfTypes.h
31 Responsibility: Tim Eves
32 Last reviewed: Not yet.
33 
34 Description:
35 Provides types required to represent the TTF basic types.
36 -------------------------------------------------------------------------------*//*:End Ignore*/
37 
38 
39 //**********************************************************************************************
40 // Include files
41 //**********************************************************************************************
42 namespace graphite2
43 {
44 namespace TtfUtil
45 {
46 //**********************************************************************************************
47 // Forward declarations
48 //**********************************************************************************************
49 
50 
51 //**********************************************************************************************
52 // Type declarations
53 //**********************************************************************************************
54 typedef unsigned char uint8;
55 typedef uint8 byte;
56 typedef signed char int8;
57 typedef unsigned short uint16;
58 typedef short int16;
59 typedef unsigned int uint32;
60 typedef int int32;
61 
62 typedef int16 short_frac;
63 typedef int32 fixed;
64 typedef int16 fword;
65 typedef uint16 ufword;
66 typedef int16 f2dot14;
67 typedef uint32 long_date_time[2];
68 
69 //**********************************************************************************************
70 // Constants and enum types
71 //**********************************************************************************************/
72 enum
73 {
74  OneFix = 1<<16
75 };
76 
77 //**********************************************************************************************
78 // Table declarations
79 //**********************************************************************************************
80 namespace Sfnt
81 {
82 #pragma pack(push,1) // We need this or the structure members aren't aligned
83  // correctly. Fortunately this form of pragma is supposed
84  // to be recognised by VS C++ too (at least according to
85  // MSDN).
86 
87  struct OffsetSubTable
88  {
94  struct Entry
95  {
96  uint32 tag,
97  checksum,
98  offset,
99  length;
100  } table_directory[1];
101 
103  {
104  TrueTypeMac = 0x74727565U,
105  TrueTypeWin = 0x00010000U,
106  Type1 = 0x74797031U
107  };
108  };
109 
110 
111 
112 
113  struct CharacterCodeMap
114  {
115  uint16 version,
117  struct
118  {
121  uint32 offset;
122  } encoding[1];
123  };
124 
125  struct CmapSubTable
126  {
127  uint16 format,
128  length,
129  language;
130  };
131 
132  struct CmapSubTableFormat4 : CmapSubTable
133  {
135  search_range,
137  range_shift,
138  end_code[1];
139  // There are arrarys after this which need their
140  // start positions calculated since end_code is
141  // seg_count uint16s long.
142  };
143 
144  struct CmapSubTableFormat12
145  {
146  fixed format;
147  uint32 length,
148  language,
149  num_groups;
150  struct
151  {
155  } group[1];
156  };
157 
158 
159 
160  struct FontHeader
161  {
162  fixed version,
165  magic_number;
166  uint16 flags,
167  units_per_em;
169  modified;
170  fword x_min,
171  y_min,
172  x_max,
173  y_max;
179  enum
180  {
181  MagicNumber = 0x5F0F3CF5,
182  GlypDataFormat = 0
183  };
185  };
186 
187 
188 
189 
190  struct PostScriptGlyphName
191  {
192  fixed format,
193  italic_angle;
201  enum
202  {
203  Format1 = 0x10000,
204  Format2 = 0x20000,
205  Format25 = 0x28000,
206  Format3 = 0x30000,
207  Format4 = 0x40000
208  };
209  };
210 
211  struct PostScriptGlyphName2 : PostScriptGlyphName
212  {
214  glyph_name_index[1];
215  };
216 
217  struct PostScriptGlyphName25 : PostScriptGlyphName
218  {
220  int8 offset[1];
221  };
222 
223  struct PostScriptGlyphName3 : PostScriptGlyphName {};
224 
225  struct PostScriptGlyphName4 : PostScriptGlyphName
226  {
228  };
229 
230 
231  struct HorizontalHeader
232  {
233  fixed version;
234  fword ascent,
235  descent,
236  line_gap;
244  int16 reserved[4],
247  };
248 
249  struct MaximumProfile
250  {
251  fixed version;
253  max_points,
254  max_contours,
257  max_zones,
259  max_storage,
266  };
267 
268 
269  typedef byte Panose[10];
270 
271  struct Compatibility0
272  {
273  uint16 version;
276  width_class;
277  int16 fs_type,
288  family_class;
289  Panose panose;
291  int8 ach_vend_id[4];
294  fs_last_char_index, // Acording to Apple's spec this is where v0 should end
297  type_linegap,
298  win_ascent,
299  win_descent;
300 
301  enum
302  {
303  Italic =0x01,
304  Underscore=0x02,
305  Negative =0x04,
306  Outlined =0x08,
307  StrikeOut =0x10,
308  Bold =0x20
309  };
310  };
311 
312  struct Compatibility1 : Compatibility0
313  {
315  };
316 
317  struct Compatibility2 : Compatibility1
318  {
319  int16 x_height,
320  cap_height;
322  break_char,
323  max_context;
324  };
325 
326  struct Compatibility3 : Compatibility2 {};
327 
328  typedef Compatibility3 Compatibility;
329 
330 
331  struct NameRecord
332  {
335  language_id,
336  name_id,
337  length,
338  offset;
340  enum
341  {
344  };
345  };
346 
347  struct LangTagRecord
348  {
349  uint16 length,
350  offset;
351  };
352 
353  struct FontNames
354  {
355  uint16 format,
356  count,
359  };
360 
361 
362  struct HorizontalMetric
363  {
366  };
367 
368 
369  struct Glyph
370  {
372  fword x_min,
373  y_min,
374  x_max,
375  y_max;
376  };
377 
378  struct SimpleGlyph : Glyph
379  {
381  enum
382  {
383  OnCurve = 0x01,
384  XShort = 0x02,
385  YShort = 0x04,
386  Repeat = 0x08,
387  XIsSame = 0x10,
388  XIsPos = 0x10,
389  YIsSame = 0x20,
390  YIsPos = 0x20
391  };
392  };
393 
394  struct CompoundGlyph : Glyph
395  {
396  uint16 flags,
397  glyph_index;
398  enum
399  {
400  Arg1Arg2Words = 0x01,
401  ArgsAreXYValues = 0x02,
402  RoundXYToGrid = 0x04,
403  HaveScale = 0x08,
404  MoreComponents = 0x20,
405  HaveXAndYScale = 0x40,
406  HaveTwoByTwo = 0x80,
407  HaveInstructions = 0x100,
408  UseMyMetrics = 0x200,
409  OverlapCompund = 0x400,
410  ScaledOffset = 0x800,
411  UnscaledOffset = 0x1000
412  };
413  };
414 
415 #pragma pack(pop)
416 } // end of namespace Sfnt
417 
418 } // end of namespace TtfUtil
419 } // end of namespace graphite2
unsigned long Glyph
unsigned short uint16
Definition: tiff.h:62
short int16
Definition: tiff.h:61
unsigned long uint32
Definition: tiff.h:68
long int32
Definition: tiff.h:67
unsigned char uint8
Definition: tiff.h:60
char int8
Definition: tiff.h:58
Compatibility3 Compatibility
Definition: TtfTypes.h:328
uint32 long_date_time[2]
Definition: TtfTypes.h:67
unsigned char uint8
Definition: TtfTypes.h:54
unsigned short uint16
Definition: TtfTypes.h:57
unsigned int uint32
Definition: TtfTypes.h:59
signed char int8
Definition: TtfTypes.h:56
Definition: bits.h:30
gr_uint16 uint16
Definition: Main.h:40
le_int32 fixed
Definition: sfnt.h:144
Definition: fc-lang.c:248
Definition: sd.h:82