Home | History | Annotate | Download | only in sfnt
      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"
     15 #include "SkTypedEnum.h"
     16 
     17 #pragma pack(push, 1)
     18 
     19 struct SkOTTableEmbeddedBitmapData {
     20     static const SK_OT_CHAR TAG0 = 'E';
     21     static const SK_OT_CHAR TAG1 = 'B';
     22     static const SK_OT_CHAR TAG2 = 'D';
     23     static const SK_OT_CHAR TAG3 = 'T';
     24     static const SK_OT_ULONG TAG = SkOTTableTAG<SkOTTableEmbeddedBitmapData>::value;
     25 
     26     SK_OT_Fixed version;
     27     static const SK_OT_Fixed version_initial = SkTEndian_SwapBE32(0x00020000);
     28 
     29     struct BigGlyphMetrics {
     30         SK_OT_BYTE height;
     31         SK_OT_BYTE width;
     32         SK_OT_CHAR horiBearingX;
     33         SK_OT_CHAR horiBearingY;
     34         SK_OT_BYTE horiAdvance;
     35         SK_OT_CHAR vertBearingX;
     36         SK_OT_CHAR vertBearingY;
     37         SK_OT_BYTE vertAdvance;
     38     };
     39 
     40     struct SmallGlyphMetrics {
     41         SK_OT_BYTE height;
     42         SK_OT_BYTE width;
     43         SK_OT_CHAR bearingX;
     44         SK_OT_CHAR bearingY;
     45         SK_OT_BYTE advance;
     46     };
     47 
     48     // Small metrics, byte-aligned data.
     49     struct Format1 {
     50         SmallGlyphMetrics smallGlyphMetrics;
     51         //SK_OT_BYTE[] byteAlignedBitmap;
     52     };
     53 
     54     // Small metrics, bit-aligned data.
     55     struct Format2 {
     56         SmallGlyphMetrics smallGlyphMetrics;
     57         //SK_OT_BYTE[] bitAlignedBitmap;
     58     };
     59 
     60     // Format 3 is not used.
     61 
     62     // EBLC metrics (IndexSubTable::header::indexFormat 2 or 5), compressed data.
     63     // Only used on Mac.
     64     struct Format4 {
     65         SK_OT_ULONG whiteTreeOffset;
     66         SK_OT_ULONG blackTreeOffset;
     67         SK_OT_ULONG glyphDataOffset;
     68     };
     69 
     70     // EBLC metrics (IndexSubTable::header::indexFormat 2 or 5), bit-aligned data.
     71     struct Format5 {
     72         //SK_OT_BYTE[] bitAlignedBitmap;
     73     };
     74 
     75     // Big metrics, byte-aligned data.
     76     struct Format6 {
     77         BigGlyphMetrics bigGlyphMetrics;
     78         //SK_OT_BYTE[] byteAlignedBitmap;
     79     };
     80 
     81     // Big metrics, bit-aligned data.
     82     struct Format7 {
     83         BigGlyphMetrics bigGlyphMetrics;
     84         //SK_OT_BYTE[] bitAlignedBitmap;
     85     };
     86 
     87     struct EBDTComponent {
     88         SK_OT_USHORT glyphCode; // Component glyph code
     89         SK_OT_CHAR xOffset; // Position of component left
     90         SK_OT_CHAR yOffset; // Position of component top
     91     };
     92 
     93     struct Format8 {
     94         SmallGlyphMetrics smallMetrics; // Metrics information for the glyph
     95         SK_OT_BYTE pad; // Pad to short boundary
     96         SK_OT_USHORT numComponents; // Number of components
     97         //EBDTComponent componentArray[numComponents]; // Glyph code, offset array
     98     };
     99 
    100     struct Format9 {
    101         BigGlyphMetrics bigMetrics; // Metrics information for the glyph
    102         SK_OT_USHORT numComponents; // Number of components
    103         //EBDTComponent componentArray[numComponents]; // Glyph code, offset array
    104     };
    105 };
    106 
    107 #pragma pack(pop)
    108 
    109 #endif
    110