Home | History | Annotate | Download | only in src
      1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef OTS_CMAP_H_
      6 #define OTS_CMAP_H_
      7 
      8 #include <vector>
      9 
     10 #include "ots.h"
     11 
     12 namespace ots {
     13 
     14 struct OpenTypeCMAPSubtableRange {
     15   uint32_t start_range;
     16   uint32_t end_range;
     17   uint32_t start_glyph_id;
     18 };
     19 
     20 struct OpenTypeCMAPSubtableVSRange {
     21   uint32_t unicode_value;
     22   uint8_t additional_count;
     23 };
     24 
     25 struct OpenTypeCMAPSubtableVSMapping {
     26   uint32_t unicode_value;
     27   uint16_t glyph_id;
     28 };
     29 
     30 struct OpenTypeCMAPSubtableVSRecord {
     31   uint32_t var_selector;
     32   uint32_t default_offset;
     33   uint32_t non_default_offset;
     34   std::vector<OpenTypeCMAPSubtableVSRange> ranges;
     35   std::vector<OpenTypeCMAPSubtableVSMapping> mappings;
     36 };
     37 
     38 struct OpenTypeCMAP {
     39   OpenTypeCMAP()
     40       : subtable_0_3_4_data(NULL),
     41         subtable_0_3_4_length(0),
     42         subtable_0_5_14_length(0),
     43         subtable_3_0_4_data(NULL),
     44         subtable_3_0_4_length(0),
     45         subtable_3_1_4_data(NULL),
     46         subtable_3_1_4_length(0) {
     47   }
     48 
     49   // Platform 0, Encoding 3, Format 4, Unicode BMP table.
     50   const uint8_t *subtable_0_3_4_data;
     51   size_t subtable_0_3_4_length;
     52 
     53   // Platform 0, Encoding 5, Format 14, Unicode Variation Sequence table.
     54   size_t subtable_0_5_14_length;
     55   std::vector<OpenTypeCMAPSubtableVSRecord> subtable_0_5_14;
     56 
     57   // Platform 3, Encoding 0, Format 4, MS Symbol table.
     58   const uint8_t *subtable_3_0_4_data;
     59   size_t subtable_3_0_4_length;
     60   // Platform 3, Encoding 1, Format 4, MS Unicode BMP table.
     61   const uint8_t *subtable_3_1_4_data;
     62   size_t subtable_3_1_4_length;
     63 
     64   // Platform 3, Encoding 10, Format 12, MS Unicode UCS-4 table.
     65   std::vector<OpenTypeCMAPSubtableRange> subtable_3_10_12;
     66   // Platform 3, Encoding 10, Format 13, MS UCS-4 Fallback table.
     67   std::vector<OpenTypeCMAPSubtableRange> subtable_3_10_13;
     68   // Platform 1, Encoding 0, Format 0, Mac Roman table.
     69   std::vector<uint8_t> subtable_1_0_0;
     70 };
     71 
     72 }  // namespace ots
     73 
     74 #endif
     75