| OLD | NEW |
| 1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 // | 14 // |
| 15 // Common definition for WOFF2 encoding/decoding | 15 // Common definition for WOFF2 encoding/decoding |
| 16 | 16 |
| 17 #ifndef WOFF2_WOFF2_COMMON_H_ | 17 #ifndef WOFF2_WOFF2_COMMON_H_ |
| 18 #define WOFF2_WOFF2_COMMON_H_ | 18 #define WOFF2_WOFF2_COMMON_H_ |
| 19 | 19 |
| 20 #include <stddef.h> | 20 #include <stddef.h> |
| 21 #include <inttypes.h> | 21 #include <inttypes.h> |
| 22 | 22 |
| 23 #include <string> | 23 #include <string> |
| 24 | 24 |
| 25 namespace woff2 { | 25 namespace woff2 { |
| 26 | 26 |
| 27 static const uint32_t kWoff2Signature = 0x774f4632; // "wOF2" | 27 static const uint32_t kWoff2Signature = 0x774f4632; // "wOF2" |
| 28 | 28 |
| 29 const unsigned int kWoff2FlagsTransform = 1 << 5; | 29 // Leave the first byte open to store flag_byte |
| 30 const unsigned int kWoff2FlagsTransform = 1 << 8; |
| 30 | 31 |
| 31 // TrueType Collection ID string: 'ttcf' | 32 // TrueType Collection ID string: 'ttcf' |
| 32 static const uint32_t kTtcFontFlavor = 0x74746366; | 33 static const uint32_t kTtcFontFlavor = 0x74746366; |
| 33 | 34 |
| 34 static const size_t kSfntHeaderSize = 12; | 35 static const size_t kSfntHeaderSize = 12; |
| 35 static const size_t kSfntEntrySize = 16; | 36 static const size_t kSfntEntrySize = 16; |
| 36 | 37 |
| 37 struct Point { | 38 struct Point { |
| 38 int x; | 39 int x; |
| 39 int y; | 40 int y; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 62 // collection. Ref http://www.microsoft.com/typography/otspec/otff.htm, | 63 // collection. Ref http://www.microsoft.com/typography/otspec/otff.htm, |
| 63 // True Type Collections | 64 // True Type Collections |
| 64 size_t CollectionHeaderSize(uint32_t header_version, uint32_t num_fonts); | 65 size_t CollectionHeaderSize(uint32_t header_version, uint32_t num_fonts); |
| 65 | 66 |
| 66 // Compute checksum over size bytes of buf | 67 // Compute checksum over size bytes of buf |
| 67 uint32_t ComputeULongSum(const uint8_t* buf, size_t size); | 68 uint32_t ComputeULongSum(const uint8_t* buf, size_t size); |
| 68 | 69 |
| 69 } // namespace woff2 | 70 } // namespace woff2 |
| 70 | 71 |
| 71 #endif // WOFF2_WOFF2_COMMON_H_ | 72 #endif // WOFF2_WOFF2_COMMON_H_ |
| OLD | NEW |