1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/harfbuzz/src/hb-ot-hmtx-table.hh Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 1.4 +/* 1.5 + * Copyright © 2011,2012 Google, Inc. 1.6 + * 1.7 + * This is part of HarfBuzz, a text shaping library. 1.8 + * 1.9 + * Permission is hereby granted, without written agreement and without 1.10 + * license or royalty fees, to use, copy, modify, and distribute this 1.11 + * software and its documentation for any purpose, provided that the 1.12 + * above copyright notice and the following two paragraphs appear in 1.13 + * all copies of this software. 1.14 + * 1.15 + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 1.16 + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 1.17 + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 1.18 + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 1.19 + * DAMAGE. 1.20 + * 1.21 + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 1.22 + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 1.23 + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 1.24 + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 1.25 + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 1.26 + * 1.27 + * Google Author(s): Behdad Esfahbod 1.28 + */ 1.29 + 1.30 +#ifndef HB_OT_HMTX_TABLE_HH 1.31 +#define HB_OT_HMTX_TABLE_HH 1.32 + 1.33 +#include "hb-open-type-private.hh" 1.34 + 1.35 + 1.36 +namespace OT { 1.37 + 1.38 + 1.39 +/* 1.40 + * hmtx -- The Horizontal Metrics Table 1.41 + */ 1.42 + 1.43 +#define HB_OT_TAG_hmtx HB_TAG('h','m','t','x') 1.44 + 1.45 + 1.46 +struct LongHorMetric 1.47 +{ 1.48 + USHORT advanceWidth; 1.49 + SHORT lsb; 1.50 + public: 1.51 + DEFINE_SIZE_STATIC (4); 1.52 +}; 1.53 + 1.54 +struct hmtx 1.55 +{ 1.56 + static const hb_tag_t tableTag = HB_OT_TAG_hmtx; 1.57 + 1.58 + inline bool sanitize (hb_sanitize_context_t *c) { 1.59 + TRACE_SANITIZE (this); 1.60 + /* We don't check for anything specific here. The users of the 1.61 + * struct do all the hard work... */ 1.62 + return TRACE_RETURN (true); 1.63 + } 1.64 + 1.65 + protected: 1.66 + LongHorMetric longHorMetric[VAR]; /* Paired advance width and left side 1.67 + * bearing values for each glyph. The 1.68 + * value numOfHMetrics comes from 1.69 + * the 'hhea' table. If the font is 1.70 + * monospaced, only one entry need 1.71 + * be in the array, but that entry is 1.72 + * required. The last entry applies to 1.73 + * all subsequent glyphs. */ 1.74 + SHORT leftSideBearingX[VAR]; /* Here the advanceWidth is assumed 1.75 + * to be the same as the advanceWidth 1.76 + * for the last entry above. The 1.77 + * number of entries in this array is 1.78 + * derived from numGlyphs (from 'maxp' 1.79 + * table) minus numberOfHMetrics. This 1.80 + * generally is used with a run of 1.81 + * monospaced glyphs (e.g., Kanji 1.82 + * fonts or Courier fonts). Only one 1.83 + * run is allowed and it must be at 1.84 + * the end. This allows a monospaced 1.85 + * font to vary the left side bearing 1.86 + * values for each glyph. */ 1.87 + public: 1.88 + DEFINE_SIZE_ARRAY2 (0, longHorMetric, leftSideBearingX); 1.89 +}; 1.90 + 1.91 + 1.92 +} /* namespace OT */ 1.93 + 1.94 + 1.95 +#endif /* HB_OT_HMTX_TABLE_HH */