src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-layout-private.hh
author prr
Thu, 21 Jun 2018 12:54:30 -0700
changeset 50826 f5b95be8b6e2
parent 50352 25db2c8f3cf8
permissions -rw-r--r--
8205441: Upgrade to harfbuzz 1.8.1 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 © 2007,2008,2009  Red Hat, Inc.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     3
 * Copyright © 2012,2013  Google, Inc.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     4
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     5
 *  This is part of HarfBuzz, a text shaping library.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     6
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     7
 * Permission is hereby granted, without written agreement and without
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     8
 * 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
     9
 * software and its documentation for any purpose, provided that the
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    10
 * above copyright notice and the following two paragraphs appear in
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    11
 * all copies of this software.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    12
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    13
 * 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
    14
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    15
 * 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
    16
 * 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
    17
 * DAMAGE.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    18
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    19
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    20
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    21
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    22
 * 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
    23
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    24
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    25
 * Red Hat Author(s): Behdad Esfahbod
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    26
 * Google Author(s): Behdad Esfahbod
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    27
 */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    28
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    29
#ifndef HB_OT_LAYOUT_PRIVATE_HH
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    30
#define HB_OT_LAYOUT_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
#include "hb-private.hh"
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    33
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    34
#include "hb-font-private.hh"
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    35
#include "hb-buffer-private.hh"
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
    36
#include "hb-set-digest-private.hh"
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
    37
#include "hb-open-type-private.hh"
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    38
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
/* Private API corresponding to hb-ot-layout.h: */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    41
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    42
HB_INTERNAL hb_bool_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    43
hb_ot_layout_table_find_feature (hb_face_t    *face,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    44
                                 hb_tag_t      table_tag,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    45
                                 hb_tag_t      feature_tag,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    46
                                 unsigned int *feature_index);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    47
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    48
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    49
/*
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    50
 * GDEF
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
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    53
enum hb_ot_layout_glyph_props_flags_t
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
  /* The following three match LookupFlags::Ignore* numbers. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    56
  HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH   = 0x02u,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    57
  HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE     = 0x04u,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    58
  HB_OT_LAYOUT_GLYPH_PROPS_MARK         = 0x08u,
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
  /* The following are used internally; not derived from GDEF. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    61
  HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED  = 0x10u,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    62
  HB_OT_LAYOUT_GLYPH_PROPS_LIGATED      = 0x20u,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    63
  HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED   = 0x40u,
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
  HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE     = HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED |
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    66
                                          HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    67
                                          HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    68
};
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    69
HB_MARK_AS_FLAG_T (hb_ot_layout_glyph_props_flags_t);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    70
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    71
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    72
/*
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    73
 * GSUB/GPOS
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    74
 */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    75
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    76
HB_INTERNAL hb_bool_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    77
hb_ot_layout_lookup_would_substitute_fast (hb_face_t            *face,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    78
                                           unsigned int          lookup_index,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    79
                                           const hb_codepoint_t *glyphs,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    80
                                           unsigned int          glyphs_length,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    81
                                           hb_bool_t             zero_context);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    82
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    83
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    84
/* Should be called before all the substitute_lookup's are done. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    85
HB_INTERNAL void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    86
hb_ot_layout_substitute_start (hb_font_t    *font,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    87
                               hb_buffer_t  *buffer);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    88
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    89
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    90
struct hb_ot_layout_lookup_accelerator_t;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    91
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    92
namespace OT {
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
    93
  struct hb_ot_apply_context_t;
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    94
  struct SubstLookup;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    95
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    96
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    97
HB_INTERNAL void
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
    98
hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c,
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    99
                                const OT::SubstLookup &lookup,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   100
                                const hb_ot_layout_lookup_accelerator_t &accel);
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
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   103
/* Should be called before all the position_lookup's are done. */
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   104
HB_INTERNAL void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   105
hb_ot_layout_position_start (hb_font_t    *font,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   106
                             hb_buffer_t  *buffer);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   107
50826
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
   108
/* Should be called after all the position_lookup's are done, to fini advances. */
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   109
HB_INTERNAL void
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   110
hb_ot_layout_position_finish_advances (hb_font_t    *font,
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   111
                                       hb_buffer_t  *buffer);
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   112
50826
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
   113
