gfx/harfbuzz/src/hb-ot-hmtx-table.hh

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /*
michael@0 2 * Copyright © 2011,2012 Google, Inc.
michael@0 3 *
michael@0 4 * This is part of HarfBuzz, a text shaping library.
michael@0 5 *
michael@0 6 * Permission is hereby granted, without written agreement and without
michael@0 7 * license or royalty fees, to use, copy, modify, and distribute this
michael@0 8 * software and its documentation for any purpose, provided that the
michael@0 9 * above copyright notice and the following two paragraphs appear in
michael@0 10 * all copies of this software.
michael@0 11 *
michael@0 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
michael@0 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
michael@0 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
michael@0 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
michael@0 16 * DAMAGE.
michael@0 17 *
michael@0 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
michael@0 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
michael@0 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
michael@0 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
michael@0 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
michael@0 23 *
michael@0 24 * Google Author(s): Behdad Esfahbod
michael@0 25 */
michael@0 26
michael@0 27 #ifndef HB_OT_HMTX_TABLE_HH
michael@0 28 #define HB_OT_HMTX_TABLE_HH
michael@0 29
michael@0 30 #include "hb-open-type-private.hh"
michael@0 31
michael@0 32
michael@0 33 namespace OT {
michael@0 34
michael@0 35
michael@0 36 /*
michael@0 37 * hmtx -- The Horizontal Metrics Table
michael@0 38 */
michael@0 39
michael@0 40 #define HB_OT_TAG_hmtx HB_TAG('h','m','t','x')
michael@0 41
michael@0 42
michael@0 43 struct LongHorMetric
michael@0 44 {
michael@0 45 USHORT advanceWidth;
michael@0 46 SHORT lsb;
michael@0 47 public:
michael@0 48 DEFINE_SIZE_STATIC (4);
michael@0 49 };
michael@0 50
michael@0 51 struct hmtx
michael@0 52 {
michael@0 53 static const hb_tag_t tableTag = HB_OT_TAG_hmtx;
michael@0 54
michael@0 55 inline bool sanitize (hb_sanitize_context_t *c) {
michael@0 56 TRACE_SANITIZE (this);
michael@0 57 /* We don't check for anything specific here. The users of the
michael@0 58 * struct do all the hard work... */
michael@0 59 return TRACE_RETURN (true);
michael@0 60 }
michael@0 61
michael@0 62 protected:
michael@0 63 LongHorMetric longHorMetric[VAR]; /* Paired advance width and left side
michael@0 64 * bearing values for each glyph. The
michael@0 65 * value numOfHMetrics comes from
michael@0 66 * the 'hhea' table. If the font is
michael@0 67 * monospaced, only one entry need
michael@0 68 * be in the array, but that entry is
michael@0 69 * required. The last entry applies to
michael@0 70 * all subsequent glyphs. */
michael@0 71 SHORT leftSideBearingX[VAR]; /* Here the advanceWidth is assumed
michael@0 72 * to be the same as the advanceWidth
michael@0 73 * for the last entry above. The
michael@0 74 * number of entries in this array is
michael@0 75 * derived from numGlyphs (from 'maxp'
michael@0 76 * table) minus numberOfHMetrics. This
michael@0 77 * generally is used with a run of
michael@0 78 * monospaced glyphs (e.g., Kanji
michael@0 79 * fonts or Courier fonts). Only one
michael@0 80 * run is allowed and it must be at
michael@0 81 * the end. This allows a monospaced
michael@0 82 * font to vary the left side bearing
michael@0 83 * values for each glyph. */
michael@0 84 public:
michael@0 85 DEFINE_SIZE_ARRAY2 (0, longHorMetric, leftSideBearingX);
michael@0 86 };
michael@0 87
michael@0 88
michael@0 89 } /* namespace OT */
michael@0 90
michael@0 91
michael@0 92 #endif /* HB_OT_HMTX_TABLE_HH */

mercurial