1464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com/*
2464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * Copyright 2011 Google Inc. All Rights Reserved.
3464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com *
4464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * Licensed under the Apache License, Version 2.0 (the "License");
5464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * you may not use this file except in compliance with the License.
6464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * You may obtain a copy of the License at
7464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com *
8464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com *      http://www.apache.org/licenses/LICENSE-2.0
9464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com *
10464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * Unless required by applicable law or agreed to in writing, software
11464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * distributed under the License is distributed on an "AS IS" BASIS,
12464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * See the License for the specific language governing permissions and
14464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com * limitations under the License.
15464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com */
16464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
17464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com#include "sfntly/tag.h"
18464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com#include "sfntly/port/endian.h"
19464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
20a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.com// Use a macro instead of GenerateTag() because gcc 4.4.3 creates static
21a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.com// initializers in that case.
22a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.com#define TAG(a, b, c, d) ((a << 24) | (b << 16) | (c << 8) | d);
23a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.com
24464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comnamespace sfntly {
25464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
26a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::ttcf = TAG('t', 't', 'c', 'f');
27a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::cmap = TAG('c', 'm', 'a', 'p');
28a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::head = TAG('h', 'e', 'a', 'd');
29a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::hhea = TAG('h', 'h', 'e', 'a');
30a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::hmtx = TAG('h', 'm', 't', 'x');
31a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::maxp = TAG('m', 'a', 'x', 'p');
32a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::name = TAG('n', 'a', 'm', 'e');
33a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::OS_2 = TAG('O', 'S', '/', '2');
34a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::post = TAG('p', 'o', 's', 't');
35a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::cvt  = TAG('c', 'v', 't', ' ');
36a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::fpgm = TAG('f', 'p', 'g', 'm');
37a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::glyf = TAG('g', 'l', 'y', 'f');
38a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::loca = TAG('l', 'o', 'c', 'a');
39a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::prep = TAG('p', 'r', 'e', 'p');
40a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::CFF  = TAG('C', 'F', 'F', ' ');
41a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::VORG = TAG('V', 'O', 'R', 'G');
42a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::EBDT = TAG('E', 'B', 'D', 'T');
43a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::EBLC = TAG('E', 'B', 'L', 'C');
44a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::EBSC = TAG('E', 'B', 'S', 'C');
45a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::BASE = TAG('B', 'A', 'S', 'E');
46a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::GDEF = TAG('G', 'D', 'E', 'F');
47a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::GPOS = TAG('G', 'P', 'O', 'S');
48a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::GSUB = TAG('G', 'S', 'U', 'B');
49a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::JSTF = TAG('J', 'S', 'T', 'F');
50a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::DSIG = TAG('D', 'S', 'I', 'G');
51a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::gasp = TAG('g', 'a', 's', 'p');
52a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::hdmx = TAG('h', 'd', 'm', 'x');
53a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::kern = TAG('k', 'e', 'r', 'n');
54a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::LTSH = TAG('L', 'T', 'S', 'H');
55a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::PCLT = TAG('P', 'C', 'L', 'T');
56a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::VDMX = TAG('V', 'D', 'M', 'X');
57a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::vhea = TAG('v', 'h', 'e', 'a');
58a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::vmtx = TAG('v', 'm', 't', 'x');
59a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::bsln = TAG('b', 's', 'l', 'n');
60a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::feat = TAG('f', 'e', 'a', 't');
61a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::lcar = TAG('l', 'c', 'a', 'r');
62a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::morx = TAG('m', 'o', 'r', 'x');
63a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::opbd = TAG('o', 'p', 'b', 'd');
64a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::prop = TAG('p', 'r', 'o', 'p');
65a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::Feat = TAG('F', 'e', 'a', 't');
66a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::Glat = TAG('G', 'l', 'a', 't');
67a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::Gloc = TAG('G', 'l', 'o', 'c');
68a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::Sile = TAG('S', 'i', 'l', 'e');
69a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::Silf = TAG('S', 'i', 'l', 'f');
70a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::bhed = TAG('b', 'h', 'e', 'd');
71a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::bdat = TAG('b', 'd', 'a', 't');
72a70737a5b6ca5cd32e1a47adb847e1d016e1502barthurhsu@google.comconst int32_t Tag::bloc = TAG('b', 'l', 'o', 'c');
73464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
74464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comconst int32_t CFF_TABLE_ORDERING[] = {
75464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::head,
76464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::hhea,
77464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::maxp,
78464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::OS_2,
79464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::name,
80464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::cmap,
81464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::post,
82464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::CFF };
83464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comconst size_t CFF_TABLE_ORDERING_SIZE =
84464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    sizeof(CFF_TABLE_ORDERING) / sizeof(int32_t);
85464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
86464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comconst int32_t TRUE_TYPE_TABLE_ORDERING[] = {
87464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::head,
88464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::hhea,
89464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::maxp,
90464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::OS_2,
91464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::hmtx,
92464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::LTSH,
93464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::VDMX,
94464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::hdmx,
95464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::cmap,
96464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::fpgm,
97464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::prep,
98464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::cvt,
99464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::loca,
100464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::glyf,
101464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::kern,
102464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::name,
103464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::post,
104464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::gasp,
105464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::PCLT,
106464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    Tag::DSIG };
107464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.comconst size_t TRUE_TYPE_TABLE_ORDERING_SIZE =
108464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com    sizeof(TRUE_TYPE_TABLE_ORDERING) / sizeof(int32_t);
109464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com
110464987db923362e596195f9eebd34fc508c9a41arthurhsu@google.com}  // namespace sfntly
111