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

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

Issue 1487543005: Update OTS to revision 99a3b7f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/vhea.cc ('k') | third_party/ots/src/woff2.h » ('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 "vmtx.h" 5 #include "vmtx.h"
6 6
7 #include "gsub.h"
8 #include "maxp.h" 7 #include "maxp.h"
9 #include "vhea.h" 8 #include "vhea.h"
10 9
11 // vmtx - Vertical Metrics Table 10 // vmtx - Vertical Metrics Table
12 // http://www.microsoft.com/typography/otspec/vmtx.htm 11 // http://www.microsoft.com/typography/otspec/vmtx.htm
13 12
14 #define TABLE_NAME "vmtx" 13 #define TABLE_NAME "vmtx"
15 14
16 namespace ots { 15 namespace ots {
17 16
18 bool ots_vmtx_parse(Font *font, const uint8_t *data, size_t length) { 17 bool ots_vmtx_parse(Font *font, const uint8_t *data, size_t length) {
19 Buffer table(data, length); 18 Buffer table(data, length);
20 OpenTypeVMTX *vmtx = new OpenTypeVMTX; 19 OpenTypeVMTX *vmtx = new OpenTypeVMTX;
21 font->vmtx = vmtx; 20 font->vmtx = vmtx;
22 21
23 if (!font->vhea || !font->maxp) { 22 if (!font->vhea || !font->maxp) {
24 return OTS_FAILURE_MSG("vhea or maxp table missing as needed by vmtx"); 23 return OTS_FAILURE_MSG("vhea or maxp table missing as needed by vmtx");
25 } 24 }
26 25
27 if (!ParseMetricsTable(font, &table, font->maxp->num_glyphs, 26 if (!ParseMetricsTable(font, &table, font->maxp->num_glyphs,
28 &font->vhea->header, &vmtx->metrics)) { 27 &font->vhea->header, &vmtx->metrics)) {
29 return OTS_FAILURE_MSG("Failed to parse vmtx metrics"); 28 return OTS_FAILURE_MSG("Failed to parse vmtx metrics");
30 } 29 }
31 30
32 return true; 31 return true;
33 } 32 }
34 33
35 bool ots_vmtx_should_serialise(Font *font) { 34 bool ots_vmtx_should_serialise(Font *font) {
36 // vmtx should serialise when vhea and GSUB are preserved. 35 // vmtx should serialise when vhea is preserved.
37 // See the comment in ots_vhea_should_serialise(). 36 return font->vmtx != NULL && font->vhea != NULL;
38 return font->vmtx != NULL && font->vhea != NULL &&
39 ots_gsub_should_serialise(font);
40 } 37 }
41 38
42 bool ots_vmtx_serialise(OTSStream *out, Font *font) { 39 bool ots_vmtx_serialise(OTSStream *out, Font *font) {
43 if (!SerialiseMetricsTable(font, out, &font->vmtx->metrics)) { 40 if (!SerialiseMetricsTable(font, out, &font->vmtx->metrics)) {
44 return OTS_FAILURE_MSG("Failed to write vmtx metrics"); 41 return OTS_FAILURE_MSG("Failed to write vmtx metrics");
45 } 42 }
46 return true; 43 return true;
47 } 44 }
48 45
49 void ots_vmtx_reuse(Font *font, Font *other) { 46 void ots_vmtx_reuse(Font *font, Font *other) {
50 font->vmtx = other->vmtx; 47 font->vmtx = other->vmtx;
51 font->vmtx_reused = true; 48 font->vmtx_reused = true;
52 } 49 }
53 50
54 void ots_vmtx_free(Font *font) { 51 void ots_vmtx_free(Font *font) {
55 delete font->vmtx; 52 delete font->vmtx;
56 } 53 }
57 54
58 } // namespace ots 55 } // namespace ots
59 56
60 #undef TABLE_NAME 57 #undef TABLE_NAME
OLDNEW
« no previous file with comments | « third_party/ots/src/vhea.cc ('k') | third_party/ots/src/woff2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698