Skip to content
Permalink
Browse files
8261169: Upgrade HarfBuzz to the latest 2.8.0
Reviewed-by: serb
  • Loading branch information
Phil Race committed May 4, 2021
1 parent 9c4efdd commit 80323b7f66541e24177d02cc668a2eb9267962b9
Showing with 9,624 additions and 5,360 deletions.
  1. +1 −1 make/modules/java.desktop/lib/Awt2dLibraries.gmk
  2. +1 −1 src/java.desktop/share/legal/harfbuzz.md
  3. +80 −35 src/java.desktop/share/native/libharfbuzz/hb-aat-layout-common.hh
  4. +15 −17 src/java.desktop/share/native/libharfbuzz/hb-aat-layout-morx-table.hh
  5. +67 −26 src/java.desktop/share/native/libharfbuzz/hb-aat-layout.cc
  6. +312 −3 src/java.desktop/share/native/libharfbuzz/hb-aat-layout.h
  7. +172 −15 src/java.desktop/share/native/libharfbuzz/hb-algs.hh
  8. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-array.hh
  9. +11 −118 src/java.desktop/share/native/libharfbuzz/hb-atomic.hh
  10. +38 −37 src/java.desktop/share/native/libharfbuzz/hb-blob.cc
  11. +29 −10 src/java.desktop/share/native/libharfbuzz/hb-blob.h
  12. +1 −0 src/java.desktop/share/native/libharfbuzz/hb-blob.hh
  13. +544 −580 src/java.desktop/share/native/libharfbuzz/hb-buffer-deserialize-json.hh
  14. +696 −503 src/java.desktop/share/native/libharfbuzz/hb-buffer-deserialize-text.hh
  15. +433 −38 src/java.desktop/share/native/libharfbuzz/hb-buffer-serialize.cc
  16. +184 −185 src/java.desktop/share/native/libharfbuzz/hb-buffer.cc
  17. +108 −3 src/java.desktop/share/native/libharfbuzz/hb-buffer.h
  18. +85 −49 src/java.desktop/share/native/libharfbuzz/hb-buffer.hh
  19. +93 −41 src/java.desktop/share/native/libharfbuzz/hb-common.cc
  20. +532 −184 src/java.desktop/share/native/libharfbuzz/hb-common.h
  21. +10 −8 src/java.desktop/share/native/libharfbuzz/hb-coretext.cc
  22. +76 −17 src/java.desktop/share/native/libharfbuzz/hb-deprecated.h
  23. +1 −2 src/java.desktop/share/native/libharfbuzz/hb-dispatch.hh
  24. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-draw.h
  25. +107 −74 src/java.desktop/share/native/libharfbuzz/hb-face.cc
  26. +20 −1 src/java.desktop/share/native/libharfbuzz/hb-face.h
  27. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-face.hh
  28. +695 −507 src/java.desktop/share/native/libharfbuzz/hb-font.cc
  29. +424 −96 src/java.desktop/share/native/libharfbuzz/hb-font.h
  30. +19 −19 src/java.desktop/share/native/libharfbuzz/hb-ft.cc
  31. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-iter.hh
  32. +5 −0 src/java.desktop/share/native/libharfbuzz/hb-machinery.hh
  33. +57 −33 src/java.desktop/share/native/libharfbuzz/hb-map.cc
  34. +12 −2 src/java.desktop/share/native/libharfbuzz/hb-map.h
  35. +1 −4 src/java.desktop/share/native/libharfbuzz/hb-map.hh
  36. +15 −0 src/java.desktop/share/native/libharfbuzz/hb-meta.hh
  37. +0 −18 src/java.desktop/share/native/libharfbuzz/hb-mutex.hh
  38. +1 −0 src/java.desktop/share/native/libharfbuzz/hb-null.hh
  39. +5 −12 src/java.desktop/share/native/libharfbuzz/hb-object.hh
  40. +3 −3 src/java.desktop/share/native/libharfbuzz/hb-open-file.hh
  41. +29 −19 src/java.desktop/share/native/libharfbuzz/hb-open-type.hh
  42. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-cff-common.hh
  43. +2 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.cc
  44. +2 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.cc
  45. +4 −4 src/java.desktop/share/native/libharfbuzz/hb-ot-cmap-table.hh
  46. +4 −4 src/java.desktop/share/native/libharfbuzz/hb-ot-color-cbdt-table.hh
  47. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-color-colr-table.hh
  48. +4 −7 src/java.desktop/share/native/libharfbuzz/hb-ot-color.cc
  49. +6 −3 src/java.desktop/share/native/libharfbuzz/hb-ot-color.h
  50. +18 −3 src/java.desktop/share/native/libharfbuzz/hb-ot-deprecated.h
  51. +3 −0 src/java.desktop/share/native/libharfbuzz/hb-ot-font.cc
  52. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-font.h
  53. +3 −3 src/java.desktop/share/native/libharfbuzz/hb-ot-glyf-table.hh
  54. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-head-table.hh
  55. +15 −3 src/java.desktop/share/native/libharfbuzz/hb-ot-layout-base-table.hh
  56. +37 −19 src/java.desktop/share/native/libharfbuzz/hb-ot-layout-common.hh
  57. +110 −14 src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gpos-table.hh
  58. +6 −6 src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsub-table.hh
  59. +183 −73 src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsubgpos.hh
  60. +74 −61 src/java.desktop/share/native/libharfbuzz/hb-ot-layout.cc
  61. +64 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-layout.h
  62. +2 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-layout.hh
  63. +2 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-map.hh
  64. +2 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-math.cc
  65. +81 −4 src/java.desktop/share/native/libharfbuzz/hb-ot-math.h
  66. +3 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-meta.cc
  67. +2 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-meta.h
  68. +29 −11 src/java.desktop/share/native/libharfbuzz/hb-ot-metrics.cc
  69. +4 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-metrics.h
  70. +4 −4 src/java.desktop/share/native/libharfbuzz/hb-ot-name.cc
  71. +2 −3 src/java.desktop/share/native/libharfbuzz/hb-ot-name.h
  72. +1 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-os2-table.hh
  73. +0 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-post-table.hh
  74. +2 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-arabic-win1256.hh
  75. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-arabic.cc
  76. +22 −25 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-hangul.cc
  77. +70 −41 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-indic-machine.hh
  78. +2 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-indic-table.cc
  79. +40 −82 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-indic.cc
  80. +8 −14 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-indic.hh
  81. +362 −279 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-khmer-machine.hh
  82. +12 −100 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-khmer.cc
  83. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-khmer.hh
  84. +62 −27 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-myanmar-machine.hh
  85. +11 −78 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-myanmar.cc
  86. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-myanmar.hh
  87. +100 −0 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-syllabic.cc
  88. +41 −0 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-syllabic.hh
  89. +7 −8 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-thai.cc
  90. +651 −484 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-use-machine.hh
  91. +464 −134 ...op/share/native/libharfbuzz/{hb-ot-shape-complex-use-table.cc → hb-ot-shape-complex-use-table.hh}
  92. +47 −114 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-use.cc
  93. +0 −105 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-use.hh
  94. +21 −42 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex-vowel-constraints.cc
  95. +20 −31 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-complex.hh
  96. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-fallback.cc
  97. +26 −20 src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.cc
  98. +24 −5 src/java.desktop/share/native/libharfbuzz/hb-ot-shape.cc
  99. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-ot-shape.h
  100. +1,092 −335 src/java.desktop/share/native/libharfbuzz/hb-ot-tag-table.hh
  101. +21 −9 src/java.desktop/share/native/libharfbuzz/hb-ot-tag.cc
  102. +2 −2 src/java.desktop/share/native/libharfbuzz/hb-ot-var-gvar-table.hh
  103. +110 −5 src/java.desktop/share/native/libharfbuzz/hb-ot-var.cc
  104. +49 −4 src/java.desktop/share/native/libharfbuzz/hb-ot-var.h
  105. +4 −4 src/java.desktop/share/native/libharfbuzz/hb-sanitize.hh
  106. +6 −5 src/java.desktop/share/native/libharfbuzz/hb-serialize.hh
  107. +124 −98 src/java.desktop/share/native/libharfbuzz/hb-set.cc
  108. +15 −2 src/java.desktop/share/native/libharfbuzz/hb-set.h
  109. +59 −28 src/java.desktop/share/native/libharfbuzz/hb-set.hh
  110. +126 −60 src/java.desktop/share/native/libharfbuzz/hb-shape-plan.cc
  111. +15 −1 src/java.desktop/share/native/libharfbuzz/hb-shape-plan.h
  112. +3 −7 src/java.desktop/share/native/libharfbuzz/hb-shape.cc
  113. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-shape.h
  114. +1 −0 src/java.desktop/share/native/libharfbuzz/hb-style.cc
  115. +1 −1 src/java.desktop/share/native/libharfbuzz/hb-style.h
  116. +22 −5 src/java.desktop/share/native/libharfbuzz/hb-subset-plan.cc
  117. +9 −6 src/java.desktop/share/native/libharfbuzz/hb-subset-plan.hh
  118. +77 −48 src/java.desktop/share/native/libharfbuzz/hb-unicode.cc
  119. +280 −41 src/java.desktop/share/native/libharfbuzz/hb-unicode.h
  120. +8 −3 src/java.desktop/share/native/libharfbuzz/hb-vector.hh
  121. +33 −4 src/java.desktop/share/native/libharfbuzz/hb-version.h
  122. +12 −184 src/java.desktop/share/native/libharfbuzz/hb.hh
