webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
woff2_common.h
Go to the documentation of this file.
1 // Copyright 2014 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // Common definition for WOFF2 encoding/decoding
16 
17 #ifndef WOFF2_WOFF2_COMMON_H_
18 #define WOFF2_WOFF2_COMMON_H_
19 
20 #include <stddef.h>
21 #include <inttypes.h>
22 
23 #include <string>
24 
25 namespace woff2 {
26 
27 static const uint32_t kWoff2Signature = 0x774f4632; // "wOF2"
28 
29 // Leave the first byte open to store flag_byte
30 const unsigned int kWoff2FlagsTransform = 1 << 8;
31 
32 // TrueType Collection ID string: 'ttcf'
33 static const uint32_t kTtcFontFlavor = 0x74746366;
34 
35 static const size_t kSfntHeaderSize = 12;
36 static const size_t kSfntEntrySize = 16;
37 
38 struct Point {
39  int x;
40  int y;
41  bool on_curve;
42 };
43 
44 struct Table {
49 
51 
54  const uint8_t* dst_data;
55 
56  bool operator<(const Table& other) const {
57  return tag < other.tag;
58  }
59 };
60 
61 
62 // Size of the collection header. 0 if version indicates this isn't a
63 // collection. Ref http://www.microsoft.com/typography/otspec/otff.htm,
64 // True Type Collections
65 size_t CollectionHeaderSize(uint32_t header_version, uint32_t num_fonts);
66 
67 // Compute checksum over size bytes of buf
68 uint32_t ComputeULongSum(const uint8_t* buf, size_t size);
69 
70 } // namespace woff2
71 
72 #endif // WOFF2_WOFF2_COMMON_H_
uint32_t dst_length
Definition: woff2_common.h:53
EGLStreamKHR EGLint EGLint EGLint size
Definition: eglext.h:984
size_t CollectionHeaderSize(uint32_t header_version, uint32_t num_fonts)
Definition: woff2_common.cc:52
uint32_t src_length
Definition: woff2_common.h:48
unsigned int uint32_t
Definition: ptypes.h:105
uint32_t src_offset
Definition: woff2_common.h:47
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: gl2ext.h:134
const unsigned int kWoff2FlagsTransform
Definition: woff2_common.h:30
uint32_t dst_offset
Definition: woff2_common.h:52
const uint8_t * dst_data
Definition: woff2_common.h:54
int x
Definition: woff2_common.h:39
unsigned char uint8_t
Definition: ptypes.h:89
uint32_t tag
Definition: woff2_common.h:45
int y
Definition: woff2_common.h:40
bool on_curve
Definition: woff2_common.h:41
Definition: woff2_common.h:44
uint32_t flags
Definition: woff2_common.h:46
bool operator<(const Table &other) const
Definition: woff2_common.h:56
uint32_t transform_length
Definition: woff2_common.h:50
uint32_t ComputeULongSum(const uint8_t *buf, size_t size)
Definition: woff2_common.cc:24
Definition: buffer.h:45
Definition: woff2_common.h:38