1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/harfbuzz/src/hb-ot-head-table.hh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,149 @@ 1.4 +/* 1.5 + * Copyright © 2010 Red Hat, Inc. 1.6 + * Copyright © 2012 Google, Inc. 1.7 + * 1.8 + * This is part of HarfBuzz, a text shaping library. 1.9 + * 1.10 + * Permission is hereby granted, without written agreement and without 1.11 + * license or royalty fees, to use, copy, modify, and distribute this 1.12 + * software and its documentation for any purpose, provided that the 1.13 + * above copyright notice and the following two paragraphs appear in 1.14 + * all copies of this software. 1.15 + * 1.16 + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 1.17 + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 1.18 + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 1.19 + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 1.20 + * DAMAGE. 1.21 + * 1.22 + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 1.23 + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 1.24 + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 1.25 + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 1.26 + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 1.27 + * 1.28 + * Red Hat Author(s): Behdad Esfahbod 1.29 + * Google Author(s): Behdad Esfahbod 1.30 + */ 1.31 + 1.32 +#ifndef HB_OT_HEAD_TABLE_HH 1.33 +#define HB_OT_HEAD_TABLE_HH 1.34 + 1.35 +#include "hb-open-type-private.hh" 1.36 + 1.37 + 1.38 +namespace OT { 1.39 + 1.40 + 1.41 +/* 1.42 + * head -- Font Header 1.43 + */ 1.44 + 1.45 +#define HB_OT_TAG_head HB_TAG('h','e','a','d') 1.46 + 1.47 +struct head 1.48 +{ 1.49 + static const hb_tag_t tableTag = HB_OT_TAG_head; 1.50 + 1.51 + inline unsigned int get_upem (void) const { 1.52 + unsigned int upem = unitsPerEm; 1.53 + /* If no valid head table found, assume 1000, which matches typical Type1 usage. */ 1.54 + return 16 <= upem && upem <= 16384 ? upem : 1000; 1.55 + } 1.56 + 1.57 + inline bool sanitize (hb_sanitize_context_t *c) { 1.58 + TRACE_SANITIZE (this); 1.59 + return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); 1.60 + } 1.61 + 1.62 + protected: 1.63 + FixedVersion version; /* Version of the head table--currently 1.64 + * 0x00010000 for version 1.0. */ 1.65 + FixedVersion fontRevision; /* Set by font manufacturer. */ 1.66 + ULONG checkSumAdjustment; /* To compute: set it to 0, sum the 1.67 + * entire font as ULONG, then store 1.68 + * 0xB1B0AFBA - sum. */ 1.69 + ULONG magicNumber; /* Set to 0x5F0F3CF5. */ 1.70 + USHORT flags; /* Bit 0: Baseline for font at y=0; 1.71 + * Bit 1: Left sidebearing point at x=0; 1.72 + * Bit 2: Instructions may depend on point size; 1.73 + * Bit 3: Force ppem to integer values for all 1.74 + * internal scaler math; may use fractional 1.75 + * ppem sizes if this bit is clear; 1.76 + * Bit 4: Instructions may alter advance width 1.77 + * (the advance widths might not scale linearly); 1.78 + 1.79 + * Bits 5-10: These should be set according to 1.80 + * Apple's specification. However, they are not 1.81 + * implemented in OpenType. 1.82 + * Bit 5: This bit should be set in fonts that are 1.83 + * intended to e laid out vertically, and in 1.84 + * which the glyphs have been drawn such that an 1.85 + * x-coordinate of 0 corresponds to the desired 1.86 + * vertical baseline. 1.87 + * Bit 6: This bit must be set to zero. 1.88 + * Bit 7: This bit should be set if the font 1.89 + * requires layout for correct linguistic 1.90 + * rendering (e.g. Arabic fonts). 1.91 + * Bit 8: This bit should be set for a GX font 1.92 + * which has one or more metamorphosis effects 1.93 + * designated as happening by default. 1.94 + * Bit 9: This bit should be set if the font 1.95 + * contains any strong right-to-left glyphs. 1.96 + * Bit 10: This bit should be set if the font 1.97 + * contains Indic-style rearrangement effects. 1.98 + 1.99 + * Bit 11: Font data is 'lossless,' as a result 1.100 + * of having been compressed and decompressed 1.101 + * with the Agfa MicroType Express engine. 1.102 + * Bit 12: Font converted (produce compatible metrics) 1.103 + * Bit 13: Font optimized for ClearType™. 1.104 + * Note, fonts that rely on embedded bitmaps (EBDT) 1.105 + * for rendering should not be considered optimized 1.106 + * for ClearType, and therefore should keep this bit 1.107 + * cleared. 1.108 + * Bit 14: Last Resort font. If set, indicates that 1.109 + * the glyphs encoded in the cmap subtables are simply 1.110 + * generic symbolic representations of code point 1.111 + * ranges and don’t truly represent support for those 1.112 + * code points. If unset, indicates that the glyphs 1.113 + * encoded in the cmap subtables represent proper 1.114 + * support for those code points. 1.115 + * Bit 15: Reserved, set to 0. */ 1.116 + USHORT unitsPerEm; /* Valid range is from 16 to 16384. This value 1.117 + * should be a power of 2 for fonts that have 1.118 + * TrueType outlines. */ 1.119 + LONGDATETIME created; /* Number of seconds since 12:00 midnight, 1.120 + January 1, 1904. 64-bit integer */ 1.121 + LONGDATETIME modified; /* Number of seconds since 12:00 midnight, 1.122 + January 1, 1904. 64-bit integer */ 1.123 + SHORT xMin; /* For all glyph bounding boxes. */ 1.124 + SHORT yMin; /* For all glyph bounding boxes. */ 1.125 + SHORT xMax; /* For all glyph bounding boxes. */ 1.126 + SHORT yMax; /* For all glyph bounding boxes. */ 1.127 + USHORT macStyle; /* Bit 0: Bold (if set to 1); 1.128 + * Bit 1: Italic (if set to 1) 1.129 + * Bit 2: Underline (if set to 1) 1.130 + * Bit 3: Outline (if set to 1) 1.131 + * Bit 4: Shadow (if set to 1) 1.132 + * Bit 5: Condensed (if set to 1) 1.133 + * Bit 6: Extended (if set to 1) 1.134 + * Bits 7-15: Reserved (set to 0). */ 1.135 + USHORT lowestRecPPEM; /* Smallest readable size in pixels. */ 1.136 + SHORT fontDirectionHint; /* Deprecated (Set to 2). 1.137 + * 0: Fully mixed directional glyphs; 1.138 + * 1: Only strongly left to right; 1.139 + * 2: Like 1 but also contains neutrals; 1.140 + * -1: Only strongly right to left; 1.141 + * -2: Like -1 but also contains neutrals. */ 1.142 + SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */ 1.143 + SHORT glyphDataFormat; /* 0 for current format. */ 1.144 + public: 1.145 + DEFINE_SIZE_STATIC (54); 1.146 +}; 1.147 + 1.148 + 1.149 +} /* namespace OT */ 1.150 + 1.151 + 1.152 +#endif /* HB_OT_HEAD_TABLE_HH */