bungeman@google.com | 058670b | 2014-05-01 20:39:14 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkOTTable_EBDT_DEFINED |
| 9 | #define SkOTTable_EBDT_DEFINED |
| 10 | |
| 11 | #include "SkEndian.h" |
| 12 | #include "SkOTTableTypes.h" |
| 13 | #include "SkOTTable_head.h" |
| 14 | #include "SkOTTable_loca.h" |
bungeman@google.com | 058670b | 2014-05-01 20:39:14 +0000 | [diff] [blame] | 15 | |
| 16 | #pragma pack(push, 1) |
| 17 | |
| 18 | struct SkOTTableEmbeddedBitmapData { |
| 19 | static const SK_OT_CHAR TAG0 = 'E'; |
| 20 | static const SK_OT_CHAR TAG1 = 'B'; |
| 21 | static const SK_OT_CHAR TAG2 = 'D'; |
| 22 | static const SK_OT_CHAR TAG3 = 'T'; |
| 23 | static const SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableEmbeddedBitmapData>::value; |
| 24 | |
| 25 | SK_OT_Fixed version; |
| 26 | static const SK_OT_Fixed version_initial = SkTEndian_SwapBE32(0x00020000); |
| 27 | |
| 28 | struct BigGlyphMetrics { |
| 29 | SK_OT_BYTE height; |
| 30 | SK_OT_BYTE width; |
| 31 | SK_OT_CHAR horiBearingX; |
| 32 | SK_OT_CHAR horiBearingY; |
| 33 | SK_OT_BYTE horiAdvance; |
| 34 | SK_OT_CHAR vertBearingX; |
| 35 | SK_OT_CHAR vertBearingY; |
| 36 | SK_OT_BYTE vertAdvance; |
| 37 | }; |
| 38 | |
| 39 | struct SmallGlyphMetrics { |
| 40 | SK_OT_BYTE height; |
| 41 | SK_OT_BYTE width; |
| 42 | SK_OT_CHAR bearingX; |
| 43 | SK_OT_CHAR bearingY; |
| 44 | SK_OT_BYTE advance; |
| 45 | }; |
| 46 | |
| 47 | // Small metrics, byte-aligned data. |
| 48 | struct Format1 { |
| 49 | SmallGlyphMetrics smallGlyphMetrics; |
| 50 | //SK_OT_BYTE[] byteAlignedBitmap; |
| 51 | }; |
| 52 | |
| 53 | // Small metrics, bit-aligned data. |
| 54 | struct Format2 { |
| 55 | SmallGlyphMetrics smallGlyphMetrics; |
| 56 | //SK_OT_BYTE[] bitAlignedBitmap; |
| 57 | }; |
| 58 | |
| 59 | // Format 3 is not used. |
| 60 | |
| 61 | // EBLC metrics (IndexSubTable::header::indexFormat 2 or 5), compressed data. |
| 62 | // Only used on Mac. |
| 63 | struct Format4 { |
| 64 | SK_OT_ULONG whiteTreeOffset; |
| 65 | SK_OT_ULONG blackTreeOffset; |
| 66 | SK_OT_ULONG glyphDataOffset; |
| 67 | }; |
| 68 | |
| 69 | // EBLC metrics (IndexSubTable::header::indexFormat 2 or 5), bit-aligned data. |
| 70 | struct Format5 { |
| 71 | //SK_OT_BYTE[] bitAlignedBitmap; |
| 72 | }; |
| 73 | |
| 74 | // Big metrics, byte-aligned data. |
| 75 | struct Format6 { |
| 76 | BigGlyphMetrics bigGlyphMetrics; |
| 77 | //SK_OT_BYTE[] byteAlignedBitmap; |
| 78 | }; |
| 79 | |
| 80 | // Big metrics, bit-aligned data. |
| 81 | struct Format7 { |
| 82 | BigGlyphMetrics bigGlyphMetrics; |
| 83 | //SK_OT_BYTE[] bitAlignedBitmap; |
| 84 | }; |
| 85 | |
| 86 | struct EBDTComponent { |
| 87 | SK_OT_USHORT glyphCode; // Component glyph code |
| 88 | SK_OT_CHAR xOffset; // Position of component left |
| 89 | SK_OT_CHAR yOffset; // Position of component top |
| 90 | }; |
| 91 | |
| 92 | struct Format8 { |
| 93 | SmallGlyphMetrics smallMetrics; // Metrics information for the glyph |
| 94 | SK_OT_BYTE pad; // Pad to short boundary |
| 95 | SK_OT_USHORT numComponents; // Number of components |
| 96 | //EBDTComponent componentArray[numComponents]; // Glyph code, offset array |
| 97 | }; |
| 98 | |
| 99 | struct Format9 { |
| 100 | BigGlyphMetrics bigMetrics; // Metrics information for the glyph |
| 101 | SK_OT_USHORT numComponents; // Number of components |
| 102 | //EBDTComponent componentArray[numComponents]; // Glyph code, offset array |
| 103 | }; |
| 104 | }; |
| 105 | |
| 106 | #pragma pack(pop) |
| 107 | |
| 108 | #endif |