@@ -465,7 +465,7 @@ else

HARFBUZZ_DISABLED_WARNINGS_gcc := type-limits missing-field-initializers strict-aliasing
HARFBUZZ_DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \
maybe-uninitialized class-memaccess
maybe-uninitialized class-memaccess unused-result
HARFBUZZ_DISABLED_WARNINGS_clang := unused-value incompatible-pointer-types \
tautological-constant-out-of-range-compare int-to-pointer-cast \
undef missing-field-initializers range-loop-analysis \
@@ -1,4 +1,4 @@
## Harfbuzz v2.7.2
## Harfbuzz v2.8

### Harfbuzz License

@@ -510,7 +510,7 @@ struct StateTable
const Entry<Extra> &get_entry (int state, unsigned int klass) const
{
if (unlikely (klass >= nClasses))
klass = StateTable<Types, Entry<Extra>>::CLASS_OUT_OF_BOUNDS;
klass = StateTable::CLASS_OUT_OF_BOUNDS;

const HBUSHORT *states = (this+stateArrayTable).arrayZ;
const Entry<Extra> *entries = (this+entryTable).arrayZ;
@@ -576,7 +576,7 @@ struct StateTable
if (unlikely (stop > states))
return_trace (false);
for (const HBUSHORT *p = states; stop < p; p--)
num_entries = hb_max (num_entries, *(p - 1) + 1);
num_entries = hb_max (num_entries, *(p - 1) + 1u);
state_neg = min_state;
}
}
@@ -597,7 +597,7 @@ struct StateTable
if (unlikely (stop < states))
return_trace (false);
for (const HBUSHORT *p = &states[state_pos * num_classes]; p < stop; p++)
num_entries = hb_max (num_entries, *p + 1);
num_entries = hb_max (num_entries, *p + 1u);
state_pos = max_state + 1;
}
}
@@ -729,7 +729,10 @@ struct ExtendedTypes
template <typename Types, typename EntryData>
struct StateTableDriver
{
StateTableDriver (const StateTable<Types, EntryData> &machine_,
using StateTableT = StateTable<Types, EntryData>;
using EntryT = Entry<EntryData>;

StateTableDriver (const StateTableT &machine_,
hb_buffer_t *buffer_,
hb_face_t *face_) :
machine (machine_),
@@ -742,59 +745,101 @@ struct StateTableDriver
if (!c->in_place)
buffer->clear_output ();

int state = StateTable<Types, EntryData>::STATE_START_OF_TEXT;
int state = StateTableT::STATE_START_OF_TEXT;
for (buffer->idx = 0; buffer->successful;)
{
unsigned int klass = buffer->idx < buffer->len ?
machine.get_class (buffer->info[buffer->idx].codepoint, num_glyphs) :
(unsigned) StateTable<Types, EntryData>::CLASS_END_OF_TEXT;
(unsigned) StateTableT::CLASS_END_OF_TEXT;
DEBUG_MSG (APPLY, nullptr, "c%u at %u", klass, buffer->idx);
const Entry<EntryData> &entry = machine.get_entry (state, klass);
const EntryT &entry = machine.get_entry (state, klass);
const int next_state = machine.new_state (entry.newState);

/* Unsafe-to-break before this if not in state 0, as things might
* go differently if we start from state 0 here.
/* Conditions under which it's guaranteed safe-to-break before current glyph:
*
* Ugh. The indexing here is ugly... */
if (state && buffer->backtrack_len () && buffer->idx < buffer->len)
{
/* If there's no action and we're just epsilon-transitioning to state 0,
* safe to break. */
if (c->is_actionable (this, entry) ||
!(entry.newState == StateTable<Types, EntryData>::STATE_START_OF_TEXT &&
entry.flags == context_t::DontAdvance))
buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1);
}

/* Unsafe-to-break if end-of-text would kick in here. */
if (buffer->idx + 2 <= buffer->len)
{
const Entry<EntryData> &end_entry = machine.get_entry (state, StateTable<Types, EntryData>::CLASS_END_OF_TEXT);
if (c->is_actionable (this, end_entry))
buffer->unsafe_to_break (buffer->idx, buffer->idx + 2);
}
* 1. There was no action in this transition; and
*
* 2. If we break before current glyph, the results will be the same. That
* is guaranteed if:
*
* 2a. We were already in start-of-text state; or
*
* 2b. We are epsilon-transitioning to start-of-text state; or
*
* 2c. Starting from start-of-text state seeing current glyph:
*
* 2c'. There won't be any actions; and
*
* 2c". We would end up in the same state that we were going to end up
* in now, including whether epsilon-transitioning.
*
* and
*
* 3. If we break before current glyph, there won't be any end-of-text action
* after previous glyph.
*
* This triples the transitions we need to look up, but is worth returning
* granular unsafe-to-break results. See eg.:
*
* https://github.com/harfbuzz/harfbuzz/issues/2860
*/
const EntryT *wouldbe_entry;
bool safe_to_break =
/* 1. */
!c->is_actionable (this, entry)
&&
/* 2. */
(
/* 2a. */
state == StateTableT::STATE_START_OF_TEXT
||
/* 2b. */
(
(entry.flags & context_t::DontAdvance) &&
next_state == StateTableT::STATE_START_OF_TEXT
)
||
/* 2c. */
(
wouldbe_entry = &machine.get_entry (StateTableT::STATE_START_OF_TEXT, klass)
,
/* 2c'. */
!c->is_actionable (this, *wouldbe_entry)
&&
/* 2c". */
(
next_state == machine.new_state (wouldbe_entry->newState)
&&
(entry.flags & context_t::DontAdvance) == (wouldbe_entry->flags & context_t::DontAdvance)
)
)
)
&&
/* 3. */
!c->is_actionable (this, machine.get_entry (state, StateTableT::CLASS_END_OF_TEXT))
;

if (!safe_to_break && buffer->backtrack_len () && buffer->idx < buffer->len)
buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1);

c->transition (this, entry);

state = machine.new_state (entry.newState);
state = next_state;
DEBUG_MSG (APPLY, nullptr, "s%d", state);

if (buffer->idx == buffer->len)
if (buffer->idx == buffer->len || unlikely (!buffer->successful))
break;

if (!(entry.flags & context_t::DontAdvance) || buffer->max_ops-- <= 0)
buffer->next_glyph ();
(void) buffer->next_glyph ();
}

