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

Packit 874993
/*
Packit 874993
 * Copyright © 2016  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_POST_TABLE_HH
Packit 874993
#define HB_OT_POST_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
 * post -- PostScript
Packit 874993
 */
Packit 874993
Packit 874993
#define HB_OT_TAG_post HB_TAG('p','o','s','t')
Packit 874993
Packit 874993
Packit 874993
struct postV2Tail
Packit 874993
{
Packit 874993
  inline bool sanitize (hb_sanitize_context_t *c) const
Packit 874993
  {
Packit 874993
    TRACE_SANITIZE (this);
Packit 874993
    return_trace (numberOfGlyphs.sanitize (c) &&
Packit 874993
		  c->check_array (glyphNameIndex, sizeof (USHORT), numberOfGlyphs));
Packit 874993
  }
Packit 874993
Packit 874993
  USHORT	numberOfGlyphs;		/* Number of glyphs (this should be the
Packit 874993
					 * same as numGlyphs in 'maxp' table). */
Packit 874993
  USHORT	glyphNameIndex[VAR];	/* This is not an offset, but is the
Packit 874993
					 * ordinal number of the glyph in 'post'
Packit 874993
					 * string tables. */
Packit 874993
  BYTE		namesX[VAR];		/* Glyph names with length bytes [variable]
Packit 874993
					 * (a Pascal string). */
Packit 874993
Packit 874993
  DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);
Packit 874993
};
Packit 874993
Packit 874993
struct post
Packit 874993
{
Packit 874993
  static const hb_tag_t tableTag = HB_OT_TAG_post;
Packit 874993
Packit 874993
  inline bool sanitize (hb_sanitize_context_t *c) const
Packit 874993
  {
Packit 874993
    TRACE_SANITIZE (this);
Packit 874993
    if (unlikely (!c->check_struct (this)))
Packit 874993
      return_trace (false);
Packit 874993
    if (version.to_int () == 0x00020000)
Packit 874993
    {
Packit 874993
      const postV2Tail &v2 = StructAfter<postV2Tail>(*this);
Packit 874993
      return_trace (v2.sanitize (c));
Packit 874993
    }
Packit 874993
    return_trace (true);
Packit 874993
  }
Packit 874993
Packit 874993
  public:
Packit 874993
  FixedVersion<>version;		/* 0x00010000 for version 1.0
Packit 874993
					 * 0x00020000 for version 2.0
Packit 874993
					 * 0x00025000 for version 2.5 (deprecated)
Packit 874993
					 * 0x00030000 for version 3.0 */
Packit 874993
  Fixed		italicAngle;		/* Italic angle in counter-clockwise degrees
Packit 874993
					 * from the vertical. Zero for upright text,
Packit 874993
					 * negative for text that leans to the right
Packit 874993
					 * (forward). */
Packit 874993
  FWORD		underlinePosition;	/* This is the suggested distance of the top
Packit 874993
					 * of the underline from the baseline
Packit 874993
					 * (negative values indicate below baseline).
Packit 874993
					 * The PostScript definition of this FontInfo
Packit 874993
					 * dictionary key (the y coordinate of the
Packit 874993
					 * center of the stroke) is not used for
Packit 874993
					 * historical reasons. The value of the
Packit 874993
					 * PostScript key may be calculated by
Packit 874993
					 * subtracting half the underlineThickness
Packit 874993
					 * from the value of this field. */
Packit 874993
  FWORD		underlineThickness;	/* Suggested values for the underline
Packit 874993
					   thickness. */
Packit 874993
  ULONG		isFixedPitch;		/* Set to 0 if the font is proportionally
Packit 874993
					 * spaced, non-zero if the font is not
Packit 874993
					 * proportionally spaced (i.e. monospaced). */
Packit 874993
  ULONG		minMemType42;		/* Minimum memory usage when an OpenType font
Packit 874993
					 * is downloaded. */
Packit 874993
  ULONG		maxMemType42;		/* Maximum memory usage when an OpenType font
Packit 874993
					 * is downloaded. */
Packit 874993
  ULONG		minMemType1;		/* Minimum memory usage when an OpenType font
Packit 874993
					 * is downloaded as a Type 1 font. */
Packit 874993
  ULONG		maxMemType1;		/* Maximum memory usage when an OpenType font
Packit 874993
					 * is downloaded as a Type 1 font. */
Packit 874993
/*postV2Tail	v2[VAR];*/
Packit 874993
  DEFINE_SIZE_STATIC (32);
Packit 874993
};
Packit 874993
Packit 874993
} /* namespace OT */
Packit 874993
Packit 874993
Packit 874993
#endif /* HB_OT_POST_TABLE_HH */