hb-open-file.hh 15.6 KB
Newer Older
1
/*
B
Behdad Esfahbod 已提交
2
 * Copyright © 2007,2008,2009  Red Hat, Inc.
3
 * Copyright © 2012  Google, Inc.
4
 *
B
Behdad Esfahbod 已提交
5
 *  This is part of HarfBuzz, a text shaping library.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 *
 * Permission is hereby granted, without written agreement and without
 * license or royalty fees, to use, copy, modify, and distribute this
 * software and its documentation for any purpose, provided that the
 * above copyright notice and the following two paragraphs appear in
 * all copies of this software.
 *
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 *
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Red Hat Author(s): Behdad Esfahbod
26
 * Google Author(s): Behdad Esfahbod
27 28
 */

29 30
#ifndef HB_OPEN_FILE_HH
#define HB_OPEN_FILE_HH
31

32
#include "hb-open-type.hh"
33
#include "hb-ot-head-table.hh"
34

B
Behdad Esfahbod 已提交
35

36 37
namespace OT {

38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

/*
 *
 * The OpenType Font File
 *
 */


/*
 * Organization of an OpenType Font
 */

struct OpenTypeFontFile;
struct OffsetTable;
struct TTCHeader;

B
Behdad Esfahbod 已提交
54

55
typedef struct TableRecord
56
{
57
  int cmp (Tag t) const
58
  { return -t.cmp (tag); }
59

B
Behdad Esfahbod 已提交
60 61 62 63 64 65 66
  static int cmp (const void *pa, const void *pb)
  {
    const TableRecord *a = (const TableRecord *) pa;
    const TableRecord *b = (const TableRecord *) pb;
    return b->cmp (a->tag);
  }

B
Behdad Esfahbod 已提交
67 68
  inline bool sanitize (hb_sanitize_context_t *c) const
  {
B
Behdad Esfahbod 已提交
69
    TRACE_SANITIZE (this);
B
Behdad Esfahbod 已提交
70
    return_trace (c->check_struct (this));
B
Behdad Esfahbod 已提交
71 72
  }

73 74
  Tag		tag;		/* 4-byte identifier. */
  CheckSum	checkSum;	/* CheckSum for this table. */
B
Behdad Esfahbod 已提交
75
  Offset32	offset;		/* Offset from beginning of TrueType font
76
				 * file. */
B
Behdad Esfahbod 已提交
77
  HBUINT32	length;		/* Length of this table. */
B
Behdad Esfahbod 已提交
78 79
  public:
  DEFINE_SIZE_STATIC (16);
80 81 82 83 84 85
} OpenTypeTable;

typedef struct OffsetTable
{
  friend struct OpenTypeFontFile;

86
  inline unsigned int get_table_count (void) const
B
Behdad Esfahbod 已提交
87
  { return tables.len; }
88
  inline const TableRecord& get_table (unsigned int i) const
89
  {
90
    return tables[i];
91
  }
B
Behdad Esfahbod 已提交
92
  inline unsigned int get_table_tags (unsigned int  start_offset,
B
Behdad Esfahbod 已提交
93 94 95 96 97
				      unsigned int *table_count, /* IN/OUT */
				      hb_tag_t     *table_tags /* OUT */) const
  {
    if (table_count)
    {
B
Behdad Esfahbod 已提交
98
      if (start_offset >= tables.len)
B
Behdad Esfahbod 已提交
99 100
        *table_count = 0;
      else
101
        *table_count = MIN<unsigned int> (*table_count, tables.len - start_offset);
B
Behdad Esfahbod 已提交
102

103
      const TableRecord *sub_tables = tables.arrayZ + start_offset;
B
Behdad Esfahbod 已提交
104 105 106 107
      unsigned int count = *table_count;
      for (unsigned int i = 0; i < count; i++)
	table_tags[i] = sub_tables[i].tag;
    }
B
Behdad Esfahbod 已提交
108
    return tables.len;
B
Behdad Esfahbod 已提交
109
  }
110 111
  inline bool find_table_index (hb_tag_t tag, unsigned int *table_index) const
  {
B
Behdad Esfahbod 已提交
112 113
    Tag t;
    t.set (tag);
114 115 116 117
    /* Linear-search for small tables to work around fonts with unsorted
     * table list. */
    int i = tables.len < 64 ? tables.lsearch (t) : tables.bsearch (t);
    if (table_index)
118
      *table_index = i == -1 ? (unsigned) Index::NOT_FOUND_INDEX : (unsigned) i;
119
    return i != -1;
120
  }
121
  inline const TableRecord& get_table_by_tag (hb_tag_t tag) const
122 123 124 125 126
  {
    unsigned int table_index;
    find_table_index (tag, &table_index);
    return get_table (table_index);
  }
B
Behdad Esfahbod 已提交
127 128

  public:
B
Behdad Esfahbod 已提交
129 130 131 132 133 134 135 136

  inline bool serialize (hb_serialize_context_t *c,
			 hb_tag_t sfnt_tag,
			 Supplier<hb_tag_t> &tags,
			 Supplier<hb_blob_t *> &blobs,
			 unsigned int table_count)
  {
    TRACE_SERIALIZE (this);
137
    /* Alloc 12 for the OTHeader. */
B
Behdad Esfahbod 已提交
138
    if (unlikely (!c->extend_min (*this))) return_trace (false);
139
    /* Write sfntVersion (bytes 0..3). */
B
Behdad Esfahbod 已提交
140
    sfnt_version.set (sfnt_tag);
141
    /* Take space for numTables, searchRange, entrySelector, RangeShift
142
     * and the TableRecords themselves.  */
B
Behdad Esfahbod 已提交
143
    if (unlikely (!tables.serialize (c, table_count))) return_trace (false);
B
Behdad Esfahbod 已提交
144

145 146 147
    const char *dir_end = (const char *) c->head;
    HBUINT32 *checksum_adjustment = nullptr;

148
    /* Write OffsetTables, alloc for and write actual table blobs. */
B
Behdad Esfahbod 已提交
149 150
    for (unsigned int i = 0; i < table_count; i++)
    {
151
      TableRecord &rec = tables.arrayZ[i];
B
Behdad Esfahbod 已提交
152
      hb_blob_t *blob = blobs[i];
B
Behdad Esfahbod 已提交
153
      rec.tag.set (tags[i]);
B
Behdad Esfahbod 已提交
154 155
      rec.length.set (hb_blob_get_length (blob));
      rec.offset.serialize (c, this);
156 157 158 159 160 161 162

      /* Allocate room for the table and copy it. */
      char *start = (char *) c->allocate_size<void> (rec.length);
      if (unlikely (!start)) {return false;}

      memcpy (start, hb_blob_get_data (blob, nullptr), rec.length);

163
      /* 4-byte allignment. */
164
      c->align (4);
165
      const char *end = (const char *) c->head;
166 167 168 169 170 171 172 173

      if (tags[i] == HB_OT_TAG_head && end - start >= head::static_size)
      {
	head *h = (head *) start;
	checksum_adjustment = &h->checkSumAdjustment;
	checksum_adjustment->set (0);
      }

174
      rec.checkSum.set_for_data (start, end - start);
B
Behdad Esfahbod 已提交
175
    }
176 177
    tags += table_count;
    blobs += table_count;
B
Behdad Esfahbod 已提交
178

B
Behdad Esfahbod 已提交
179
    tables.qsort ();
180 181 182 183 184 185 186 187 188 189

    if (checksum_adjustment)
    {
      CheckSum checksum;

      /* The following line is a slower version of the following block. */
      //checksum.set_for_data (this, (const char *) c->head - (const char *) this);
      checksum.set_for_data (this, dir_end - (const char *) this);
      for (unsigned int i = 0; i < table_count; i++)
      {
190
	TableRecord &rec = tables.arrayZ[i];
191 192 193 194 195 196
	checksum.set (checksum + rec.checkSum);
      }

      checksum_adjustment->set (0xB1B0AFBAu - checksum);
    }

B
Behdad Esfahbod 已提交
197 198 199
    return_trace (true);
  }

B
Behdad Esfahbod 已提交
200 201
  inline bool sanitize (hb_sanitize_context_t *c) const
  {
B
Behdad Esfahbod 已提交
202
    TRACE_SANITIZE (this);
B
Behdad Esfahbod 已提交
203
    return_trace (c->check_struct (this) && tables.sanitize (c));
B
Behdad Esfahbod 已提交
204 205
  }

206
  protected:
207
  Tag		sfnt_version;	/* '\0\001\0\00' if TrueType / 'OTTO' if CFF */
B
Behdad Esfahbod 已提交
208 209
  BinSearchArrayOf<TableRecord>
		tables;
B
Behdad Esfahbod 已提交
210
  public:
211
  DEFINE_SIZE_ARRAY (12, tables);
212
} OpenTypeFontFace;
B
Behdad Esfahbod 已提交
213

214 215 216 217 218

/*
 * TrueType Collections
 */

219
struct TTCHeaderVersion1
220
{
221
  friend struct TTCHeader;
222

B
Behdad Esfahbod 已提交
223
  inline unsigned int get_face_count (void) const { return table.len; }
B
Behdad Esfahbod 已提交
224
  inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; }
B
Behdad Esfahbod 已提交
225

B
Behdad Esfahbod 已提交
226 227
  inline bool sanitize (hb_sanitize_context_t *c) const
  {
B
Behdad Esfahbod 已提交
228
    TRACE_SANITIZE (this);
B
Behdad Esfahbod 已提交
229
    return_trace (table.sanitize (c, this));
B
Behdad Esfahbod 已提交
230 231
  }

232
  protected:
233
  Tag		ttcTag;		/* TrueType Collection ID string: 'ttcf' */
B
Behdad Esfahbod 已提交
234
  FixedVersion<>version;	/* Version of the TTC Header (1.0),
235
				 * 0x00010000u */
236
  LArrayOf<LOffsetTo<OffsetTable> >
237 238
		table;		/* Array of offsets to the OffsetTable for each font
				 * from the beginning of the file */
239
  public:
240
  DEFINE_SIZE_ARRAY (12, table);
241
};
242 243 244 245 246 247 248 249 250

