// Copyright (c) 2009-2017 The OTS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file.
// All OTS_FAILURE_* macros ultimately evaluate to 'false', just like the original // message-less OTS_FAILURE(), so that the current parser will return 'false' as // its result (indicating a failure).
// Convenience macros for use in files that only handle a single table tag, // defined as TABLE_NAME at the top of the file; the 'file' variable is // expected to be the current FontFile pointer. #define OTS_FAILURE_MSG(...) OTS_FAILURE_MSG_(font->file, TABLE_NAME ": " __VA_ARGS__)
// ----------------------------------------------------------------------------- // Buffer helper class // // This class perform some trival buffer operations while checking for // out-of-bounds errors. As a family they return false if anything is amiss, // updating the current offset otherwise. // ----------------------------------------------------------------------------- class Buffer { public:
Buffer(const uint8_t *buf, size_t len)
: buffer_(buf),
length_(len),
offset_(0) { }
// Round a value up to the nearest multiple of 4. Don't round the value in the // case that rounding up overflows. template<typename T> T Round4(T value) { if (std::numeric_limits<T>::max() - value < 3) { return value;
} return (value + 3) & ~3;
}
// Return the tag (table type) this Table was parsed as, to support // "poor man's RTTI" so that we know if we can safely down-cast to // a specific Table subclass. The m_type field is initialized to the // appropriate tag when a subclass is constructed, or to zero for // TablePassthru (indicating unparsed data).
uint32_t Type() { return m_type; }
// Return the tag assigned when this table was constructed.
uint32_t Tag() { return m_tag; }
// This checks that the returned Table is actually of the correct subclass // for |tag|, so it can safely be downcast to the corresponding OpenTypeXXXX; // if not (i.e. if the table was treated as Passthru), it will return NULL.
Table* GetTypedTable(uint32_t tag) const;
// Insert a new table. Asserts if a table with the same tag already exists. void AddTable(TableEntry entry, Table* table);
// Drop all Graphite tables and don't parse new ones. void DropGraphite();
// Drop all Variations tables and don't parse new ones. void DropVariations();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.