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

Unified Diff: third_party/ots/src/hhea.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/ots/src/hhea.h ('k') | third_party/ots/src/hmtx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/ots/src/hhea.cc
diff --git a/third_party/ots/src/hhea.cc b/third_party/ots/src/hhea.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8430442d8ef624c1ffc4dcb8512aac68fb05e99b
--- /dev/null
+++ b/third_party/ots/src/hhea.cc
@@ -0,0 +1,53 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "hhea.h"
+
+#include "head.h"
+#include "maxp.h"
+
+// hhea - Horizontal Header
+// http://www.microsoft.com/typography/otspec/hhea.htm
+
+#define TABLE_NAME "hhea"
+
+namespace ots {
+
+bool ots_hhea_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
+ Buffer table(data, length);
+ OpenTypeHHEA *hhea = new OpenTypeHHEA;
+ file->hhea = hhea;
+
+ if (!table.ReadU32(&hhea->header.version)) {
+ return OTS_FAILURE_MSG("Failed to read hhea version");
+ }
+ if (hhea->header.version >> 16 != 1) {
+ return OTS_FAILURE_MSG("Bad hhea version of %d", hhea->header.version);
+ }
+
+ if (!ParseMetricsHeader(file, &table, &hhea->header)) {
+ return OTS_FAILURE_MSG("Failed to parse horizontal metrics");
+ }
+
+ return true;
+}
+
+bool ots_hhea_should_serialise(OpenTypeFile *file) {
+ return file->hhea != NULL;
+}
+
+bool ots_hhea_serialise(OTSStream *out, OpenTypeFile *file) {
+ if (!SerialiseMetricsHeader(file, out, &file->hhea->header)) {
+ return OTS_FAILURE_MSG("Failed to serialise horizontal metrics");
+ }
+ return true;
+}
+
+void ots_hhea_free(OpenTypeFile *file) {
+ delete file->hhea;
+}
+
+} // namespace ots
+
+#undef TABLE_NAME
« no previous file with comments | « third_party/ots/src/hhea.h ('k') | third_party/ots/src/hmtx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698