struct TTCHeader
{
  friend struct OpenTypeFontFile;

  private:

  inline unsigned int get_face_count (void) const
  {
B
Behdad Esfahbod 已提交
251
    switch (u.header.version.major) {
252
    case 2: /* version 2 is compatible with version 1 */
B
Behdad Esfahbod 已提交
253
    case 1: return u.version1.get_face_count ();
254 255 256 257 258
    default:return 0;
    }
  }
  inline const OpenTypeFontFace& get_face (unsigned int i) const
  {
B
Behdad Esfahbod 已提交
259
    switch (u.header.version.major) {
260
    case 2: /* version 2 is compatible with version 1 */
B
Behdad Esfahbod 已提交
261
    case 1: return u.version1.get_face (i);
B
Behdad Esfahbod 已提交
262
    default:return Null(OpenTypeFontFace);
263 264 265
    }
  }

B
Behdad Esfahbod 已提交
266 267
  inline bool sanitize (hb_sanitize_context_t *c) const
  {
B
Behdad Esfahbod 已提交
268
    TRACE_SANITIZE (this);
B
Behdad Esfahbod 已提交
269
    if (unlikely (!u.header.version.sanitize (c))) return_trace (false);
B
Behdad Esfahbod 已提交
270
    switch (u.header.version.major) {
271
    case 2: /* version 2 is compatible with version 1 */
B
Behdad Esfahbod 已提交
272 273
    case 1: return_trace (u.version1.sanitize (c));
    default:return_trace (true);
274 275 276
    }
  }

277
  protected:
278 279 280
  union {
  struct {
  Tag		ttcTag;		/* TrueType Collection ID string: 'ttcf' */
B
Behdad Esfahbod 已提交
281
  FixedVersion<>version;	/* Version of the TTC Header (1.0 or 2.0),
282
				 * 0x00010000u or 0x00020000u */
283
  }			header;
B
Behdad Esfahbod 已提交
284
  TTCHeaderVersion1	version1;
285 286
  } u;
};
287

