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

Side by Side Diff: src/vhea.cc

Issue 658573004: Updating to new OTS repo from https://github.com/khaledhosny/ots.git (Closed) Base URL: https://chromium.googlesource.com/external/ots@master
Patch Set: Adding Colored Emoji changes from external/git repo Created 6 years, 2 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
« .gitmodules ('K') | « src/vdmx.cc ('k') | src/vmtx.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "vhea.h" 5 #include "vhea.h"
6 6
7 #include "gsub.h" 7 #include "gsub.h"
8 #include "head.h" 8 #include "head.h"
9 #include "maxp.h" 9 #include "maxp.h"
10 10
11 // vhea - Vertical Header Table 11 // vhea - Vertical Header Table
12 // http://www.microsoft.com/opentype/otspec/vhea.htm 12 // http://www.microsoft.com/typography/otspec/vhea.htm
13
14 #define TABLE_NAME "vhea"
13 15
14 namespace ots { 16 namespace ots {
15 17
16 bool ots_vhea_parse(OpenTypeFile *file, const uint8_t *data, size_t length) { 18 bool ots_vhea_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
17 Buffer table(data, length); 19 Buffer table(data, length);
18 OpenTypeVHEA *vhea = new OpenTypeVHEA; 20 OpenTypeVHEA *vhea = new OpenTypeVHEA;
19 file->vhea = vhea; 21 file->vhea = vhea;
20 22
21 if (!table.ReadU32(&vhea->header.version)) { 23 if (!table.ReadU32(&vhea->header.version)) {
22 return OTS_FAILURE(); 24 return OTS_FAILURE_MSG("Failed to read version");
23 } 25 }
24 if (vhea->header.version != 0x00010000 && 26 if (vhea->header.version != 0x00010000 &&
25 vhea->header.version != 0x00011000) { 27 vhea->header.version != 0x00011000) {
26 return OTS_FAILURE(); 28 return OTS_FAILURE_MSG("Bad vhea version %x", vhea->header.version);
27 } 29 }
28 30
29 if (!ParseMetricsHeader(file, &table, &vhea->header)) { 31 if (!ParseMetricsHeader(file, &table, &vhea->header)) {
30 return OTS_FAILURE(); 32 return OTS_FAILURE_MSG("Failed to parse metrics in vhea");
31 } 33 }
32 34
33 return true; 35 return true;
34 } 36 }
35 37
36 bool ots_vhea_should_serialise(OpenTypeFile *file) { 38 bool ots_vhea_should_serialise(OpenTypeFile *file) {
37 // vhea should'nt serialise when vmtx doesn't exist. 39 // vhea should'nt serialise when vmtx doesn't exist.
38 // Firefox developer pointed out that vhea/vmtx should serialise iff GSUB is 40 // Firefox developer pointed out that vhea/vmtx should serialise iff GSUB is
39 // preserved. See http://crbug.com/77386 41 // preserved. See http://crbug.com/77386
40 return file->vhea != NULL && file->vmtx != NULL && 42 return file->vhea != NULL && file->vmtx != NULL &&
41 ots_gsub_should_serialise(file); 43 ots_gsub_should_serialise(file);
42 } 44 }
43 45
44 bool ots_vhea_serialise(OTSStream *out, OpenTypeFile *file) { 46 bool ots_vhea_serialise(OTSStream *out, OpenTypeFile *file) {
45 if (!SerialiseMetricsHeader(out, &file->vhea->header)) { 47 if (!SerialiseMetricsHeader(file, out, &file->vhea->header)) {
46 return OTS_FAILURE(); 48 return OTS_FAILURE_MSG("Failed to write vhea metrics");
47 } 49 }
48 return true; 50 return true;
49 } 51 }
50 52
51 void ots_vhea_free(OpenTypeFile *file) { 53 void ots_vhea_free(OpenTypeFile *file) {
52 delete file->vhea; 54 delete file->vhea;
53 } 55 }
54 56
55 } // namespace ots 57 } // namespace ots
56 58
59 #undef TABLE_NAME
OLDNEW
« .gitmodules ('K') | « src/vdmx.cc ('k') | src/vmtx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698