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

Unified Diff: third_party/ots/src/vhea.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/vhea.h ('k') | third_party/ots/src/vmtx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/ots/src/vhea.cc
diff --git a/third_party/ots/src/vhea.cc b/third_party/ots/src/vhea.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c689a834f0c19e7465b9c1e8fd315f6bfd349480
--- /dev/null
+++ b/third_party/ots/src/vhea.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2011 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 "vhea.h"
+
+#include "gsub.h"
+#include "head.h"
+#include "maxp.h"
+
+// vhea - Vertical Header Table
+// http://www.microsoft.com/typography/otspec/vhea.htm
+
+#define TABLE_NAME "vhea"
+
+namespace ots {
+
+bool ots_vhea_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
+ Buffer table(data, length);
+ OpenTypeVHEA *vhea = new OpenTypeVHEA;
+ file->vhea = vhea;
+
+ if (!table.ReadU32(&vhea->header.version)) {
+ return OTS_FAILURE_MSG("Failed to read version");
+ }
+ if (vhea->header.version != 0x00010000 &&
+ vhea->header.version != 0x00011000) {
+ return OTS_FAILURE_MSG("Bad vhea version %x", vhea->header.version);
+ }
+
+ if (!ParseMetricsHeader(file, &table, &vhea->header)) {
+ return OTS_FAILURE_MSG("Failed to parse metrics in vhea");
+ }
+
+ return true;
+}
+
+bool ots_vhea_should_serialise(OpenTypeFile *file) {
+ // vhea should'nt serialise when vmtx doesn't exist.
+ // Firefox developer pointed out that vhea/vmtx should serialise iff GSUB is
+ // preserved. See http://crbug.com/77386
+ return file->vhea != NULL && file->vmtx != NULL &&
+ ots_gsub_should_serialise(file);
+}
+
+bool ots_vhea_serialise(OTSStream *out, OpenTypeFile *file) {
+ if (!SerialiseMetricsHeader(file, out, &file->vhea->header)) {
+ return OTS_FAILURE_MSG("Failed to write vhea metrics");
+ }
+ return true;
+}
+
+void ots_vhea_free(OpenTypeFile *file) {
+ delete file->vhea;
+}
+
+} // namespace ots
+
+#undef TABLE_NAME
« no previous file with comments | « third_party/ots/src/vhea.h ('k') | third_party/ots/src/vmtx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698