if (!c->in_place)
{
for (; buffer->successful && buffer->idx < buffer->len;)
buffer->next_glyph ();
buffer->swap_buffers ();
}
}

public:
const StateTable<Types, EntryData> &machine;
const StateTableT &machine;
hb_buffer_t *buffer;
unsigned int num_glyphs;
};
@@ -337,9 +337,9 @@ struct ContextualSubtable
const EntryData &data = entries[i].data;

if (data.markIndex != 0xFFFF)
num_lookups = hb_max (num_lookups, 1 + data.markIndex);
num_lookups = hb_max (num_lookups, 1u + data.markIndex);
if (data.currentIndex != 0xFFFF)
num_lookups = hb_max (num_lookups, 1 + data.currentIndex);
num_lookups = hb_max (num_lookups, 1u + data.currentIndex);
}

return_trace (substitutionTables.sanitize (c, this, num_lookups));
@@ -499,7 +499,7 @@ struct LigatureSubtable
}

DEBUG_MSG (APPLY, nullptr, "Moving to stack position %u", cursor - 1);
buffer->move_to (match_positions[--cursor % ARRAY_LENGTH (match_positions)]);
if (unlikely (!buffer->move_to (match_positions[--cursor % ARRAY_LENGTH (match_positions)]))) return;

if (unlikely (!actionData->sanitize (&c->sanitizer))) break;
action = *actionData;
@@ -525,25 +525,25 @@ struct LigatureSubtable
hb_codepoint_t lig = ligatureData;