288 289
/*
 * Mac Resource Fork
290 291
 *
 * http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-99.html
292 293
 */

294
struct ResourceRecord
295
{
B
Behdad Esfahbod 已提交
296 297 298 299 300
  inline const hb_bytes_t get_data (const void *data_base) const
  { return hb_bytes_t (data_base+offset); }

  inline bool sanitize (hb_sanitize_context_t *c,
			const void *data_base) const
301 302
  {
    TRACE_SANITIZE (this);
B
Behdad Esfahbod 已提交
303 304
    return_trace (c->check_struct (this) &&
		  offset.sanitize (c, data_base));
305 306
  }

B
Behdad Esfahbod 已提交
307
  protected:
308
  HBUINT16	id;		/* Resource ID, is really should be signed? */
309
  HBINT16	nameOffset;	/* Offset from beginning of resource name list
310
				 * to resource name, -1 means there is none. */
311
  HBUINT8	attrs;		/* Resource attributes */
B
Behdad Esfahbod 已提交
312 313
  OffsetTo<LArrayOf<HBUINT8>, HBUINT24>
		offset;		/* Offset from beginning of data block to
314 315 316 317 318 319
				 * data for this resource */
  HBUINT32	reserved;	/* Reserved for handle to resource */
  public:
  DEFINE_SIZE_STATIC (12);
};

