Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: third_party/ots/src/hhea.cc

Issue 775893002: Updating OTS repo from https://github.com/khaledhosny/ots.git (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating with 4800 warning fix Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/ots/src/hhea.h ('k') | third_party/ots/src/hmtx.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "hhea.h"
6
7 #include "head.h"
8 #include "maxp.h"
9
10 // hhea - Horizontal Header
11 // http://www.microsoft.com/typography/otspec/hhea.htm
12
13 #define TABLE_NAME "hhea"
14
15 namespace ots {
16
17 bool ots_hhea_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
18 Buffer table(data, length);
19 OpenTypeHHEA *hhea = new OpenTypeHHEA;
20 file->hhea = hhea;
21
22 if (!table.ReadU32(&hhea->header.version)) {
23 return OTS_FAILURE_MSG("Failed to read hhea version");
24 }
25 if (hhea->header.version >> 16 != 1) {
26 return OTS_FAILURE_MSG("Bad hhea version of %d", hhea->header.version);
27 }
28
29 if (!ParseMetricsHeader(file, &table, &hhea->header)) {
30 return OTS_FAILURE_MSG("Failed to parse horizontal metrics");
31 }
32
33 return true;
34 }
35
36 bool ots_hhea_should_serialise(OpenTypeFile *file) {
37 return file->hhea != NULL;
38 }
39
40 bool ots_hhea_serialise(OTSStream *out, OpenTypeFile *file) {
41 if (!SerialiseMetricsHeader(file, out, &file->hhea->header)) {
42 return OTS_FAILURE_MSG("Failed to serialise horizontal metrics");
43 }
44 return true;
45 }
46
47 void ots_hhea_free(OpenTypeFile *file) {
48 delete file->hhea;
49 }
50
51 } // namespace ots
52
53 #undef TABLE_NAME
OLDNEW
« no previous file with comments | « third_party/ots/src/hhea.h ('k') | third_party/ots/src/hmtx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698