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

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

Powered by Google App Engine
This is Rietveld 408576698