320
struct ResourceTypeRecord
321
{
322
  inline unsigned int get_resource_count () const { return resCountM1 + 1; }
323

324
  inline bool is_sfnt () const { return tag == HB_TAG ('s','f','n','t'); }
325

B
Behdad Esfahbod 已提交
326 327
  inline const ResourceRecord& get_resource_record (unsigned int i,
						    const void *type_base) const
328
  {
B
Behdad Esfahbod 已提交
329 330 331 332 333 334 335 336 337 338 339 340 341
    return hb_array_t<ResourceRecord> ((type_base+resourcesZ).arrayZ,
				       get_resource_count ()) [i];
  }

  inline bool sanitize (hb_sanitize_context_t *c,
			const void *type_base,
			const void *data_base) const
  {
    TRACE_SANITIZE (this);
    return_trace (c->check_struct (this) &&
		  resourcesZ.sanitize (c, type_base,
				       get_resource_count (),
				       data_base));
342 343 344
  }

  protected:
345 346 347
  Tag		tag;		/* Resource type. */
  HBUINT16	resCountM1;	/* Number of resources minus 1. */
  OffsetTo<UnsizedArrayOf<ResourceRecord> >
B
Behdad Esfahbod 已提交
348
		resourcesZ;	/* Offset from beginning of resource type list
349
				 * to reference item list for this type. */
350 351 352 353 354 355
  public:
  DEFINE_SIZE_STATIC (8);
};

struct ResourceMap
{
356
  inline const ResourceTypeRecord& get_type_record (unsigned int i) const
357
  {
358
    // Why offset from the third byte of the object? I'm not sure
B
Behdad Esfahbod 已提交
359 360
    return hb_array_t<ResourceTypeRecord> (((2 + (const char *) this )+typeListZ).arrayZ,
					   get_type_count ()) [i];
361 362
  }

B
Behdad Esfahbod 已提交
363
  inline unsigned int get_type_count () const { return typeCountM1 + 1; }
364

365 366
  inline const ResourceRecord &get_resource_record (const ResourceTypeRecord &type,
						    unsigned int i) const
367
  {
B
Behdad Esfahbod 已提交
368 369 370 371 372 373 374 375 376 377 378 379
    return type.get_resource_record (i, &(this+typeListZ));
  }

  inline bool sanitize (hb_sanitize_context_t *c, const void *data_base) const
  {
    TRACE_SANITIZE (this);
    const void *type_base = &(this+typeListZ);
    return_trace (c->check_struct (this) &&
		  typeListZ.sanitize (c, 2 + (const char *) this,
				      get_type_count (),
				      type_base,
				      data_base));
380 381 382
  }

