michael@0: /* michael@0: * Copyright © 2010 Red Hat, Inc. michael@0: * Copyright © 2012 Google, Inc. michael@0: * michael@0: * This is part of HarfBuzz, a text shaping library. michael@0: * michael@0: * Permission is hereby granted, without written agreement and without michael@0: * license or royalty fees, to use, copy, modify, and distribute this michael@0: * software and its documentation for any purpose, provided that the michael@0: * above copyright notice and the following two paragraphs appear in michael@0: * all copies of this software. michael@0: * michael@0: * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR michael@0: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES michael@0: * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN michael@0: * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH michael@0: * DAMAGE. michael@0: * michael@0: * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, michael@0: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND michael@0: * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS michael@0: * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO michael@0: * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. michael@0: * michael@0: * Red Hat Author(s): Behdad Esfahbod michael@0: * Google Author(s): Behdad Esfahbod michael@0: */ michael@0: michael@0: #ifndef HB_OT_HEAD_TABLE_HH michael@0: #define HB_OT_HEAD_TABLE_HH michael@0: michael@0: #include "hb-open-type-private.hh" michael@0: michael@0: michael@0: namespace OT { michael@0: michael@0: michael@0: /* michael@0: * head -- Font Header michael@0: */ michael@0: michael@0: #define HB_OT_TAG_head HB_TAG('h','e','a','d') michael@0: michael@0: struct head michael@0: { michael@0: static const hb_tag_t tableTag = HB_OT_TAG_head; michael@0: michael@0: inline unsigned int get_upem (void) const { michael@0: unsigned int upem = unitsPerEm; michael@0: /* If no valid head table found, assume 1000, which matches typical Type1 usage. */ michael@0: return 16 <= upem && upem <= 16384 ? upem : 1000; michael@0: } michael@0: michael@0: inline bool sanitize (hb_sanitize_context_t *c) { michael@0: TRACE_SANITIZE (this); michael@0: return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); michael@0: } michael@0: michael@0: protected: michael@0: FixedVersion version; /* Version of the head table--currently michael@0: * 0x00010000 for version 1.0. */ michael@0: FixedVersion fontRevision; /* Set by font manufacturer. */ michael@0: ULONG checkSumAdjustment; /* To compute: set it to 0, sum the michael@0: * entire font as ULONG, then store michael@0: * 0xB1B0AFBA - sum. */ michael@0: ULONG magicNumber; /* Set to 0x5F0F3CF5. */ michael@0: USHORT flags; /* Bit 0: Baseline for font at y=0; michael@0: * Bit 1: Left sidebearing point at x=0; michael@0: * Bit 2: Instructions may depend on point size; michael@0: * Bit 3: Force ppem to integer values for all michael@0: * internal scaler math; may use fractional michael@0: * ppem sizes if this bit is clear; michael@0: * Bit 4: Instructions may alter advance width michael@0: * (the advance widths might not scale linearly); michael@0: michael@0: * Bits 5-10: These should be set according to michael@0: * Apple's specification. However, they are not michael@0: * implemented in OpenType. michael@0: * Bit 5: This bit should be set in fonts that are michael@0: * intended to e laid out vertically, and in michael@0: * which the glyphs have been drawn such that an michael@0: * x-coordinate of 0 corresponds to the desired michael@0: * vertical baseline. michael@0: * Bit 6: This bit must be set to zero. michael@0: * Bit 7: This bit should be set if the font michael@0: * requires layout for correct linguistic michael@0: * rendering (e.g. Arabic fonts). michael@0: * Bit 8: This bit should be set for a GX font michael@0: * which has one or more metamorphosis effects michael@0: * designated as happening by default. michael@0: * Bit 9: This bit should be set if the font michael@0: * contains any strong right-to-left glyphs. michael@0: * Bit 10: This bit should be set if the font michael@0: * contains Indic-style rearrangement effects. michael@0: michael@0: * Bit 11: Font data is 'lossless,' as a result michael@0: * of having been compressed and decompressed michael@0: * with the Agfa MicroType Express engine. michael@0: * Bit 12: Font converted (produce compatible metrics) michael@0: * Bit 13: Font optimized for ClearType™. michael@0: * Note, fonts that rely on embedded bitmaps (EBDT) michael@0: * for rendering should not be considered optimized michael@0: * for ClearType, and therefore should keep this bit michael@0: * cleared. michael@0: * Bit 14: Last Resort font. If set, indicates that michael@0: * the glyphs encoded in the cmap subtables are simply michael@0: * generic symbolic representations of code point michael@0: * ranges and don’t truly represent support for those michael@0: * code points. If unset, indicates that the glyphs michael@0: * encoded in the cmap subtables represent proper michael@0: * support for those code points. michael@0: * Bit 15: Reserved, set to 0. */ michael@0: USHORT unitsPerEm; /* Valid range is from 16 to 16384. This value michael@0: * should be a power of 2 for fonts that have michael@0: * TrueType outlines. */ michael@0: LONGDATETIME created; /* Number of seconds since 12:00 midnight, michael@0: January 1, 1904. 64-bit integer */ michael@0: LONGDATETIME modified; /* Number of seconds since 12:00 midnight, michael@0: January 1, 1904. 64-bit integer */ michael@0: SHORT xMin; /* For all glyph bounding boxes. */ michael@0: SHORT yMin; /* For all glyph bounding boxes. */ michael@0: SHORT xMax; /* For all glyph bounding boxes. */ michael@0: SHORT yMax; /* For all glyph bounding boxes. */ michael@0: USHORT macStyle; /* Bit 0: Bold (if set to 1); michael@0: * Bit 1: Italic (if set to 1) michael@0: * Bit 2: Underline (if set to 1) michael@0: * Bit 3: Outline (if set to 1) michael@0: * Bit 4: Shadow (if set to 1) michael@0: * Bit 5: Condensed (if set to 1) michael@0: * Bit 6: Extended (if set to 1) michael@0: * Bits 7-15: Reserved (set to 0). */ michael@0: USHORT lowestRecPPEM; /* Smallest readable size in pixels. */ michael@0: SHORT fontDirectionHint; /* Deprecated (Set to 2). michael@0: * 0: Fully mixed directional glyphs; michael@0: * 1: Only strongly left to right; michael@0: * 2: Like 1 but also contains neutrals; michael@0: * -1: Only strongly right to left; michael@0: * -2: Like -1 but also contains neutrals. */ michael@0: SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */ michael@0: SHORT glyphDataFormat; /* 0 for current format. */ michael@0: public: michael@0: DEFINE_SIZE_STATIC (54); michael@0: }; michael@0: michael@0: michael@0: } /* namespace OT */ michael@0: michael@0: michael@0: #endif /* HB_OT_HEAD_TABLE_HH */