Backed out 7 changesets (bug 1839993) for causing build bustages on DecoderTemplate...
[gecko.git] / modules / woff2 / src / woff2_common.h
blob51fd4a7bf8a326350fbce2e651bfe575aefeafd4
1 /* Copyright 2014 Google Inc. All Rights Reserved.
3 Distributed under MIT license.
4 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5 */
7 /* Common definition for WOFF2 encoding/decoding */
9 #ifndef WOFF2_WOFF2_COMMON_H_
10 #define WOFF2_WOFF2_COMMON_H_
12 #include <stddef.h>
13 #include <inttypes.h>
15 #include <string>
17 namespace woff2 {
19 static const uint32_t kWoff2Signature = 0x774f4632; // "wOF2"
21 // Leave the first byte open to store flag_byte
22 const unsigned int kWoff2FlagsTransform = 1 << 8;
24 // TrueType Collection ID string: 'ttcf'
25 static const uint32_t kTtcFontFlavor = 0x74746366;
27 static const size_t kSfntHeaderSize = 12;
28 static const size_t kSfntEntrySize = 16;
30 struct Point {
31 int x;
32 int y;
33 bool on_curve;
36 struct Table {
37 uint32_t tag;
38 uint32_t flags;
39 uint32_t src_offset;
40 uint32_t src_length;
42 uint32_t transform_length;
44 uint32_t dst_offset;
45 uint32_t dst_length;
46 const uint8_t* dst_data;
48 bool operator<(const Table& other) const {
49 return tag < other.tag;
54 // Size of the collection header. 0 if version indicates this isn't a
55 // collection. Ref http://www.microsoft.com/typography/otspec/otff.htm,
56 // True Type Collections
57 size_t CollectionHeaderSize(uint32_t header_version, uint32_t num_fonts);
59 // Compute checksum over size bytes of buf
60 uint32_t ComputeULongSum(const uint8_t* buf, size_t size);
62 } // namespace woff2
64 #endif // WOFF2_WOFF2_COMMON_H_