  protected:
383 384 385 386 387 388
  HBUINT8	reserved0[16];	/* Reserved for copy of resource header */
  HBUINT32	reserved1;	/* Reserved for handle to next resource map */
  HBUINT16	resreved2;	/* Reserved for file reference number */
  HBUINT16	attrs;		/* Resource fork attribute */
  OffsetTo<UnsizedArrayOf<ResourceTypeRecord> >
		typeListZ;	/* Offset from beginning of map to
389
				 * resource type list */
B
Behdad Esfahbod 已提交
390
  Offset16	nameList;	/* Offset from beginning of map to
391
				 * resource name list */
392
  HBUINT16	typeCountM1;	/* Number of types in the map minus 1 */
393 394 395 396 397 398 399 400 401
  public:
  DEFINE_SIZE_STATIC (30);
};

struct ResourceForkHeader
{
  inline unsigned int get_face_count () const
  {
    const ResourceMap &resource_map = this+map;
B
Behdad Esfahbod 已提交
402 403
    unsigned int count = resource_map.get_type_count ();
    for (unsigned int i = 0; i < count; ++i)
404
    {
405
      const ResourceTypeRecord& type = resource_map.get_type_record (i);
406 407 408 409 410 411
      if (type.is_sfnt ())
	return type.get_resource_count ();
    }
    return 0;
  }

B
Behdad Esfahbod 已提交
412 413
  inline const hb_bytes_t get_data (const ResourceTypeRecord& type,
				    unsigned int idx) const
414 415
  {
    const ResourceMap &resource_map = this+map;
B
Behdad Esfahbod 已提交
416 417
    const void *data_base = &(this+data);
    return resource_map.get_resource_record (type, idx).get_data (data_base);
418 419
  }

B
Behdad Esfahbod 已提交
420 421
  inline const OpenTypeFontFace& get_face (unsigned int idx,
					   unsigned int *base_offset = nullptr) const
422 423
  {
    const ResourceMap &resource_map = this+map;
B
Behdad Esfahbod 已提交
424
    for (unsigned int i = 0; i < resource_map.get_type_count (); ++i)
425
    {
426
      const ResourceTypeRecord& type = resource_map.get_type_record (i);
427
      if (type.is_sfnt () && idx < type.get_resource_count ())
428
      {
B
Behdad Esfahbod 已提交
429
	const OpenTypeFontFace &face = *get_data (type, idx).as<OpenTypeFontFace> ();
430 431 432 433
	if (base_offset)
	  *base_offset = (const char *) &face - (const char *) this;
	return face;
      }
434 435 436 437 438 439 440
    }
    return Null (OpenTypeFontFace);
  }

  inline bool sanitize (hb_sanitize_context_t *c) const
  {
    TRACE_SANITIZE (this);
B
Behdad Esfahbod 已提交
441 442
    return_trace (c->check_struct (this) &&
		  map.sanitize (c, this, &(this+data)));
443

B
Behdad Esfahbod 已提交
444
    // XXX Sanitize OpenTypeFontFace's
445 446 447
  }

  protected:
B
Behdad Esfahbod 已提交
448 449
  LOffsetTo<UnsizedArrayOf<HBUINT8> >
		data;		/* Offset from beginning of resource fork
450 451 452 453 454 455 456 457 458
				 * to resource data */
  LOffsetTo<ResourceMap>
		map;		/* Offset from beginning of resource fork
				 * to resource map */
  HBUINT32	dataLen;	/* Length of resource data */
  HBUINT32	mapLen;		/* Length of resource map */
  public:
  DEFINE_SIZE_STATIC (16);
};
459 460 461 462 463 464 465

/*
 * OpenType Font File
 */

