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
{
296 297
  inline const OpenTypeFontFace & get_face (const void *data_base) const
  { return CastR<OpenTypeFontFace> ((data_base+offset).arrayZ); }
B
Behdad Esfahbod 已提交
298 299 300

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

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

321 322
#define HB_TAG_sfnt HB_TAG ('s','f','n','t')

323
struct ResourceTypeRecord
324
{
B
Behdad Esfahbod 已提交
325 326
  inline unsigned int get_resource_count (void) const
  { return tag == HB_TAG_sfnt ? resCountM1 + 1 : 0; }
327

B
Behdad Esfahbod 已提交
328
  inline bool is_sfnt (void) const { return tag == HB_TAG_sfnt; }
329

B
Behdad Esfahbod 已提交
330 331
  inline const ResourceRecord& get_resource_record (unsigned int i,
						    const void *type_base) const
332
  {
B
Behdad Esfahbod 已提交
333 334 335 336 337 338 339 340 341 342 343 344 345
    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));
346 347 348
  }

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

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

367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
  inline unsigned int get_face_count (void) const
  {
    unsigned int count = get_type_count ();
    for (unsigned int i = 0; i < count; i++)
    {
      const ResourceTypeRecord& type = get_type_record (i);
      if (type.is_sfnt ())
	return type.get_resource_count ();
    }
    return 0;
  }

  inline const OpenTypeFontFace& get_face (unsigned int idx,
					   const void *data_base) const
  {
    unsigned int count = get_type_count ();
    for (unsigned int i = 0; i < count; i++)
    {
      const ResourceTypeRecord& type = get_type_record (i);
B
Behdad Esfahbod 已提交
386 387
      /* The check for idx < count is here because ResourceRecord is NOT null-safe.
       * Because an offset of 0 there does NOT mean null. */
388
      if (type.is_sfnt () && idx < type.get_resource_count ())
B
Behdad Esfahbod 已提交
389
	return type.get_resource_record (idx, &(this+typeListZ)).get_face (data_base);
390 391 392 393
    }
    return Null (OpenTypeFontFace);
  }

B
Behdad Esfahbod 已提交
394 395 396 397 398 399 400 401 402
  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));
403 404
  }

B
Behdad Esfahbod 已提交
405 406 407
  private:
  inline unsigned int get_type_count (void) const { return typeCountM1 + 1; }

408
  protected:
409 410 411 412 413 414
  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
415
				 * resource type list */
B
Behdad Esfahbod 已提交
416
  Offset16	nameList;	/* Offset from beginning of map to
417
				 * resource name list */
418
  HBUINT16	typeCountM1;	/* Number of types in the map minus 1 */
419 420 421 422 423 424
  public:
  DEFINE_SIZE_STATIC (30);
};

struct ResourceForkHeader
{
B
Behdad Esfahbod 已提交
425
  inline unsigned int get_face_count (void) const
426
  { return (this+map).get_face_count (); }
427

B
Behdad Esfahbod 已提交
428 429
  inline const OpenTypeFontFace& get_face (unsigned int idx,
					   unsigned int *base_offset = nullptr) const
430
  {
431 432 433 434
    const OpenTypeFontFace &face = (this+map).get_face (idx, &(this+data));
    if (base_offset)
      *base_offset = (const char *) &face - (const char *) this;
    return face;
435 436 437 438 439
  }

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

  protected:
B
Behdad Esfahbod 已提交
445 446
  LOffsetTo<UnsizedArrayOf<HBUINT8> >
		data;		/* Offset from beginning of resource fork
447 448 449 450 451 452 453 454 455
				 * 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);
};
456 457 458 459 460 461 462

/*
 * OpenType Font File
 */

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

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

B
Behdad Esfahbod 已提交
474
  inline unsigned int get_face_count (void) const
475
  {
B
Behdad Esfahbod 已提交
476 477
    switch (u.tag) {
    case CFFTag:	/* All the non-collection tags */
478 479
    case TrueTag:
    case Typ1Tag:
B
Behdad Esfahbod 已提交
480
    case TrueTypeTag:	return 1;
B
Behdad Esfahbod 已提交
481
    case TTCTag:	return u.ttcHeader.get_face_count ();
482
    case DFontTag:	return u.rfHeader.get_face_count ();
B
Behdad Esfahbod 已提交
483
    default:		return 0;
484 485
    }
  }
486
  inline const OpenTypeFontFace& get_face (unsigned int i, unsigned int *base_offset = nullptr) const
487
  {
488 489
    if (base_offset)
      *base_offset = 0;
B
Behdad Esfahbod 已提交
490
    switch (u.tag) {
491 492 493
    /* 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 已提交
494
    case CFFTag:	/* All the non-collection tags */
495 496
    case TrueTag:
    case Typ1Tag:
B
Behdad Esfahbod 已提交
497 498
    case TrueTypeTag:	return u.fontFace;
    case TTCTag:	return u.ttcHeader.get_face (i);
499
    case DFontTag:	return u.rfHeader.get_face (i, base_offset);
B
Behdad Esfahbod 已提交
500
    default:		return Null(OpenTypeFontFace);
501 502 503
    }
  }

B
Behdad Esfahbod 已提交
504 505 506 507 508 509 510 511 512 513 514 515
  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 已提交
516 517
  inline bool sanitize (hb_sanitize_context_t *c) const
  {
B
Behdad Esfahbod 已提交
518
    TRACE_SANITIZE (this);
B
Behdad Esfahbod 已提交
519
    if (unlikely (!u.tag.sanitize (c))) return_trace (false);
B
Behdad Esfahbod 已提交
520 521
    switch (u.tag) {
    case CFFTag:	/* All the non-collection tags */
522 523
    case TrueTag:
    case Typ1Tag:
B
Behdad Esfahbod 已提交
524 525
    case TrueTypeTag:	return_trace (u.fontFace.sanitize (c));
    case TTCTag:	return_trace (u.ttcHeader.sanitize (c));
526
    case DFontTag:	return_trace (u.rfHeader.sanitize (c));
B
Behdad Esfahbod 已提交
527
    default:		return_trace (true);
B
Behdad Esfahbod 已提交
528 529 530
    }
  }

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


B
Behdad Esfahbod 已提交
543
} /* namespace OT */
544

B
Behdad Esfahbod 已提交
545

546
#endif /* HB_OPEN_FILE_HH */