Home | History | Annotate | Download | only in sfntly
      1 /*
      2  * Copyright 2011 Google Inc. All Rights Reserved.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include "sfntly/tag.h"
     18 #include "sfntly/port/endian.h"
     19 
     20 // Use a macro instead of GenerateTag() because gcc 4.4.3 creates static
     21 // initializers in that case.
     22 #define TAG(a, b, c, d) ((a << 24) | (b << 16) | (c << 8) | d);
     23 
     24 namespace sfntly {
     25 
     26 const int32_t Tag::ttcf = TAG('t', 't', 'c', 'f');
     27 const int32_t Tag::cmap = TAG('c', 'm', 'a', 'p');
     28 const int32_t Tag::head = TAG('h', 'e', 'a', 'd');
     29 const int32_t Tag::hhea = TAG('h', 'h', 'e', 'a');
     30 const int32_t Tag::hmtx = TAG('h', 'm', 't', 'x');
     31 const int32_t Tag::maxp = TAG('m', 'a', 'x', 'p');
     32 const int32_t Tag::name = TAG('n', 'a', 'm', 'e');
     33 const int32_t Tag::OS_2 = TAG('O', 'S', '/', '2');
     34 const int32_t Tag::post = TAG('p', 'o', 's', 't');
     35 const int32_t Tag::cvt  = TAG('c', 'v', 't', ' ');
     36 const int32_t Tag::fpgm = TAG('f', 'p', 'g', 'm');
     37 const int32_t Tag::glyf = TAG('g', 'l', 'y', 'f');
     38 const int32_t Tag::loca = TAG('l', 'o', 'c', 'a');
     39 const int32_t Tag::prep = TAG('p', 'r', 'e', 'p');
     40 const int32_t Tag::CFF  = TAG('C', 'F', 'F', ' ');
     41 const int32_t Tag::VORG = TAG('V', 'O', 'R', 'G');
     42 const int32_t Tag::EBDT = TAG('E', 'B', 'D', 'T');
     43 const int32_t Tag::EBLC = TAG('E', 'B', 'L', 'C');
     44 const int32_t Tag::EBSC = TAG('E', 'B', 'S', 'C');
     45 const int32_t Tag::BASE = TAG('B', 'A', 'S', 'E');
     46 const int32_t Tag::GDEF = TAG('G', 'D', 'E', 'F');
     47 const int32_t Tag::GPOS = TAG('G', 'P', 'O', 'S');
     48 const int32_t Tag::GSUB = TAG('G', 'S', 'U', 'B');
     49 const int32_t Tag::JSTF = TAG('J', 'S', 'T', 'F');
     50 const int32_t Tag::DSIG = TAG('D', 'S', 'I', 'G');
     51 const int32_t Tag::gasp = TAG('g', 'a', 's', 'p');
     52 const int32_t Tag::hdmx = TAG('h', 'd', 'm', 'x');
     53 const int32_t Tag::kern = TAG('k', 'e', 'r', 'n');
     54 const int32_t Tag::LTSH = TAG('L', 'T', 'S', 'H');
     55 const int32_t Tag::PCLT = TAG('P', 'C', 'L', 'T');
     56 const int32_t Tag::VDMX = TAG('V', 'D', 'M', 'X');
     57 const int32_t Tag::vhea = TAG('v', 'h', 'e', 'a');
     58 const int32_t Tag::vmtx = TAG('v', 'm', 't', 'x');
     59 const int32_t Tag::bsln = TAG('b', 's', 'l', 'n');
     60 const int32_t Tag::feat = TAG('f', 'e', 'a', 't');
     61 const int32_t Tag::lcar = TAG('l', 'c', 'a', 'r');
     62 const int32_t Tag::morx = TAG('m', 'o', 'r', 'x');
     63 const int32_t Tag::opbd = TAG('o', 'p', 'b', 'd');
     64 const int32_t Tag::prop = TAG('p', 'r', 'o', 'p');
     65 const int32_t Tag::Feat = TAG('F', 'e', 'a', 't');
     66 const int32_t Tag::Glat = TAG('G', 'l', 'a', 't');
     67 const int32_t Tag::Gloc = TAG('G', 'l', 'o', 'c');
     68 const int32_t Tag::Sile = TAG('S', 'i', 'l', 'e');
     69 const int32_t Tag::Silf = TAG('S', 'i', 'l', 'f');
     70 const int32_t Tag::bhed = TAG('b', 'h', 'e', 'd');
     71 const int32_t Tag::bdat = TAG('b', 'd', 'a', 't');
     72 const int32_t Tag::bloc = TAG('b', 'l', 'o', 'c');
     73 
     74 const int32_t CFF_TABLE_ORDERING[] = {
     75     Tag::head,
     76     Tag::hhea,
     77     Tag::maxp,
     78     Tag::OS_2,
     79     Tag::name,
     80     Tag::cmap,
     81     Tag::post,
     82     Tag::CFF };
     83 const size_t CFF_TABLE_ORDERING_SIZE =
     84     sizeof(CFF_TABLE_ORDERING) / sizeof(int32_t);
     85 
     86 const int32_t TRUE_TYPE_TABLE_ORDERING[] = {
     87     Tag::head,
     88     Tag::hhea,
     89     Tag::maxp,
     90     Tag::OS_2,
     91     Tag::hmtx,
     92     Tag::LTSH,
     93     Tag::VDMX,
     94     Tag::hdmx,
     95     Tag::cmap,
     96     Tag::fpgm,
     97     Tag::prep,
     98     Tag::cvt,
     99     Tag::loca,
    100     Tag::glyf,
    101     Tag::kern,
    102     Tag::name,
    103     Tag::post,
    104     Tag::gasp,
    105     Tag::PCLT,
    106     Tag::DSIG };
    107 const size_t TRUE_TYPE_TABLE_ORDERING_SIZE =
    108     sizeof(TRUE_TYPE_TABLE_ORDERING) / sizeof(int32_t);
    109 
    110 }  // namespace sfntly
    111