struct OpenTypeFontFile
{
466 467
  enum {
    CFFTag		= HB_TAG ('O','T','T','O'), /* OpenType with Postscript outlines */
B
Behdad Esfahbod 已提交
468
    TrueTypeTag		= HB_TAG ( 0 , 1 , 0 , 0 ), /* OpenType with TrueType outlines */
469
    TTCTag		= HB_TAG ('t','t','c','f'), /* TrueType Collection */
470
    DFontTag		= HB_TAG ( 0 , 0 , 1 , 0 ), /* DFont Mac Resource Fork */
471 472 473
    TrueTag		= HB_TAG ('t','r','u','e'), /* Obsolete Apple TrueType */
    Typ1Tag		= HB_TAG ('t','y','p','1')  /* Obsolete Apple Type1 font in SFNT container */
  };
474

B
Behdad Esfahbod 已提交
475 476
  inline hb_tag_t get_tag (void) const { return u.tag; }

B
Behdad Esfahbod 已提交
477
  inline unsigned int get_face_count (void) const
478
  {
B
Behdad Esfahbod 已提交
479 480
    switch (u.tag) {
    case CFFTag:	/* All the non-collection tags */
481 482
    case TrueTag:
    case Typ1Tag:
B
Behdad Esfahbod 已提交
483
    case TrueTypeTag:	return 1;
B
Behdad Esfahbod 已提交
484
    case TTCTag:	return u.ttcHeader.get_face_count ();
485
    case DFontTag:	return u.rfHeader.get_face_count ();
B
Behdad Esfahbod 已提交
486
    default:		return 0;
487 488
    }
  }
489
  inline const OpenTypeFontFace& get_face (unsigned int i, unsigned int *base_offset = nullptr) const
490
  {
491 492
    if (base_offset)
      *base_offset = 0;
B
Behdad Esfahbod 已提交
493
    switch (u.tag) {
494 495 496
    /* Note: for non-collection SFNT data we ignore index.  This is because
     * Apple dfont container is a container of SFNT's.  So each SFNT is a
     * non-TTC, but the index is more than zero. */
B
Behdad Esfahbod 已提交
497
    case CFFTag:	/* All the non-collection tags */
498 499
    case TrueTag:
    case Typ1Tag:
B
Behdad Esfahbod 已提交
500 501
    case TrueTypeTag:	return u.fontFace;
    case TTCTag:	return u.ttcHeader.get_face (i);
502
    case DFontTag:	return u.rfHeader.get_face (i, base_offset);
B
Behdad Esfahbod 已提交
503
    default:		return Null(OpenTypeFontFace);
504 505 506
    }
  }

B
Behdad Esfahbod 已提交
507 508 509 510 511 512 513 514 515 516 517 518
  inline bool serialize_single (hb_serialize_context_t *c,
				hb_tag_t sfnt_tag,
			        Supplier<hb_tag_t> &tags,
			        Supplier<hb_blob_t *> &blobs,
			        unsigned int table_count)
  {
    TRACE_SERIALIZE (this);
    assert (sfnt_tag != TTCTag);
    if (unlikely (!c->extend_min (*this))) return_trace (false);
    return_trace (u.fontFace.serialize (c, sfnt_tag, tags, blobs, table_count));
  }

B
Behdad Esfahbod 已提交
519 520
  inline bool sanitize (hb_sanitize_context_t *c) const
  {
B
Behdad Esfahbod 已提交
521
    TRACE_SANITIZE (this);
B
Behdad Esfahbod 已提交
522
    if (unlikely (!u.tag.sanitize (c))) return_trace (false);
B
Behdad Esfahbod 已提交
523 524
    switch (u.tag) {
    case CFFTag:	/* All the non-collection tags */
525 526
    case TrueTag:
    case Typ1Tag:
B
Behdad Esfahbod 已提交
527 528
    case TrueTypeTag:	return_trace (u.fontFace.sanitize (c));
    case TTCTag:	return_trace (u.ttcHeader.sanitize (c));
529
    case DFontTag:	return_trace (u.rfHeader.sanitize (c));
B
Behdad Esfahbod 已提交
530
    default:		return_trace (true);
B
Behdad Esfahbod 已提交
531 532 533
    }
  }

534
  protected:
B
Behdad Esfahbod 已提交
535 536
  union {
  Tag			tag;		/* 4-byte identifier. */
B
Behdad Esfahbod 已提交
537 538
  OpenTypeFontFace	fontFace;
  TTCHeader		ttcHeader;
539
  ResourceForkHeader	rfHeader;
B
Behdad Esfahbod 已提交
540
  } u;
B
Behdad Esfahbod 已提交
541 542
  public:
  DEFINE_SIZE_UNION (4, tag);
543 544 545
};


B
Behdad Esfahbod 已提交
546
} /* namespace OT */
547

B
Behdad Esfahbod 已提交
548

549
#endif /* HB_OPEN_FILE_HH */