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
24namespace sfntly {
25
26const int32_t Tag::ttcf = TAG('t', 't', 'c', 'f');
27const int32_t Tag::cmap = TAG('c', 'm', 'a', 'p');
28const int32_t Tag::head = TAG('h', 'e', 'a', 'd');
29const int32_t Tag::hhea = TAG('h', 'h', 'e', 'a');
30const int32_t Tag::hmtx = TAG('h', 'm', 't', 'x');
31const int32_t Tag::maxp = TAG('m', 'a', 'x', 'p');
32const int32_t Tag::name = TAG('n', 'a', 'm', 'e');
33const int32_t Tag::OS_2 = TAG('O', 'S', '/', '2');
34const int32_t Tag::post = TAG('p', 'o', 's', 't');
35const int32_t Tag::cvt  = TAG('c', 'v', 't', ' ');
36const int32_t Tag::fpgm = TAG('f', 'p', 'g', 'm');
37const int32_t Tag::glyf = TAG('g', 'l', 'y', 'f');
38const int32_t Tag::loca = TAG('l', 'o', 'c', 'a');
39const int32_t Tag::prep = TAG('p', 'r', 'e', 'p');
40const int32_t Tag::CFF  = TAG('C', 'F', 'F', ' ');
41const int32_t Tag::VORG = TAG('V', 'O', 'R', 'G');
42const int32_t Tag::EBDT = TAG('E', 'B', 'D', 'T');
43const int32_t Tag::EBLC = TAG('E', 'B', 'L', 'C');
44const int32_t Tag::EBSC = TAG('E', 'B', 'S', 'C');
45const int32_t Tag::BASE = TAG('B', 'A', 'S', 'E');
46const int32_t Tag::GDEF = TAG('G', 'D', 'E', 'F');
47const int32_t Tag::GPOS = TAG('G', 'P', 'O', 'S');
48const int32_t Tag::GSUB = TAG('G', 'S', 'U', 'B');
49const int32_t Tag::JSTF = TAG('J', 'S', 'T', 'F');
50const int32_t Tag::DSIG = TAG('D', 'S', 'I', 'G');
51const int32_t Tag::gasp = TAG('g', 'a', 's', 'p');
52const int32_t Tag::hdmx = TAG('h', 'd', 'm', 'x');
53const int32_t Tag::kern = TAG('k', 'e', 'r', 'n');
54const int32_t Tag::LTSH = TAG('L', 'T', 'S', 'H');
55const int32_t Tag::PCLT = TAG('P', 'C', 'L', 'T');
56const int32_t Tag::VDMX = TAG('V', 'D', 'M', 'X');
57const int32_t Tag::vhea = TAG('v', 'h', 'e', 'a');
58const int32_t Tag::vmtx = TAG('v', 'm', 't', 'x');
59const int32_t Tag::bsln = TAG('b', 's', 'l', 'n');
60const int32_t Tag::feat = TAG('f', 'e', 'a', 't');
61const int32_t Tag::lcar = TAG('l', 'c', 'a', 'r');
62const int32_t Tag::morx = TAG('m', 'o', 'r', 'x');
63const int32_t Tag::opbd = TAG('o', 'p', 'b', 'd');
64const int32_t Tag::prop = TAG('p', 'r', 'o', 'p');
65const int32_t Tag::Feat = TAG('F', 'e', 'a', 't');
66const int32_t Tag::Glat = TAG('G', 'l', 'a', 't');
67const int32_t Tag::Gloc = TAG('G', 'l', 'o', 'c');
68const int32_t Tag::Sile = TAG('S', 'i', 'l', 'e');
69const int32_t Tag::Silf = TAG('S', 'i', 'l', 'f');
70const int32_t Tag::bhed = TAG('b', 'h', 'e', 'd');
71const int32_t Tag::bdat = TAG('b', 'd', 'a', 't');
72const int32_t Tag::bloc = TAG('b', 'l', 'o', 'c');
73
74const 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 };
83const size_t CFF_TABLE_ORDERING_SIZE =
84    sizeof(CFF_TABLE_ORDERING) / sizeof(int32_t);
85
86const 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 };
107const size_t TRUE_TYPE_TABLE_ORDERING_SIZE =
108    sizeof(TRUE_TYPE_TABLE_ORDERING) / sizeof(int32_t);
109
110}  // namespace sfntly
111