/* Should be called after hb_ot_layout_position_finish_advances, to fini offsets. */
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   114
HB_INTERNAL void
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   115
hb_ot_layout_position_finish_offsets (hb_font_t    *font,
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   116
                                      hb_buffer_t  *buffer);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   117
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   118
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   119
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   120
/*
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   121
 * hb_ot_layout_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   122
 */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   123
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   124
namespace OT {
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   125
  struct BASE;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   126
  struct COLR;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   127
  struct CPAL;
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   128
  struct GDEF;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   129
  struct GSUB;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   130
  struct GPOS;
43232
8e39ad39979f 8171456: Upgrade harfbuzz in JDK 9 to v1.4.1
prr
parents: 40435
diff changeset
   131
  struct MATH;
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   132
  struct fvar;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   133
  struct avar;
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   134
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   135
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   136
namespace AAT {
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   137
  struct ankr;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   138
  struct kerx;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   139
  struct morx;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   140
  struct trak;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   141
}
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   142
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   143
struct hb_ot_layout_lookup_accelerator_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   144
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   145
  template <typename TLookup>
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   146
  inline void init (const TLookup &lookup)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   147
  {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   148
    digest.init ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   149
    lookup.add_coverage (&digest);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   150
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   151
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   152
  inline void fini (void)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   153
  {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   154
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   155
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   156
  inline bool may_have (hb_codepoint_t g) const {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   157
    return digest.may_have (g);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   158
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   159
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   160
  private:
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   161
  hb_set_digest_t digest;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   162
};
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   163
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   164
struct hb_ot_layout_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   165
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   166
  hb_blob_t *gdef_blob;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   167
  hb_blob_t *gsub_blob;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   168
  hb_blob_t *gpos_blob;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   169
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   170
  const struct OT::GDEF *gdef;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   171
  const struct OT::GSUB *gsub;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   172
  const struct OT::GPOS *gpos;
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   173
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   174
  /* TODO Move the following out of this struct. */
50826
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
   175
  OT::hb_table_lazy_loader_t<struct OT::BASE> base;
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
   176
  OT::hb_table_lazy_loader_t<struct OT::MATH> math;
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
   177
  OT::hb_table_lazy_loader_t<struct OT::fvar> fvar;
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
   178
  OT::hb_table_lazy_loader_t<struct OT::avar> avar;
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   179
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   180
  unsigned int gsub_lookup_count;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   181
  unsigned int gpos_lookup_count;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   182
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   183
  hb_ot_layout_lookup_accelerator_t *gsub_accels;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   184
  hb_ot_layout_lookup_accelerator_t *gpos_accels;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   185
};
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   186
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   187
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   188
HB_INTERNAL hb_ot_layout_t *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   189
_hb_ot_layout_create (hb_face_t *face);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   190
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   191
HB_INTERNAL void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   192
_hb_ot_layout_destroy (hb_ot_layout_t *layout);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   193
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   194
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   195
#define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   196
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   197
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   198
/*
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   199
 * Buffer var routines.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   200
 */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   201
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   202
/* buffer var allocations, used during the entire shaping process */
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   203
#define unicode_props()         var2.u16[0]
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   204
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   205
/* buffer var allocations, used during the GSUB/GPOS processing */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   206
#define glyph_props()           var1.u16[0] /* GDEF glyph properties */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   207
#define lig_props()             var1.u8[2] /* GSUB/GPOS ligature tracking */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   208
#define syllable()              var1.u8[3] /* GSUB/GPOS shaping boundaries */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   209
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   210
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   211
/* Loop over syllables. Based on foreach_cluster(). */
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   212
#define foreach_syllable(buffer, start, end) \
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   213
  for (unsigned int \
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   214
       _count = buffer->len, \
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   215
       start = 0, end = _count ? _next_syllable (buffer, 0) : 0; \
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   216
       start < _count; \
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   217
       start = end, end = _next_syllable (buffer, start))
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   218
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   219
static inline unsigned int
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   220
_next_syllable (hb_buffer_t *buffer, unsigned int start)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   221
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   222
  hb_glyph_info_t *info = buffer->info;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   223
  unsigned int count = buffer->len;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   224
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   225
  unsigned int syllable = info[start].syllable();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   226
  while (++start < count && syllable == info[start].syllable())
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   227
    ;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   228
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   229
  return start;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   230
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   231
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   232
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   233
/* unicode_props */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   234
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   235
/* Design:
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   236
 * unicode_props() is a two-byte number.  The low byte includes:
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   237
 * - General_Category: 5 bits.
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   238
 * - A bit each for:
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   239
 *   * Is it Default_Ignorable(); we have a modified Default_Ignorable().
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   240
 *   * Whether it's one of the three Mongolian Free Variation Selectors,
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   241
 *     CGJ, or other characters that are hidden but should not be ignored
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   242
 *     like most other Default_Ignorable()s do during matching.
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   243
 *   * One free bit right now.
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   244
 *
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   245
 * The high-byte has different meanings, switched by the Gen-Cat:
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   246
 * - For Mn,Mc,Me: the modified Combining_Class.
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   247
 * - For Cf: whether it's ZWJ, ZWNJ, or something else.
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   248
 * - For Ws: index of which space character this is, if space fallback
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   249
 *   is needed, ie. we don't set this by default, only if asked to.
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   250
 */
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   251
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   252
enum hb_unicode_props_flags_t {
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   253
  UPROPS_MASK_GEN_CAT   = 0x001Fu,
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   254
  UPROPS_MASK_IGNORABLE = 0x0020u,
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   255
  UPROPS_MASK_HIDDEN    = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..3,
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   256
                                    * or TAG characters */
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   257
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   258
  /* If GEN_CAT=FORMAT, top byte masks: */
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   259
  UPROPS_MASK_Cf_ZWJ    = 0x0100u,
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   260
  UPROPS_MASK_Cf_ZWNJ   = 0x0200u
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   261
};
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   262
HB_MARK_AS_FLAG_T (hb_unicode_props_flags_t);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   263
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   264
static inline void
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   265
_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   266
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   267
  hb_unicode_funcs_t *unicode = buffer->unicode;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   268
  unsigned int u = info->codepoint;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   269
  unsigned int gen_cat = (unsigned int) unicode->general_category (u);
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   270
  unsigned int props = gen_cat;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   271
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   272
  if (u >= 0x80)
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   273
  {
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   274
    buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   275
    if (unlikely (unicode->is_default_ignorable (u)))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   276
    {
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   277
      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   278
      props |=  UPROPS_MASK_IGNORABLE;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   279
      if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ;
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   280
      else if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ;
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   281
      /* Mongolian Free Variation Selectors need to be remembered
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   282
       * because although we need to hide them like default-ignorables,
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   283
       * they need to non-ignorable during shaping.  This is similar to
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   284
       * what we do for joiners in Indic-like shapers, but since the
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   285
       * FVSes are GC=Mn, we have use a separate bit to remember them.
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   286
       * Fixes:
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   287
       * https://github.com/harfbuzz/harfbuzz/issues/234 */
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   288
      else if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_HIDDEN;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   289
      /* TAG characters need similar treatment. Fixes:
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   290
       * https://github.com/harfbuzz/harfbuzz/issues/463 */
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   291
      else if (unlikely (hb_in_range (u, 0xE0020u, 0xE007Fu))) props |= UPROPS_MASK_HIDDEN;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   292
      /* COMBINING GRAPHEME JOINER should not be skipped; at least some times.
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   293
       * https://github.com/harfbuzz/harfbuzz/issues/554 */
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   294
      else if (unlikely (u == 0x034Fu))
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   295
      {
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   296
        buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_CGJ;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   297
        props |= UPROPS_MASK_HIDDEN;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   298
      }
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   299
    }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   300
    else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat)))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   301
    {
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   302
      /* The above check is just an optimization to let in only things we need further
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   303
       * processing on. */
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   304
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   305
      /* Only Mn and Mc can have non-zero ccc:
50826
f5b95be8b6e2 8205441: Upgrade to harfbuzz 1.8.1
prr
parents: 50352
diff changeset
   306
       * https://unicode.org/policies/stability_policy.html#Property_Value
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   307
       * """
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   308
       * Canonical_Combining_Class, General_Category
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   309
       * All characters other than those with General_Category property values
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   310
       * Spacing_Mark (Mc) and Nonspacing_Mark (Mn) have the Canonical_Combining_Class
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   311
       * property value 0.
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   312
       * 1.1.5+
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   313
       * """
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   314
       *
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   315
       * Also, all Mn's that are Default_Ignorable, have ccc=0, hence
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   316
       * the "else if".
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   317
       */
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   318
      props |= unicode->modified_combining_class (info->codepoint)<<8;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   319
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   320
      /* Recategorize emoji skin-tone modifiers as Unicode mark, so they
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   321
       * behave correctly in non-native directionality.  They originally
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   322
       * are MODIFIER_SYMBOL.  Fixes:
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   323
       * https://github.com/harfbuzz/harfbuzz/issues/169
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   324
       */
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   325
      if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu)))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   326
      {
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   327
        props = gen_cat = HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   328
      }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   329
    }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   330
  }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   331
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   332
  info->unicode_props() = props;
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   333
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   334
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   335
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   336
_hb_glyph_info_set_general_category (hb_glyph_info_t *info,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   337
                                     hb_unicode_general_category_t gen_cat)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   338
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   339
  /* Clears top-byte. */
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   340
  info->unicode_props() = (unsigned int) gen_cat | (info->unicode_props() & (0xFF & ~UPROPS_MASK_GEN_CAT));
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   341
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   342
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   343
static inline hb_unicode_general_category_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   344
_hb_glyph_info_get_general_category (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   345
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   346
  return (hb_unicode_general_category_t) (info->unicode_props() & UPROPS_MASK_GEN_CAT);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   347
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   348
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   349
static inline bool
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   350
_hb_glyph_info_is_unicode_mark (const hb_glyph_info_t *info)
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   351
{
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   352
  return HB_UNICODE_GENERAL_CATEGORY_IS_MARK (info->unicode_props() & UPROPS_MASK_GEN_CAT);
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   353
}
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   354
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   355
_hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   356
                                             unsigned int modified_class)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   357
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   358
  if (unlikely (!_hb_glyph_info_is_unicode_mark (info)))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   359
    return;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   360
  info->unicode_props() = (modified_class<<8) | (info->unicode_props() & 0xFF);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   361
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   362
static inline unsigned int
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   363
_hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   364
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   365
  return _hb_glyph_info_is_unicode_mark (info) ? info->unicode_props()>>8 : 0;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   366
}
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   367
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   368
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   369
/* Loop over grapheme. Based on foreach_cluster(). */
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   370
#define foreach_grapheme(buffer, start, end) \
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   371
  for (unsigned int \
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   372
       _count = buffer->len, \
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   373
       start = 0, end = _count ? _next_grapheme (buffer, 0) : 0; \
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   374
       start < _count; \
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   375
       start = end, end = _next_grapheme (buffer, start))
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   376
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   377
static inline unsigned int
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   378
_next_grapheme (hb_buffer_t *buffer, unsigned int start)
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   379
{
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   380
  hb_glyph_info_t *info = buffer->info;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   381
  unsigned int count = buffer->len;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   382
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   383
  while (++start < count && _hb_glyph_info_is_unicode_mark (&info[start]))
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   384
    ;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   385
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   386
  return start;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   387
}
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   388
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   389
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   390
#define info_cc(info) (_hb_glyph_info_get_modified_combining_class (&(info)))
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   391
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   392
static inline bool
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   393
_hb_glyph_info_is_unicode_space (const hb_glyph_info_t *info)
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   394
{
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   395
  return _hb_glyph_info_get_general_category (info) ==
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   396
         HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   397
}
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   398
static inline void
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   399
_hb_glyph_info_set_unicode_space_fallback_type (hb_glyph_info_t *info, hb_unicode_funcs_t::space_t s)
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   400
{
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   401
  if (unlikely (!_hb_glyph_info_is_unicode_space (info)))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   402
    return;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   403
  info->unicode_props() = (((unsigned int) s)<<8) | (info->unicode_props() & 0xFF);
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   404
}
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   405
static inline hb_unicode_funcs_t::space_t
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   406
_hb_glyph_info_get_unicode_space_fallback_type (const hb_glyph_info_t *info)
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   407
{
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   408
  return _hb_glyph_info_is_unicode_space (info) ?
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   409
         (hb_unicode_funcs_t::space_t) (info->unicode_props()>>8) :
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   410
         hb_unicode_funcs_t::NOT_SPACE;
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   411
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   412
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   413
static inline bool _hb_glyph_info_ligated (const hb_glyph_info_t *info);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   415
static inline hb_bool_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   416
_hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   417
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   418
  return (info->unicode_props() & UPROPS_MASK_IGNORABLE) &&
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   419
         !_hb_glyph_info_ligated (info);
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   420
}
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   421
static inline hb_bool_t
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   422
_hb_glyph_info_is_default_ignorable_and_not_hidden (const hb_glyph_info_t *info)
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   423
{
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   424
  return ((info->unicode_props() & (UPROPS_MASK_IGNORABLE|UPROPS_MASK_HIDDEN))
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   425
          == UPROPS_MASK_IGNORABLE) &&
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   426
         !_hb_glyph_info_ligated (info);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   427
}
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   428
static inline void
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   429
_hb_glyph_info_unhide (hb_glyph_info_t *info)
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   430
{
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   431
  info->unicode_props() &= ~ UPROPS_MASK_HIDDEN;
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   432
}
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   433
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   434
static inline bool
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   435
_hb_glyph_info_is_unicode_format (const hb_glyph_info_t *info)
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   436
{
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   437
  return _hb_glyph_info_get_general_category (info) ==
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   438
         HB_UNICODE_GENERAL_CATEGORY_FORMAT;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   439
}
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   440
static inline hb_bool_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   441
_hb_glyph_info_is_zwnj (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   442
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   443
  return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWNJ);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   444
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   445
static inline hb_bool_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   446
_hb_glyph_info_is_zwj (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   447
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   448
  return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWJ);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   449
}
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   450
static inline hb_bool_t
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   451
_hb_glyph_info_is_joiner (const hb_glyph_info_t *info)
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   452
{
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   453
  return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & (UPROPS_MASK_Cf_ZWNJ|UPROPS_MASK_Cf_ZWJ));
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   454
}
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   455
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   456
_hb_glyph_info_flip_joiners (hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   457
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   458
  if (!_hb_glyph_info_is_unicode_format (info))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   459
    return;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   460
  info->unicode_props() ^= UPROPS_MASK_Cf_ZWNJ | UPROPS_MASK_Cf_ZWJ;
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   461
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   462
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   463
/* lig_props: aka lig_id / lig_comp
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   464
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   465
 * When a ligature is formed:
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   466
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   467
 *   - The ligature glyph and any marks in between all the same newly allocated
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   468
 *     lig_id,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   469
 *   - The ligature glyph will get lig_num_comps set to the number of components
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   470
 *   - The marks get lig_comp > 0, reflecting which component of the ligature
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   471
 *     they were applied to.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   472
 *   - This is used in GPOS to attach marks to the right component of a ligature
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   473
 *     in MarkLigPos,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   474
 *   - Note that when marks are ligated together, much of the above is skipped
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   475
 *     and the current lig_id reused.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   476
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   477
 * When a multiple-substitution is done:
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   478
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   479
 *   - All resulting glyphs will have lig_id = 0,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   480
 *   - The resulting glyphs will have lig_comp = 0, 1, 2, ... respectively.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   481
 *   - This is used in GPOS to attach marks to the first component of a
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   482
 *     multiple substitution in MarkBasePos.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   483
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   484
 * The numbers are also used in GPOS to do mark-to-mark positioning only
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   485
 * to marks that belong to the same component of the same ligature.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   486
 */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   487
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   488
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   489
_hb_glyph_info_clear_lig_props (hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   490
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   491
  info->lig_props() = 0;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   492
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   493
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   494
#define IS_LIG_BASE 0x10
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   495
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   496
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   497
_hb_glyph_info_set_lig_props_for_ligature (hb_glyph_info_t *info,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   498
                                           unsigned int lig_id,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   499
                                           unsigned int lig_num_comps)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   500
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   501
  info->lig_props() = (lig_id << 5) | IS_LIG_BASE | (lig_num_comps & 0x0F);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   502
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   503
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   504
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   505
_hb_glyph_info_set_lig_props_for_mark (hb_glyph_info_t *info,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   506
                                       unsigned int lig_id,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   507
                                       unsigned int lig_comp)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   508
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   509
  info->lig_props() = (lig_id << 5) | (lig_comp & 0x0F);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   510
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   511
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   512
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   513
_hb_glyph_info_set_lig_props_for_component (hb_glyph_info_t *info, unsigned int comp)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   514
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   515
  _hb_glyph_info_set_lig_props_for_mark (info, 0, comp);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   516
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   517
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   518
static inline unsigned int
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   519
_hb_glyph_info_get_lig_id (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   520
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   521
  return info->lig_props() >> 5;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   522
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   523
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   524
static inline bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   525
_hb_glyph_info_ligated_internal (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   526
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   527
  return !!(info->lig_props() & IS_LIG_BASE);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   528
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   529
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   530
static inline unsigned int
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   531
_hb_glyph_info_get_lig_comp (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   532
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   533
  if (_hb_glyph_info_ligated_internal (info))
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   534
    return 0;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   535
  else
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   536
    return info->lig_props() & 0x0F;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   537
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   538
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   539
static inline unsigned int
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   540
_hb_glyph_info_get_lig_num_comps (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   541
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   542
  if ((info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE) &&
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   543
      _hb_glyph_info_ligated_internal (info))
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   544
    return info->lig_props() & 0x0F;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   545
  else
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   546
    return 1;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   547
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   548
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   549
static inline uint8_t
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   550
_hb_allocate_lig_id (hb_buffer_t *buffer) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   551
  uint8_t lig_id = buffer->next_serial () & 0x07;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   552
  if (unlikely (!lig_id))
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   553
    lig_id = _hb_allocate_lig_id (buffer); /* in case of overflow */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   554
  return lig_id;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   555
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   556
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   557
/* glyph_props: */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   558
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   559
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   560
_hb_glyph_info_set_glyph_props (hb_glyph_info_t *info, unsigned int props)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   561
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   562
  info->glyph_props() = props;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   563
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   564
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   565
static inline unsigned int
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   566
_hb_glyph_info_get_glyph_props (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   567
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   568
  return info->glyph_props();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   569
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   570
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   571
static inline bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   572
_hb_glyph_info_is_base_glyph (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   573
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   574
  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   575
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   576
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   577
static inline bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   578
_hb_glyph_info_is_ligature (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   579
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   580
  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   581
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   582
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   583
static inline bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   584
_hb_glyph_info_is_mark (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   585
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   586
  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   587
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   588
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   589
static inline bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   590
_hb_glyph_info_substituted (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   591
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   592
  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   593
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   594
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   595
static inline bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   596
_hb_glyph_info_ligated (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   597
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   598
  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATED);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   599
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   600
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   601
static inline bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   602
_hb_glyph_info_multiplied (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   603
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   604
  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   605
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   606
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   607
static inline bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   608
_hb_glyph_info_ligated_and_didnt_multiply (const hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   609
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   610
  return _hb_glyph_info_ligated (info) && !_hb_glyph_info_multiplied (info);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   611
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   612
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   613
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   614
_hb_glyph_info_clear_ligated_and_multiplied (hb_glyph_info_t *info)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   615
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   616
  info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   617
                           HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   618
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   619
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   620
static inline void
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   621
_hb_glyph_info_clear_substituted (hb_glyph_info_t *info)
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   622
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   623
  info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   624
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   625
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   626
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   627
/* Allocation / deallocation. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   628
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   629
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   630
_hb_buffer_allocate_unicode_vars (hb_buffer_t *buffer)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   631
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   632
  HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   633
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   634
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   635
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   636
_hb_buffer_deallocate_unicode_vars (hb_buffer_t *buffer)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   637
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   638
  HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   639
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   640
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   641
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   642
_hb_buffer_assert_unicode_vars (hb_buffer_t *buffer)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   643
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   644
  HB_BUFFER_ASSERT_VAR (buffer, unicode_props);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   645
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   646
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   647
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   648
_hb_buffer_allocate_gsubgpos_vars (hb_buffer_t *buffer)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   649
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   650
  HB_BUFFER_ALLOCATE_VAR (buffer, glyph_props);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   651
  HB_BUFFER_ALLOCATE_VAR (buffer, lig_props);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   652
  HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   653
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   654
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   655
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   656
_hb_buffer_deallocate_gsubgpos_vars (hb_buffer_t *buffer)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   657
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   658
  HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   659
  HB_BUFFER_DEALLOCATE_VAR (buffer, lig_props);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   660
  HB_BUFFER_DEALLOCATE_VAR (buffer, glyph_props);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   661
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   662
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   663
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   664
_hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   665
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   666
  HB_BUFFER_ASSERT_VAR (buffer, glyph_props);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   667
  HB_BUFFER_ASSERT_VAR (buffer, lig_props);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   668
  HB_BUFFER_ASSERT_VAR (buffer, syllable);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   669
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   670
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   671
/* Make sure no one directly touches our props... */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   672
#undef unicode_props0
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   673
#undef unicode_props1
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   674
#undef lig_props
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   675
#undef glyph_props
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   676
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   677
#endif /* HB_OT_LAYOUT_PRIVATE_HH */