DEBUG_MSG (APPLY, nullptr, "Produced ligature %u", lig);
buffer->replace_glyph (lig);
if (unlikely (!buffer->replace_glyph (lig))) return;

unsigned int lig_end = match_positions[(match_length - 1u) % ARRAY_LENGTH (match_positions)] + 1u;
/* Now go and delete all subsequent components. */
while (match_length - 1u > cursor)
{
DEBUG_MSG (APPLY, nullptr, "Skipping ligature component");
buffer->move_to (match_positions[--match_length % ARRAY_LENGTH (match_positions)]);
buffer->replace_glyph (DELETED_GLYPH);
if (unlikely (!buffer->move_to (match_positions[--match_length % ARRAY_LENGTH (match_positions)]))) return;
if (unlikely (!buffer->replace_glyph (DELETED_GLYPH))) return;
}

buffer->move_to (lig_end);
if (unlikely (!buffer->move_to (lig_end))) return;
buffer->merge_out_clusters (match_positions[cursor % ARRAY_LENGTH (match_positions)], buffer->out_len);
}

actionData++;
}
while (!(action & LigActionLast));
buffer->move_to (end);
if (unlikely (!buffer->move_to (end))) return;
}
}

@@ -733,17 +733,16 @@ struct InsertionSubtable
bool before = flags & MarkedInsertBefore;

