2 * Copyright © 2016 Google, Inc.
4 * This is part of HarfBuzz, a text shaping library.
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24 * Google Author(s): Behdad Esfahbod
27 #ifndef HB_OT_POST_TABLE_HH
28 #define HB_OT_POST_TABLE_HH
30 #include "hb-open-type-private.hh"
40 #define HB_OT_TAG_post HB_TAG('p','o','s','t')
45 inline bool sanitize (hb_sanitize_context_t *c) const
47 TRACE_SANITIZE (this);
48 return_trace (numberOfGlyphs.sanitize (c) &&
49 c->check_array (glyphNameIndex, sizeof (USHORT), numberOfGlyphs));
52 USHORT numberOfGlyphs; /* Number of glyphs (this should be the
53 * same as numGlyphs in 'maxp' table). */
54 USHORT glyphNameIndex[VAR]; /* This is not an offset, but is the
55 * ordinal number of the glyph in 'post'
57 BYTE namesX[VAR]; /* Glyph names with length bytes [variable]
58 * (a Pascal string). */
60 DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);
65 static const hb_tag_t tableTag = HB_OT_TAG_post;
67 inline bool sanitize (hb_sanitize_context_t *c) const
69 TRACE_SANITIZE (this);
70 if (unlikely (!c->check_struct (this)))
72 if (version.to_int () == 0x00020000)
74 const postV2Tail &v2 = StructAfter<postV2Tail>(*this);
75 return_trace (v2.sanitize (c));
81 FixedVersion<>version; /* 0x00010000 for version 1.0
82 * 0x00020000 for version 2.0
83 * 0x00025000 for version 2.5 (deprecated)
84 * 0x00030000 for version 3.0 */
85 Fixed italicAngle; /* Italic angle in counter-clockwise degrees
86 * from the vertical. Zero for upright text,
87 * negative for text that leans to the right
89 FWORD underlinePosition; /* This is the suggested distance of the top
90 * of the underline from the baseline
91 * (negative values indicate below baseline).
92 * The PostScript definition of this FontInfo
93 * dictionary key (the y coordinate of the
94 * center of the stroke) is not used for
95 * historical reasons. The value of the
96 * PostScript key may be calculated by
97 * subtracting half the underlineThickness
98 * from the value of this field. */
99 FWORD underlineThickness; /* Suggested values for the underline
101 ULONG isFixedPitch; /* Set to 0 if the font is proportionally
102 * spaced, non-zero if the font is not
103 * proportionally spaced (i.e. monospaced). */
104 ULONG minMemType42; /* Minimum memory usage when an OpenType font
106 ULONG maxMemType42; /* Maximum memory usage when an OpenType font
108 ULONG minMemType1; /* Minimum memory usage when an OpenType font
109 * is downloaded as a Type 1 font. */
110 ULONG maxMemType1; /* Maximum memory usage when an OpenType font
111 * is downloaded as a Type 1 font. */
112 /*postV2Tail v2[VAR];*/
113 DEFINE_SIZE_STATIC (32);
119 #endif /* HB_OT_POST_TABLE_HH */