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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/ots/src/vmtx.cc
diff --git a/third_party/ots/src/vmtx.cc b/third_party/ots/src/vmtx.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e29d32b29f9b55de3a76727a2d0af75f656b860d
--- /dev/null
+++ b/third_party/ots/src/vmtx.cc
@@ -0,0 +1,55 @@
+// 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 "vmtx.h"
+
+#include "gsub.h"
+#include "maxp.h"
+#include "vhea.h"
+
+// vmtx - Vertical Metrics Table
+// http://www.microsoft.com/typography/otspec/vmtx.htm
+
+#define TABLE_NAME "vmtx"
+
+namespace ots {
+
+bool ots_vmtx_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
+ Buffer table(data, length);
+ OpenTypeVMTX *vmtx = new OpenTypeVMTX;
+ file->vmtx = vmtx;
+
+ if (!file->vhea || !file->maxp) {
+ return OTS_FAILURE_MSG("vhea or maxp table missing as needed by vmtx");
+ }
+
+ if (!ParseMetricsTable(file, &table, file->maxp->num_glyphs,
+ &file->vhea->header, &vmtx->metrics)) {
+ return OTS_FAILURE_MSG("Failed to parse vmtx metrics");
+ }
+
+ return true;
+}
+
+bool ots_vmtx_should_serialise(OpenTypeFile *file) {
+ // vmtx should serialise when vhea and GSUB are preserved.
+ // See the comment in ots_vhea_should_serialise().
+ return file->vmtx != NULL && file->vhea != NULL &&
+ ots_gsub_should_serialise(file);
+}
+
+bool ots_vmtx_serialise(OTSStream *out, OpenTypeFile *file) {
+ if (!SerialiseMetricsTable(file, out, &file->vmtx->metrics)) {
+ return OTS_FAILURE_MSG("Failed to write vmtx metrics");
+ }
+ return true;
+}
+
+void ots_vmtx_free(OpenTypeFile *file) {
+ delete file->vmtx;
+}
+
+} // namespace ots
+
+#undef TABLE_NAME
« 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