Blame src/hb-ot-hmtx-table.hh

Packit 874993
/*
Packit 874993
 * Copyright © 2011,2012  Google, Inc.
Packit 874993
 *
Packit 874993
 *  This is part of HarfBuzz, a text shaping library.
Packit 874993
 *
Packit 874993
 * Permission is hereby granted, without written agreement and without
Packit 874993
 * license or royalty fees, to use, copy, modify, and distribute this
Packit 874993
 * software and its documentation for any purpose, provided that the
Packit 874993
 * above copyright notice and the following two paragraphs appear in
Packit 874993
 * all copies of this software.
Packit 874993
 *
Packit 874993
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
Packit 874993
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
Packit 874993
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
Packit 874993
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
Packit 874993
 * DAMAGE.
Packit 874993
 *
Packit 874993
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
Packit 874993
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
Packit 874993
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
Packit 874993
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
Packit 874993
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Packit 874993
 *
Packit 874993
 * Google Author(s): Behdad Esfahbod
Packit 874993
 */
Packit 874993
Packit 874993
#ifndef HB_OT_HMTX_TABLE_HH
Packit 874993
#define HB_OT_HMTX_TABLE_HH
Packit 874993
Packit 874993
#include "hb-open-type-private.hh"
Packit 874993
Packit 874993
Packit 874993
namespace OT {
Packit 874993
Packit 874993
Packit 874993
/*
Packit 874993
 * hmtx -- The Horizontal Metrics Table
Packit 874993
 * vmtx -- The Vertical Metrics Table
Packit 874993
 */
Packit 874993
Packit 874993
#define HB_OT_TAG_hmtx HB_TAG('h','m','t','x')
Packit 874993
#define HB_OT_TAG_vmtx HB_TAG('v','m','t','x')
Packit 874993
Packit 874993
Packit 874993
struct LongMetric
Packit 874993
{
Packit 874993
  UFWORD	advance; /* Advance width/height. */
Packit 874993
  FWORD		lsb; /* Leading (left/top) side bearing. */
Packit 874993
  public:
Packit 874993
  DEFINE_SIZE_STATIC (4);
Packit 874993
};
Packit 874993
Packit 874993
struct hmtxvmtx
Packit 874993
{
Packit 874993
  static const hb_tag_t hmtxTag	= HB_OT_TAG_hmtx;
Packit 874993
  static const hb_tag_t vmtxTag	= HB_OT_TAG_vmtx;
Packit 874993
Packit 874993
  inline bool sanitize (hb_sanitize_context_t *c) const
Packit 874993
  {
Packit 874993
    TRACE_SANITIZE (this);
Packit 874993
    /* We don't check for anything specific here.  The users of the
Packit 874993
     * struct do all the hard work... */
Packit 874993
    return_trace (true);
Packit 874993
  }
Packit 874993
Packit 874993
  public:
Packit 874993
  LongMetric	longMetric[VAR];	/* Paired advance width and leading
Packit 874993
					 * bearing values for each glyph. The
Packit 874993
					 * value numOfHMetrics comes from
Packit 874993
					 * the 'hhea' table. If the font is
Packit 874993
					 * monospaced, only one entry need
Packit 874993
					 * be in the array, but that entry is
Packit 874993
					 * required. The last entry applies to
Packit 874993
					 * all subsequent glyphs. */
Packit 874993
  FWORD		leadingBearingX[VAR];	/* Here the advance is assumed
Packit 874993
					 * to be the same as the advance
Packit 874993
					 * for the last entry above. The
Packit 874993
					 * number of entries in this array is
Packit 874993
					 * derived from numGlyphs (from 'maxp'
Packit 874993
					 * table) minus numberOfLongMetrics.
Packit 874993
					 * This generally is used with a run
Packit 874993
					 * of monospaced glyphs (e.g., Kanji
Packit 874993
					 * fonts or Courier fonts). Only one
Packit 874993
					 * run is allowed and it must be at
Packit 874993
					 * the end. This allows a monospaced
Packit 874993
					 * font to vary the side bearing
Packit 874993
					 * values for each glyph. */
Packit 874993
  public:
Packit 874993
  DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX);
Packit 874993
};
Packit 874993
Packit 874993
struct hmtx : hmtxvmtx {
Packit 874993
  static const hb_tag_t tableTag	= HB_OT_TAG_hmtx;
Packit 874993
};
Packit 874993
struct vmtx : hmtxvmtx {
Packit 874993
  static const hb_tag_t tableTag	= HB_OT_TAG_vmtx;
Packit 874993
};
Packit 874993
Packit 874993
} /* namespace OT */
Packit 874993
Packit 874993
Packit 874993
#endif /* HB_OT_HMTX_TABLE_HH */