src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-hmtx-table.hh
author prr
Thu, 07 Dec 2017 11:55:06 -0800
changeset 48274 51772bf1fb0c
parent 47216 71c04702a3d5
child 50352 25db2c8f3cf8
permissions -rw-r--r--
8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10 Reviewed-by: serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     1
/*
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     2
 * Copyright © 2011,2012  Google, Inc.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     3
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     4
 *  This is part of HarfBuzz, a text shaping library.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     5
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     6
 * Permission is hereby granted, without written agreement and without
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     7
 * license or royalty fees, to use, copy, modify, and distribute this
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     8
 * software and its documentation for any purpose, provided that the
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     9
 * above copyright notice and the following two paragraphs appear in
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    10
 * all copies of this software.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    11
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    12
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    13
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    14
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    15
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    16
 * DAMAGE.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    17
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    18
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    19
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    20
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    21
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    22
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    23
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    24
 * Google Author(s): Behdad Esfahbod
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    25
 */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    26
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    27
#ifndef HB_OT_HMTX_TABLE_HH
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    28
#define HB_OT_HMTX_TABLE_HH
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    29
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    30
#include "hb-open-type-private.hh"
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    31
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    32
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    33
namespace OT {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    34
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    35
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    36
/*
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    37
 * hmtx -- The Horizontal Metrics Table
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    38
 * vmtx -- The Vertical Metrics Table
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    39
 */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    40
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    41
#define HB_OT_TAG_hmtx HB_TAG('h','m','t','x')
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    42
#define HB_OT_TAG_vmtx HB_TAG('v','m','t','x')
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    43
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    44
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    45
struct LongMetric
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    46
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    47
  UFWORD        advance; /* Advance width/height. */
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    48
  FWORD         lsb; /* Leading (left/top) side bearing. */
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    49
  public:
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    50
  DEFINE_SIZE_STATIC (4);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    51
};
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    52
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
    53
struct hmtxvmtx
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    54
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    55
  static const hb_tag_t hmtxTag = HB_OT_TAG_hmtx;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    56
  static const hb_tag_t vmtxTag = HB_OT_TAG_vmtx;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    57
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    58
  inline bool sanitize (hb_sanitize_context_t *c) const
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    59
  {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    60
    TRACE_SANITIZE (this);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    61
    /* We don't check for anything specific here.  The users of the
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    62
     * struct do all the hard work... */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    63
    return_trace (true);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    64
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    65
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    66
  public:
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    67
  LongMetric    longMetric[VAR];        /* Paired advance width and leading
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    68
                                         * bearing values for each glyph. The
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    69
                                         * value numOfHMetrics comes from
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    70
                                         * the 'hhea' table. If the font is
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    71
                                         * monospaced, only one entry need
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    72
                                         * be in the array, but that entry is
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    73
                                         * required. The last entry applies to
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    74
                                         * all subsequent glyphs. */
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    75
  FWORD         leadingBearingX[VAR];   /* Here the advance is assumed
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    76
                                         * to be the same as the advance
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    77
                                         * for the last entry above. The
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    78
                                         * number of entries in this array is
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    79
                                         * derived from numGlyphs (from 'maxp'
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    80
                                         * table) minus numberOfLongMetrics.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    81
                                         * This generally is used with a run
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    82
                                         * of monospaced glyphs (e.g., Kanji
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    83
                                         * fonts or Courier fonts). Only one
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    84
                                         * run is allowed and it must be at
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    85
                                         * the end. This allows a monospaced
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    86
                                         * font to vary the side bearing
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    87
                                         * values for each glyph. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    88
  public:
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    89
  DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    90
};
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    91
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
    92
struct hmtx : hmtxvmtx {
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    93
  static const hb_tag_t tableTag        = HB_OT_TAG_hmtx;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    94
};
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
    95
struct vmtx : hmtxvmtx {
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    96
  static const hb_tag_t tableTag        = HB_OT_TAG_vmtx;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    97
};
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    98
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    99
} /* namespace OT */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   100
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   101
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   102
#endif /* HB_OT_HMTX_TABLE_HH */