unsigned int end = buffer->out_len;
buffer->move_to (mark);
if (unlikely (!buffer->move_to (mark))) return;

if (buffer->idx < buffer->len && !before)
buffer->copy_glyph ();
if (unlikely (!buffer->copy_glyph ())) return;
/* TODO We ignore KashidaLike setting. */
for (unsigned int i = 0; i < count; i++)
buffer->output_glyph (glyphs[i]);
if (unlikely (!buffer->replace_glyphs (0, count, glyphs))) return;
if (buffer->idx < buffer->len && !before)
buffer->skip_glyph ();

buffer->move_to (end + count);
if (unlikely (!buffer->move_to (end + count))) return;

buffer->unsafe_to_break_from_outbuffer (mark, hb_min (buffer->idx + 1, buffer->len));
}
@@ -764,10 +763,9 @@ struct InsertionSubtable
unsigned int end = buffer->out_len;

if (buffer->idx < buffer->len && !before)
buffer->copy_glyph ();
if (unlikely (!buffer->copy_glyph ())) return;
/* TODO We ignore KashidaLike setting. */
for (unsigned int i = 0; i < count; i++)
buffer->output_glyph (glyphs[i]);
if (unlikely (!buffer->replace_glyphs (0, count, glyphs))) return;
if (buffer->idx < buffer->len && !before)
buffer->skip_glyph ();

@@ -786,7 +784,7 @@ struct InsertionSubtable
*
* https://github.com/harfbuzz/harfbuzz/issues/1224#issuecomment-427691417
*/
buffer->move_to ((flags & DontAdvance) ? end : end + count);
if (unlikely (!buffer->move_to ((flags & DontAdvance) ? end : end + count))) return;
}
}

0 comments on commit 80323b7

Please sign in to comment.