2 * Copyright © 2010 Red Hat, Inc.
3 * Copyright © 2012 Google, Inc.
5 * This is part of HarfBuzz, a text shaping library.
7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in
11 * all copies of this software.
13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 * Red Hat Author(s): Behdad Esfahbod
26 * Google Author(s): Behdad Esfahbod
29 #ifndef HB_OT_HEAD_TABLE_HH
30 #define HB_OT_HEAD_TABLE_HH
32 #include "hb-open-type-private.hh"
42 #define HB_OT_TAG_head HB_TAG('h','e','a','d')
46 static const hb_tag_t tableTag
= HB_OT_TAG_head
;
48 inline unsigned int get_upem (void) const
50 unsigned int upem
= unitsPerEm
;
51 /* If no valid head table found, assume 1000, which matches typical Type1 usage. */
52 return 16 <= upem
&& upem
<= 16384 ? upem
: 1000;
55 inline bool sanitize (hb_sanitize_context_t
*c
) const
57 TRACE_SANITIZE (this);
58 return TRACE_RETURN (c
->check_struct (this) && likely (version
.major
== 1));
62 FixedVersion version
; /* Version of the head table--currently
63 * 0x00010000u for version 1.0. */
64 FixedVersion fontRevision
; /* Set by font manufacturer. */
65 ULONG checkSumAdjustment
; /* To compute: set it to 0, sum the
66 * entire font as ULONG, then store
67 * 0xB1B0AFBAu - sum. */
68 ULONG magicNumber
; /* Set to 0x5F0F3CF5u. */
69 USHORT flags
; /* Bit 0: Baseline for font at y=0;
70 * Bit 1: Left sidebearing point at x=0;
71 * Bit 2: Instructions may depend on point size;
72 * Bit 3: Force ppem to integer values for all
73 * internal scaler math; may use fractional
74 * ppem sizes if this bit is clear;
75 * Bit 4: Instructions may alter advance width
76 * (the advance widths might not scale linearly);
78 * Bits 5-10: These should be set according to
79 * Apple's specification. However, they are not
80 * implemented in OpenType.
81 * Bit 5: This bit should be set in fonts that are
82 * intended to e laid out vertically, and in
83 * which the glyphs have been drawn such that an
84 * x-coordinate of 0 corresponds to the desired
86 * Bit 6: This bit must be set to zero.
87 * Bit 7: This bit should be set if the font
88 * requires layout for correct linguistic
89 * rendering (e.g. Arabic fonts).
90 * Bit 8: This bit should be set for a GX font
91 * which has one or more metamorphosis effects
92 * designated as happening by default.
93 * Bit 9: This bit should be set if the font
94 * contains any strong right-to-left glyphs.
95 * Bit 10: This bit should be set if the font
96 * contains Indic-style rearrangement effects.
98 * Bit 11: Font data is 'lossless,' as a result
99 * of having been compressed and decompressed
100 * with the Agfa MicroType Express engine.
101 * Bit 12: Font converted (produce compatible metrics)
102 * Bit 13: Font optimized for ClearType™.
103 * Note, fonts that rely on embedded bitmaps (EBDT)
104 * for rendering should not be considered optimized
105 * for ClearType, and therefore should keep this bit
107 * Bit 14: Last Resort font. If set, indicates that
108 * the glyphs encoded in the cmap subtables are simply
109 * generic symbolic representations of code point
110 * ranges and don’t truly represent support for those
111 * code points. If unset, indicates that the glyphs
112 * encoded in the cmap subtables represent proper
113 * support for those code points.
114 * Bit 15: Reserved, set to 0. */
115 USHORT unitsPerEm
; /* Valid range is from 16 to 16384. This value
116 * should be a power of 2 for fonts that have
117 * TrueType outlines. */
118 LONGDATETIME created
; /* Number of seconds since 12:00 midnight,
119 January 1, 1904. 64-bit integer */
120 LONGDATETIME modified
; /* Number of seconds since 12:00 midnight,
121 January 1, 1904. 64-bit integer */
122 SHORT xMin
; /* For all glyph bounding boxes. */
123 SHORT yMin
; /* For all glyph bounding boxes. */
124 SHORT xMax
; /* For all glyph bounding boxes. */
125 SHORT yMax
; /* For all glyph bounding boxes. */
126 USHORT macStyle
; /* Bit 0: Bold (if set to 1);
127 * Bit 1: Italic (if set to 1)
128 * Bit 2: Underline (if set to 1)
129 * Bit 3: Outline (if set to 1)
130 * Bit 4: Shadow (if set to 1)
131 * Bit 5: Condensed (if set to 1)
132 * Bit 6: Extended (if set to 1)
133 * Bits 7-15: Reserved (set to 0). */
134 USHORT lowestRecPPEM
; /* Smallest readable size in pixels. */
135 SHORT fontDirectionHint
; /* Deprecated (Set to 2).
136 * 0: Fully mixed directional glyphs;
137 * 1: Only strongly left to right;
138 * 2: Like 1 but also contains neutrals;
139 * -1: Only strongly right to left;
140 * -2: Like -1 but also contains neutrals. */
141 SHORT indexToLocFormat
; /* 0 for short offsets, 1 for long. */
142 SHORT glyphDataFormat
; /* 0 for current format. */
144 DEFINE_SIZE_STATIC (54);
151 #endif /* HB_OT_HEAD_TABLE_HH */