src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-normalize.cc
author prr
Wed, 30 May 2018 12:20:00 -0700
changeset 50352 25db2c8f3cf8
parent 48274 51772bf1fb0c
child 50826 f5b95be8b6e2
permissions -rw-r--r--
8199530: Upgrade to harfbuzz 1.7.6 Reviewed-by: srl, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     1
/*
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     2
 * Copyright © 2011,2012  Google, Inc.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     3
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     4
 *  This is part of HarfBuzz, a text shaping library.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     5
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     6
 * Permission is hereby granted, without written agreement and without
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     7
 * license or royalty fees, to use, copy, modify, and distribute this
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     8
 * software and its documentation for any purpose, provided that the
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
     9
 * above copyright notice and the following two paragraphs appear in
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    10
 * all copies of this software.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    11
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    12
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    13
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    14
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    15
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    16
 * DAMAGE.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    17
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    18
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    19
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    20
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    21
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    22
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    23
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    24
 * Google Author(s): Behdad Esfahbod
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    25
 */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    26
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    27
#include "hb-ot-shape-normalize-private.hh"
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    28
#include "hb-ot-shape-complex-private.hh"
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    29
#include "hb-ot-shape-private.hh"
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    30
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    31
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    32
/*
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    33
 * HIGHLEVEL DESIGN:
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    34
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    35
 * This file exports one main function: _hb_ot_shape_normalize().
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    36
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    37
 * This function closely reflects the Unicode Normalization Algorithm,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    38
 * yet it's different.
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
 * Each shaper specifies whether it prefers decomposed (NFD) or composed (NFC).
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    41
 * The logic however tries to use whatever the font can support.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    42
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    43
 * In general what happens is that: each grapheme is decomposed in a chain
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    44
 * of 1:2 decompositions, marks reordered, and then recomposed if desired,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    45
 * so far it's like Unicode Normalization.  However, the decomposition and
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    46
 * recomposition only happens if the font supports the resulting characters.
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
 * The goals are:
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
 *   - Try to render all canonically equivalent strings similarly.  To really
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    51
 *     achieve this we have to always do the full decomposition and then
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    52
 *     selectively recompose from there.  It's kinda too expensive though, so
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    53
 *     we skip some cases.  For example, if composed is desired, we simply
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    54
 *     don't touch 1-character clusters that are supported by the font, even
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    55
 *     though their NFC may be different.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    56
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    57
 *   - When a font has a precomposed character for a sequence but the 'ccmp'
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    58
 *     feature in the font is not adequate, use the precomposed character
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    59
 *     which typically has better mark positioning.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    60
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    61
 *   - When a font does not support a combining mark, but supports it precomposed
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    62
 *     with previous base, use that.  This needs the itemizer to have this
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    63
 *     knowledge too.  We need to provide assistance to the itemizer.
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    64
 *
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    65
 *   - When a font does not support a character but supports its canonical
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    66
 *     decomposition, well, use the decomposition.
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    67
 *
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    68
 *   - The complex shapers can customize the compose and decompose functions to
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    69
 *     offload some of their requirements to the normalizer.  For example, the
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    70
 *     Indic shaper may want to disallow recomposing of two matras.
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
static bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    74
decompose_unicode (const hb_ot_shape_normalize_context_t *c,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    75
                   hb_codepoint_t  ab,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    76
                   hb_codepoint_t *a,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    77
                   hb_codepoint_t *b)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    78
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    79
  return (bool) c->unicode->decompose (ab, a, b);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    80
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    81
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    82
static bool
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    83
compose_unicode (const hb_ot_shape_normalize_context_t *c,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    84
                 hb_codepoint_t  a,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    85
                 hb_codepoint_t  b,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    86
                 hb_codepoint_t *ab)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    87
{
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
    88
  return (bool) c->unicode->compose (a, b, ab);
34414
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
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    91
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    92
set_glyph (hb_glyph_info_t &info, hb_font_t *font)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    93
{
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
    94
  (void) font->get_nominal_glyph (info.codepoint, &info.glyph_index());
34414
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
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    98
output_char (hb_buffer_t *buffer, hb_codepoint_t unichar, hb_codepoint_t glyph)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
    99
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   100
  buffer->cur().glyph_index() = glyph;
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   101
  buffer->output_glyph (unichar); /* This is very confusing indeed. */
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   102
  _hb_glyph_info_set_unicode_props (&buffer->prev(), buffer);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   103
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   104
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   105
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   106
next_char (hb_buffer_t *buffer, hb_codepoint_t glyph)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   107
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   108
  buffer->cur().glyph_index() = glyph;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   109
  buffer->next_glyph ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   110
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   111
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   112
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   113
skip_char (hb_buffer_t *buffer)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   114
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   115
  buffer->skip_glyph ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   116
}
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
/* Returns 0 if didn't decompose, number of resulting characters otherwise. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   119
static inline unsigned int
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   120
decompose (const hb_ot_shape_normalize_context_t *c, bool shortest, hb_codepoint_t ab)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   121
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   122
  hb_codepoint_t a, b, a_glyph, b_glyph;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   123
  hb_buffer_t * const buffer = c->buffer;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   124
  hb_font_t * const font = c->font;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   125
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   126
  if (!c->decompose (c, ab, &a, &b) ||
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   127
      (b && !font->get_nominal_glyph (b, &b_glyph)))
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   128
    return 0;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   129
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   130
  bool has_a = (bool) font->get_nominal_glyph (a, &a_glyph);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   131
  if (shortest && has_a) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   132
    /* Output a and b */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   133
    output_char (buffer, a, a_glyph);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   134
    if (likely (b)) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   135
      output_char (buffer, b, b_glyph);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   136
      return 2;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   137
    }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   138
    return 1;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   139
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   140
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   141
  unsigned int ret;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   142
  if ((ret = decompose (c, shortest, a))) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   143
    if (b) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   144
      output_char (buffer, b, b_glyph);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   145
      return ret + 1;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   146
    }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   147
    return ret;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   148
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   149
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   150
  if (has_a) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   151
    output_char (buffer, a, a_glyph);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   152
    if (likely (b)) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   153
      output_char (buffer, b, b_glyph);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   154
      return 2;
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
    return 1;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   157
  }
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
  return 0;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   160
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   161
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   162
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   163
decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shortest)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   164
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   165
  hb_buffer_t * const buffer = c->buffer;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   166
  hb_codepoint_t u = buffer->cur().codepoint;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   167
  hb_codepoint_t glyph;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   168
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   169
  if (shortest && c->font->get_nominal_glyph (u, &glyph))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   170
  {
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   171
    next_char (buffer, glyph);
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   172
    return;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   173
  }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   174
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   175
  if (decompose (c, shortest, u))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   176
  {
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   177
    skip_char (buffer);
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   178
    return;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   179
  }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   180
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   181
  if (!shortest && c->font->get_nominal_glyph (u, &glyph))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   182
  {
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   183
    next_char (buffer, glyph);
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   184
    return;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   185
  }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   186
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   187
  if (_hb_glyph_info_is_unicode_space (&buffer->cur()))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   188
  {
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   189
    hb_codepoint_t space_glyph;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   190
    hb_unicode_funcs_t::space_t space_type = buffer->unicode->space_fallback_type (u);
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   191
    if (space_type != hb_unicode_funcs_t::NOT_SPACE && c->font->get_nominal_glyph (0x0020u, &space_glyph))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   192
    {
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   193
      _hb_glyph_info_set_unicode_space_fallback_type (&buffer->cur(), space_type);
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   194
      next_char (buffer, space_glyph);
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   195
      buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   196
      return;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   197
    }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   198
  }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   199
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   200
  if (u == 0x2011u)
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   201
  {
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   202
    /* U+2011 is the only sensible character that is a no-break version of another character
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   203
     * and not a space.  The space ones are handled already.  Handle this lone one. */
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   204
    hb_codepoint_t other_glyph;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   205
    if (c->font->get_nominal_glyph (0x2010u, &other_glyph))
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   206
    {
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   207
      next_char (buffer, other_glyph);
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   208
      return;
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   209
    }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   210
  }
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   211
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   212
  next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   213
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   214
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   215
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   216
handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   217
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   218
  /* TODO Currently if there's a variation-selector we give-up, it's just too hard. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   219
  hb_buffer_t * const buffer = c->buffer;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   220
  hb_font_t * const font = c->font;
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   221
  for (; buffer->idx < end - 1 && !buffer->in_error;) {
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   222
    if (unlikely (buffer->unicode->is_variation_selector (buffer->cur(+1).codepoint))) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   223
      /* The next two lines are some ugly lines... But work. */
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   224
      if (font->get_variation_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index()))
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   225
      {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   226
        buffer->replace_glyphs (2, 1, &buffer->cur().codepoint);
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
      else
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   229
      {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   230
        /* Just pass on the two characters separately, let GSUB do its magic. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   231
        set_glyph (buffer->cur(), font);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   232
        buffer->next_glyph ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   233
        set_glyph (buffer->cur(), font);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   234
        buffer->next_glyph ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   235
      }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   236
      /* Skip any further variation selectors. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   237
      while (buffer->idx < end && unlikely (buffer->unicode->is_variation_selector (buffer->cur().codepoint)))
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   238
      {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   239
        set_glyph (buffer->cur(), font);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   240
        buffer->next_glyph ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   241
      }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   242
    } else {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   243
      set_glyph (buffer->cur(), font);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   244
      buffer->next_glyph ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   245
    }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   246
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   247
  if (likely (buffer->idx < end)) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   248
    set_glyph (buffer->cur(), font);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   249
    buffer->next_glyph ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   250
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   251
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   252
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   253
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   254
decompose_multi_char_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   255
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   256
  hb_buffer_t * const buffer = c->buffer;
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   257
  for (unsigned int i = buffer->idx; i < end && !buffer->in_error; i++)
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   258
    if (unlikely (buffer->unicode->is_variation_selector (buffer->info[i].codepoint))) {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   259
      handle_variation_selector_cluster (c, end, short_circuit);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   260
      return;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   261
    }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   262
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   263
  while (buffer->idx < end && !buffer->in_error)
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   264
    decompose_current_character (c, short_circuit);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   265
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   266
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   267
static inline void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   268
decompose_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool might_short_circuit, bool always_short_circuit)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   269
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   270
  if (likely (c->buffer->idx + 1 == end))
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   271
    decompose_current_character (c, might_short_circuit);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   272
  else
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   273
    decompose_multi_char_cluster (c, end, always_short_circuit);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   274
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   275
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   276
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   277
static int
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   278
compare_combining_class (const hb_glyph_info_t *pa, const hb_glyph_info_t *pb)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   279
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   280
  unsigned int a = _hb_glyph_info_get_modified_combining_class (pa);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   281
  unsigned int b = _hb_glyph_info_get_modified_combining_class (pb);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   282
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   283
  return a < b ? -1 : a == b ? 0 : +1;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   284
}
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   285
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   286
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   287
void
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   288
_hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   289
                        hb_buffer_t *buffer,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   290
                        hb_font_t *font)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   291
{
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   292
  if (unlikely (!buffer->len)) return;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   293
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   294
  _hb_buffer_assert_unicode_vars (buffer);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   295
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   296
  hb_ot_shape_normalization_mode_t mode = plan->shaper->normalization_preference;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   297
  const hb_ot_shape_normalize_context_t c = {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   298
    plan,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   299
    buffer,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   300
    font,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   301
    buffer->unicode,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   302
    plan->shaper->decompose ? plan->shaper->decompose : decompose_unicode,
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   303
    plan->shaper->compose   ? plan->shaper->compose   : compose_unicode
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   304
  };
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   305
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   306
  bool always_short_circuit = mode == HB_OT_SHAPE_NORMALIZATION_MODE_NONE;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   307
  bool might_short_circuit = always_short_circuit ||
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   308
                             (mode != HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED &&
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   309
                              mode != HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   310
  unsigned int count;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   311
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   312
  /* We do a fairly straightforward yet custom normalization process in three
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   313
   * separate rounds: decompose, reorder, recompose (if desired).  Currently
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   314
   * this makes two buffer swaps.  We can make it faster by moving the last
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   315
   * two rounds into the inner loop for the first round, but it's more readable
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   316
   * this way. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   317
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   318
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   319
  /* First round, decompose */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   320
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   321
  buffer->clear_output ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   322
  count = buffer->len;
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   323
  for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;)
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   324
  {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   325
    unsigned int end;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   326
    for (end = buffer->idx + 1; end < count; end++)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   327
      if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->info[end]))))
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   328
        break;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   329
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   330
    decompose_cluster (&c, end, might_short_circuit, always_short_circuit);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   331
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   332
  buffer->swap_buffers ();
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
  /* Second round, reorder (inplace) */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   336
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   337
  count = buffer->len;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   338
  for (unsigned int i = 0; i < count; i++)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   339
  {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   340
    if (_hb_glyph_info_get_modified_combining_class (&buffer->info[i]) == 0)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   341
      continue;
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
    unsigned int end;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   344
    for (end = i + 1; end < count; end++)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   345
      if (_hb_glyph_info_get_modified_combining_class (&buffer->info[end]) == 0)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   346
        break;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   347
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   348
    /* We are going to do a O(n^2).  Only do this if the sequence is short. */
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   349
    if (end - i > HB_OT_SHAPE_COMPLEX_MAX_COMBINING_MARKS) {
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   350
      i = end;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   351
      continue;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   352
    }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   353
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   354
    buffer->sort (i, end, compare_combining_class);
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   355
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   356
    if (plan->shaper->reorder_marks)
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   357
      plan->shaper->reorder_marks (plan, buffer, i, end);
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   358
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   359
    i = end;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   360
  }
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
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   363
  if (mode == HB_OT_SHAPE_NORMALIZATION_MODE_NONE ||
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   364
      mode == HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED)
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   365
    return;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   366
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   367
  /* Third round, recompose */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   368
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   369
  /* As noted in the comment earlier, we don't try to combine
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   370
   * ccc=0 chars with their previous Starter. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   371
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   372
  buffer->clear_output ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   373
  count = buffer->len;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   374
  unsigned int starter = 0;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   375
  buffer->next_glyph ();
40435
553eb1a50733 8163238: Upgrade to harfbuzz 1.3.0 in JDK 9
prr
parents: 34414
diff changeset
   376
  while (buffer->idx < count && !buffer->in_error)
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   377
  {
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   378
    hb_codepoint_t composed, glyph;
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   379
    if (/* We don't try to compose a non-mark character with it's preceding starter.
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   380
         * This is both an optimization to avoid trying to compose every two neighboring
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   381
         * glyphs in most scripts AND a desired feature for Hangul.  Apparently Hangul
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   382
         * fonts are not designed to mix-and-match pre-composed syllables and Jamo. */
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   383
        HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->cur())))
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   384
    {
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   385
      if (/* If there's anything between the starter and this char, they should have CCC
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   386
           * smaller than this character's. */
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   387
          (starter == buffer->out_len - 1 ||
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   388
           info_cc (buffer->prev()) < info_cc (buffer->cur())) &&
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   389
          /* And compose. */
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   390
          c.compose (&c,
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   391
                     buffer->out_info[starter].codepoint,
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   392
                     buffer->cur().codepoint,
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   393
                     &composed) &&
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   394
          /* And the font has glyph for the composite. */
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   395
          font->get_nominal_glyph (composed, &glyph))
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   396
      {
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   397
        /* Composes. */
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   398
        buffer->next_glyph (); /* Copy to out-buffer. */
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   399
        if (unlikely (buffer->in_error))
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   400
          return;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   401
        buffer->merge_out_clusters (starter, buffer->out_len);
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   402
        buffer->out_len--; /* Remove the second composable. */
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   403
        /* Modify starter and carry on. */
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   404
        buffer->out_info[starter].codepoint = composed;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   405
        buffer->out_info[starter].glyph_index() = glyph;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   406
        _hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer);
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   407
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   408
        continue;
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   409
      }
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   410
    }
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
    /* Blocked, or doesn't compose. */
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   413
    buffer->next_glyph ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   414
48274
51772bf1fb0c 8188836: Upgrade to Harfbuzz 1.7.1 in JDK 10
prr
parents: 47216
diff changeset
   415
    if (info_cc (buffer->prev()) == 0)
34414
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   416
      starter = buffer->out_len - 1;
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   417
  }
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   418
  buffer->swap_buffers ();
e496a8d8fc8a 8143177: Integrate harfbuzz opentype layout engine per JEP 258
prr
parents:
diff changeset
   419
50352
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   420
  if (buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_CGJ)
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   421
  {
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   422
    /* For all CGJ, check if it prevented any reordering at all.
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   423
     * If it did NOT, then make it skippable.
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   424
     * https://github.com/harfbuzz/harfbuzz/issues/554
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   425
     */
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   426
    for (unsigned int i = 1; i + 1 < buffer->len; i++)
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   427
      if (buffer->info[i].codepoint == 0x034Fu/*CGJ*/ &&
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   428
          info_cc(buffer->info[i-1]) <= info_cc(buffer->info[i+1]))
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   429
      {
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   430
        _hb_glyph_info_unhide (&buffer->info[i]);
25db2c8f3cf8 8199530: Upgrade to harfbuzz 1.7.6
prr
parents: 48274
diff changeset
   431
      }
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
}