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

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

Powered by Google App Engine
This is Rietveld 408576698