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

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

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

Powered by Google App Engine
This is Rietveld 408576698