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

Side by Side Diff: third_party/ots/src/hmtx.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/hmtx.h ('k') | third_party/ots/src/kern.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) 2009 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 "hmtx.h"
6
7 #include "hhea.h"
8 #include "maxp.h"
9
10 // hmtx - Horizontal Metrics
11 // http://www.microsoft.com/typography/otspec/hmtx.htm
12
13 #define TABLE_NAME "hmtx"
14
15 namespace ots {
16
17 bool ots_hmtx_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
18 Buffer table(data, length);
19 OpenTypeHMTX *hmtx = new OpenTypeHMTX;
20 file->hmtx = hmtx;
21
22 if (!file->hhea || !file->maxp) {
23 return OTS_FAILURE_MSG("Missing hhea or maxp tables in font, needed by hmtx" );
24 }
25
26 if (!ParseMetricsTable(file, &table, file->maxp->num_glyphs,
27 &file->hhea->header, &hmtx->metrics)) {
28 return OTS_FAILURE_MSG("Failed to parse hmtx metrics");
29 }
30
31 return true;
32 }
33
34 bool ots_hmtx_should_serialise(OpenTypeFile *file) {
35 return file->hmtx != NULL;
36 }
37
38 bool ots_hmtx_serialise(OTSStream *out, OpenTypeFile *file) {
39 if (!SerialiseMetricsTable(file, out, &file->hmtx->metrics)) {
40 return OTS_FAILURE_MSG("Failed to serialise htmx metrics");
41 }
42 return true;
43 }
44
45 void ots_hmtx_free(OpenTypeFile *file) {
46 delete file->hmtx;
47 }
48
49 } // namespace ots
50
51 #undef TABLE_NAME
OLDNEW
« no previous file with comments | « third_party/ots/src/hmtx.h ('k') | third_party/ots/src/kern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698