src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-kern-table.hh
author jiefu
Fri, 15 Nov 2019 20:39:26 +0800
changeset 59110 8c4c358272a9
parent 54232 7c11a7cc7c1d
permissions -rw-r--r--
8234232: [TESTBUG] gc/shenandoah/jvmti/TestHeapDump.java fails with -Xcomp Reviewed-by: zgu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
     1
/*
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
     2
 * Copyright © 2017  Google, Inc.
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
     3
 *
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
     4
 *  This is part of HarfBuzz, a text shaping library.
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
     5
 *
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
     6
 * Permission is hereby granted, without written agreement and without
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
     7
 * license or royalty fees, to use, copy, modify, and distribute this
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
     8
 * software and its documentation for any purpose, provided that the
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
     9
 * above copyright notice and the following two paragraphs appear in
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    10
 * all copies of this software.
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    11
 *
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    12
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    13
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    14
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    15
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    16
 * DAMAGE.
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    17
 *
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    18
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    19
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    20
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    21
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    22
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    23
 *
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    24
 * Google Author(s): Behdad Esfahbod
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    25
 */
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    26
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    27
#ifndef HB_OT_KERN_TABLE_HH
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    28
#define HB_OT_KERN_TABLE_HH
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    29
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    30
#include "hb-aat-layout-kerx-table.hh"
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    31
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    32
50826
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
    33
/*
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
    34
 * kern -- Kerning
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
    35
 * https://docs.microsoft.com/en-us/typography/opentype/spec/kern
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
    36
 * https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6kern.html
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
    37
 */
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
    38
#define HB_OT_TAG_kern HB_TAG('k','e','r','n')
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    39
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    40
50826
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
    41
