chromium/third_party/ots/src/src/ots.h

// 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.

#ifndef OTS_H_
#define OTS_H_

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <stddef.h>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <map>

#include "opentype-sanitiser.h"

// arraysize borrowed from base/basictypes.h
template <typename T, size_t N>
char (&ArraySizeHelper(T (&array)[N]))[N];
#define arraysize(array)

namespace ots {

#if !defined(OTS_DEBUG)
#define OTS_FAILURE()
#else
#define OTS_FAILURE
#endif

// 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).

#if !defined(OTS_DEBUG)
#define OTS_MESSAGE_(level,otf_,...)
#else
#define OTS_MESSAGE_
#endif

// Generate a simple message
#define OTS_FAILURE_MSG_(otf_,...)

#define OTS_WARNING_MSG_(otf_,...)

// 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(...)

#define OTS_WARNING(...)

// -----------------------------------------------------------------------------
// 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 {};

// 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) {}

template<typename T> T Round2(T value) {}

// Check that a tag consists entirely of printable ASCII characters
bool CheckTag(uint32_t tag_value);

#define OTS_TAG_CFF
#define OTS_TAG_CFF2
#define OTS_TAG_CMAP
#define OTS_TAG_CVT
#define OTS_TAG_FEAT
#define OTS_TAG_FPGM
#define OTS_TAG_GASP
#define OTS_TAG_GDEF
#define OTS_TAG_GLAT
#define OTS_TAG_GLOC
#define OTS_TAG_GLYF
#define OTS_TAG_GPOS
#define OTS_TAG_GSUB
#define OTS_TAG_HDMX
#define OTS_TAG_HEAD
#define OTS_TAG_HHEA
#define OTS_TAG_HMTX
#define OTS_TAG_KERN
#define OTS_TAG_LOCA
#define OTS_TAG_LTSH
#define OTS_TAG_MATH
#define OTS_TAG_MAXP
#define OTS_TAG_NAME
#define OTS_TAG_OS2
#define OTS_TAG_POST
#define OTS_TAG_PREP
#define OTS_TAG_SILE
#define OTS_TAG_SILF
#define OTS_TAG_SILL
#define OTS_TAG_VDMX
#define OTS_TAG_VHEA
#define OTS_TAG_VMTX
#define OTS_TAG_VORG

#define OTS_TAG_AVAR
#define OTS_TAG_CVAR
#define OTS_TAG_FVAR
#define OTS_TAG_GVAR
#define OTS_TAG_HVAR
#define OTS_TAG_MVAR
#define OTS_TAG_VVAR
#define OTS_TAG_STAT

// See https://github.com/khaledhosny/ots/issues/219
#define OTS_MAX_DECOMPRESSED_FILE_SIZE
#define OTS_MAX_DECOMPRESSED_TABLE_SIZE

struct Font;
struct FontFile;
struct TableEntry;
struct Arena;

class Table {};

class TablePassthru : public Table {};

struct Font {};

struct TableEntry {};

struct FontFile {};

}  // namespace ots

#endif  // OTS_H_