namespace OT {
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    42
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    43
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    44
template <typename KernSubTableHeader>
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    45
struct KernSubTableFormat3
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
    46
{
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    47
  int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    48
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    49
    hb_array_t<const FWORD> kernValue = kernValueZ.as_array (kernValueCount);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    50
    hb_array_t<const HBUINT8> leftClass = StructAfter<const UnsizedArrayOf<HBUINT8> > (kernValue).as_array (glyphCount);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    51
    hb_array_t<const HBUINT8> rightClass = StructAfter<const UnsizedArrayOf<HBUINT8> > (leftClass).as_array (glyphCount);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    52
    hb_array_t<const HBUINT8> kernIndex = StructAfter<const UnsizedArrayOf<HBUINT8> > (rightClass).as_array (leftClassCount * rightClassCount);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    53
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    54
    unsigned int leftC = leftClass[left];
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    55
    unsigned int rightC = rightClass[right];
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    56
    if (unlikely (leftC >= leftClassCount || rightC >= rightClassCount))
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    57
      return 0;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    58
    unsigned int i = leftC * rightClassCount + rightC;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    59
    return kernValue[kernIndex[i]];
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    60
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    61
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    62
  bool apply (AAT::hb_aat_apply_context_t *c) const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    63
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    64
    TRACE_APPLY (this);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    65
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    66
    if (!c->plan->requested_kerning)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    67
      return false;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    68
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    69
    if (header.coverage & header.Backwards)
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    70
      return false;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    71
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    72
    hb_kern_machine_t<KernSubTableFormat3> machine (*this, header.coverage & header.CrossStream);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    73
    machine.kern (c->font, c->buffer, c->plan->kern_mask);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    74
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    75
    return_trace (true);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    76
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    77
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    78
  bool sanitize (hb_sanitize_context_t *c) const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    79
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    80
    TRACE_SANITIZE (this);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    81
    return_trace (c->check_struct (this) &&
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    82
                  c->check_range (kernValueZ,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    83
                                  kernValueCount * sizeof (FWORD) +
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    84
                                  glyphCount * 2 +
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    85
                                  leftClassCount * rightClassCount));
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    86
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    87
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    88
  protected:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    89
  KernSubTableHeader    header;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    90
  HBUINT16              glyphCount;     /* The number of glyphs in this font. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    91
  HBUINT8               kernValueCount; /* The number of kerning values. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    92
  HBUINT8               leftClassCount; /* The number of left-hand classes. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    93
  HBUINT8               rightClassCount;/* The number of right-hand classes. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    94
  HBUINT8               flags;          /* Set to zero (reserved for future use). */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    95
  UnsizedArrayOf<FWORD> kernValueZ;     /* The kerning values.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    96
                                         * Length kernValueCount. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    97
#if 0
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    98
  UnsizedArrayOf<HBUINT8>leftClass;     /* The left-hand classes.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
    99
                                         * Length glyphCount. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   100
  UnsizedArrayOf<HBUINT8>rightClass;    /* The right-hand classes.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   101
                                         * Length glyphCount. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   102
  UnsizedArrayOf<HBUINT8>kernIndex;     /* The indices into the kernValue array.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   103
                                         * Length leftClassCount * rightClassCount */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   104
#endif
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   105
  public:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   106
  DEFINE_SIZE_ARRAY (KernSubTableHeader::static_size + 6, kernValueZ);
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   107
};
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   108
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   109
template <typename KernSubTableHeader>
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   110
struct KernSubTable
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   111
{
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   112
  unsigned int get_size () const { return u.header.length; }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   113
  unsigned int get_type () const { return u.header.format; }
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   114
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   115
  int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   116
  {
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   117
    switch (get_type ()) {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   118
    /* This method hooks up to hb_font_t's get_h_kerning.  Only support Format0. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   119
    case 0: return u.format0.get_kerning (left, right);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   120
    default:return 0;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   121
    }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   122
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   123
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   124
  template <typename context_t>
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   125
  typename context_t::return_t dispatch (context_t *c) const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   126
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   127
    unsigned int subtable_type = get_type ();
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   128
    TRACE_DISPATCH (this, subtable_type);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   129
    switch (subtable_type) {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   130
    case 0:     return_trace (c->dispatch (u.format0));
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   131
    case 1:     return_trace (u.header.apple ? c->dispatch (u.format1) : c->default_return_value ());
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   132
    case 2:     return_trace (c->dispatch (u.format2));
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   133
    case 3:     return_trace (u.header.apple ? c->dispatch (u.format3) : c->default_return_value ());
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   134
    default:    return_trace (c->default_return_value ());
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   135
    }
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   136
  }
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   137
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   138
  bool sanitize (hb_sanitize_context_t *c) const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   139
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   140
    TRACE_SANITIZE (this);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   141
    if (unlikely (!u.header.sanitize (c) ||
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   142
                  u.header.length < u.header.min_size ||
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   143
                  !c->check_range (this, u.header.length))) return_trace (false);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   144
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   145
    return_trace (dispatch (c));
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   146
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   147
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   148
  public:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   149
  union {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   150
  KernSubTableHeader                            header;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   151
  AAT::KerxSubTableFormat0<KernSubTableHeader>  format0;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   152
  AAT::KerxSubTableFormat1<KernSubTableHeader>  format1;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   153
  AAT::KerxSubTableFormat2<KernSubTableHeader>  format2;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   154
  KernSubTableFormat3<KernSubTableHeader>       format3;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   155
  } u;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   156
  public:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   157
  DEFINE_SIZE_MIN (KernSubTableHeader::static_size);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   158
};
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   159
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   160
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   161
struct KernOTSubTableHeader
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   162
{
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   163
  static constexpr bool apple = false;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   164
  typedef AAT::ObsoleteTypes Types;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   165
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   166
  unsigned int tuple_count () const { return 0; }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   167
  bool is_horizontal () const { return (coverage & Horizontal); }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   168
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   169
  enum Coverage
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   170
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   171
    Horizontal  = 0x01u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   172
    Minimum     = 0x02u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   173
    CrossStream = 0x04u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   174
    Override    = 0x08u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   175
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   176
    /* Not supported: */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   177
    Backwards   = 0x00u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   178
    Variation   = 0x00u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   179
  };
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   180
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   181
  bool sanitize (hb_sanitize_context_t *c) const
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   182
  {
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   183
    TRACE_SANITIZE (this);
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   184
    return_trace (c->check_struct (this));
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   185
  }
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   186
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   187
  public:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   188
  HBUINT16      versionZ;       /* Unused. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   189
  HBUINT16      length;         /* Length of the subtable (including this header). */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   190
  HBUINT8       format;         /* Subtable format. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   191
  HBUINT8       coverage;       /* Coverage bits. */
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   192
  public:
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   193
  DEFINE_SIZE_STATIC (6);
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   194
};
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   195
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   196
struct KernOT : AAT::KerxTable<KernOT>
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   197
{
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   198
  friend struct AAT::KerxTable<KernOT>;
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   199
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   200
  static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   201
  static constexpr unsigned minVersion = 0u;
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   202
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   203
  typedef KernOTSubTableHeader SubTableHeader;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   204
  typedef SubTableHeader::Types Types;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   205
  typedef KernSubTable<SubTableHeader> SubTable;
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   206
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   207
  protected:
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   208
  HBUINT16      version;        /* Version--0x0000u */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   209
  HBUINT16      tableCount;     /* Number of subtables in the kerning table. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   210
  SubTable      firstSubTable;  /* Subtables. */
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   211
  public:
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   212
  DEFINE_SIZE_MIN (4);
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   213
};
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   214
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   215
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   216
struct KernAATSubTableHeader
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   217
{
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   218
  static constexpr bool apple = true;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   219
  typedef AAT::ObsoleteTypes Types;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   220
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   221
  unsigned int tuple_count () const { return 0; }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   222
  bool is_horizontal () const       { return !(coverage & Vertical); }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   223
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   224
  enum Coverage
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   225
  {
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   226
    Vertical    = 0x80u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   227
    CrossStream = 0x40u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   228
    Variation   = 0x20u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   229
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   230
    /* Not supported: */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   231
    Backwards   = 0x00u,
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   232
  };
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   233
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   234
  bool sanitize (hb_sanitize_context_t *c) const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   235
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   236
    TRACE_SANITIZE (this);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   237
    return_trace (c->check_struct (this));
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   238
  }
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   239
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   240
  public:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   241
  HBUINT32      length;         /* Length of the subtable (including this header). */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   242
  HBUINT8       coverage;       /* Coverage bits. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   243
  HBUINT8       format;         /* Subtable format. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   244
  HBUINT16      tupleIndex;     /* The tuple index (used for variations fonts).
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   245
                               * This value specifies which tuple this subtable covers.
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   246
                               * Note: We don't implement. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   247
  public:
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   248
  DEFINE_SIZE_STATIC (8);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   249
};
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   250
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   251
struct KernAAT : AAT::KerxTable<KernAAT>
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   252
{
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   253
  friend struct AAT::KerxTable<KernAAT>;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   254
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   255
  static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   256
  static constexpr unsigned minVersion = 0x00010000u;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   257
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   258
  typedef KernAATSubTableHeader SubTableHeader;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   259
  typedef SubTableHeader::Types Types;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   260
  typedef KernSubTable<SubTableHeader> SubTable;
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   261
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   262
  protected:
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   263
  HBUINT32      version;        /* Version--0x00010000u */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   264
  HBUINT32      tableCount;     /* Number of subtables in the kerning table. */
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   265
  SubTable      firstSubTable;  /* Subtables. */
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   266
  public:
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   267
  DEFINE_SIZE_MIN (8);
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   268
};
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   269
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   270
struct kern
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   271
{
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   272
  static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   273
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   274
  bool has_data () const { return u.version32; }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   275
  unsigned int get_type () const { return u.major; }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   276
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   277
  bool has_state_machine () const
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   278
  {
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   279
    switch (get_type ()) {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   280
    case 0: return u.ot.has_state_machine ();
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   281
    case 1: return u.aat.has_state_machine ();
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   282
    default:return false;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   283
    }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   284
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   285
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   286
  bool has_cross_stream () const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   287
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   288
    switch (get_type ()) {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   289
    case 0: return u.ot.has_cross_stream ();
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   290
    case 1: return u.aat.has_cross_stream ();
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   291
    default:return false;
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   292
    }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   293
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   294
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   295
  int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   296
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   297
    switch (get_type ()) {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   298
    case 0: return u.ot.get_h_kerning (left, right);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   299
    case 1: return u.aat.get_h_kerning (left, right);
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   300
    default:return 0;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   301
    }
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   302
  }
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   303
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   304
  bool apply (AAT::hb_aat_apply_context_t *c) const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   305
  { return dispatch (c); }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   306
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   307
  template <typename context_t>
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   308
  typename context_t::return_t dispatch (context_t *c) const
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   309
  {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   310
    unsigned int subtable_type = get_type ();
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   311
    TRACE_DISPATCH (this, subtable_type);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   312
    switch (subtable_type) {
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   313
    case 0:     return_trace (c->dispatch (u.ot));
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   314
    case 1:     return_trace (c->dispatch (u.aat));
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   315
    default:    return_trace (c->default_return_value ());
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   316
    }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   317
  }
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   318
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   319
  bool sanitize (hb_sanitize_context_t *c) const
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   320
  {
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   321
    TRACE_SANITIZE (this);
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   322
    if (!u.version32.sanitize (c)) return_trace (false);
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   323
    return_trace (dispatch (c));
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   324
  }
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   325
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   326
  protected:
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   327
  union {
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   328
  HBUINT32              version32;
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   329
  HBUINT16              major;
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   330
  KernOT                ot;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   331
  KernAAT               aat;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   332
  } u;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   333
  public:
54232
7c11a7cc7c1d 8210782: Upgrade HarfBuzz to the latest 2.3.1
prr
parents: 50826
diff changeset
   334
  DEFINE_SIZE_UNION (4, version32);
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   335
};
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   336
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   337
} /* namespace OT */
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   338
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   339
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents:
diff changeset
   340
#endif /* HB_OT_KERN_TABLE_HH */