Skip to content

Commit

Permalink
Revert "Upgrade Harfbuzz to 7.3.0"
Browse files Browse the repository at this point in the history
This reverts commit 3366abe.
The revert is needed to get the merge of tqtc/lts-6.2.10 succeed
without conflicts.

Change-Id: Ib51dcc52bcf6f2dcefb6e11e0a8bcb26d5de56dd
Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
  • Loading branch information
Tarja Sundqvist committed Oct 4, 2024
1 parent f131837 commit c600c53
Show file tree
Hide file tree
Showing 61 changed files with 1,128 additions and 981 deletions.
1 change: 0 additions & 1 deletion src/3rdparty/harfbuzz-ng/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ qt_internal_add_3rdparty_library(BundledHarfbuzz
src/hb-subset-input.cc
src/hb-subset-instancer-solver.cc
src/hb-subset-plan.cc
src/hb-subset-plan-member-list.hh
src/hb-subset-repacker.cc src/hb-subset-repacker.h
src/hb-unicode.cc src/hb-unicode.h src/hb-unicode.hh
src/hb-utf.hh
Expand Down
21 changes: 0 additions & 21 deletions src/3rdparty/harfbuzz-ng/NEWS
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
Overview of changes leading to 7.3.0
Tuesday, May 9, 2023
====================================
- Speedup applying glyph variation in VarComposites fonts (over 40% speedup).
(Behdad Esfahbod)
- Speedup instancing some fonts (over 20% speedup in instancing RobotoFlex).
(Behdad Esfahbod)
- Speedup shaping some fonts (over 30% speedup in shaping Roboto).
(Behdad Esfahbod)
- Support subsetting VarComposites and beyond-64k fonts. (Behdad Esfahbod)
- New configuration macro HB_MINIMIZE_MEMORY_USAGE to favor optimizing memory
usage over speed. (Behdad Esfahbod)
- Supporting setting the mapping between old and new glyph indices during
subsetting. (Garret Rieger)
- Various fixes and improvements.
(Behdad Esfahbod, Denis Rochette, Garret Rieger, Han Seung Min, Qunxin Liu)

- New API:
+hb_subset_input_old_to_new_glyph_mapping()


Overview of changes leading to 7.2.0
Thursday, April 27, 2023
====================================
Expand Down
2 changes: 1 addition & 1 deletion src/3rdparty/harfbuzz-ng/qt_attribution.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

"Description": "HarfBuzz is an OpenType text shaping engine.",
"Homepage": "http://harfbuzz.org",
"Version": "7.3.0",
"Version": "7.2.0",
"License": "MIT License",
"LicenseId": "MIT",
"LicenseFile": "COPYING",
Expand Down
8 changes: 4 additions & 4 deletions src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/COLR.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1514,10 +1514,10 @@ struct ClipBoxFormat2 : Variable<ClipBoxFormat1>
value.get_clip_box(clip_box, instancer);
if (instancer)
{
clip_box.xMin += roundf (instancer (varIdxBase, 0));
clip_box.yMin += roundf (instancer (varIdxBase, 1));
clip_box.xMax += roundf (instancer (varIdxBase, 2));
clip_box.yMax += roundf (instancer (varIdxBase, 3));
clip_box.xMin += _hb_roundf (instancer (varIdxBase, 0));
clip_box.yMin += _hb_roundf (instancer (varIdxBase, 1));
clip_box.xMax += _hb_roundf (instancer (varIdxBase, 2));
clip_box.yMax += _hb_roundf (instancer (varIdxBase, 3));
}
}
};
Expand Down
23 changes: 6 additions & 17 deletions src/3rdparty/harfbuzz-ng/src/OT/Layout/Common/Coverage.hh
Original file line number Diff line number Diff line change
Expand Up @@ -113,33 +113,22 @@ struct Coverage
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (this))) return_trace (false);

unsigned count = hb_len (glyphs);
unsigned count = 0;
unsigned num_ranges = 0;
hb_codepoint_t last = (hb_codepoint_t) -2;
hb_codepoint_t max = 0;
bool unsorted = false;
for (auto g: glyphs)
{
if (last != (hb_codepoint_t) -2 && g < last)
unsorted = true;
if (last + 1 != g)
num_ranges++;
num_ranges++;
last = g;
if (g > max) max = g;
count++;
}
u.format = !unsorted && count <= num_ranges * 3 ? 1 : 2;
u.format = count <= num_ranges * 3 ? 1 : 2;

#ifndef HB_NO_BEYOND_64K
if (max > 0xFFFFu)
if (count && last > 0xFFFFu)
u.format += 2;
if (unlikely (max > 0xFFFFFFu))
#else
if (unlikely (max > 0xFFFFu))
#endif
{
c->check_success (false, HB_SERIALIZE_ERROR_INT_OVERFLOW);
return_trace (false);
}

switch (u.format)
{
Expand All @@ -159,8 +148,8 @@ struct Coverage
auto it =
+ iter ()
| hb_take (c->plan->source->get_num_glyphs ())
| hb_filter (c->plan->glyph_map_gsub)
| hb_map_retains_sorting (c->plan->glyph_map_gsub)
| hb_filter ([] (hb_codepoint_t glyph) { return glyph != HB_MAP_VALUE_INVALID; })
;

// Cache the iterator result as it will be iterated multiple times
Expand Down
17 changes: 5 additions & 12 deletions src/3rdparty/harfbuzz-ng/src/OT/Layout/Common/CoverageFormat2.hh
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,19 @@ struct CoverageFormat2_4
unsigned count = 0;
unsigned range = (unsigned) -1;
last = (hb_codepoint_t) -2;
unsigned unsorted = false;
for (auto g: glyphs)
{
if (last + 1 != g)
{
if (unlikely (last != (hb_codepoint_t) -2 && last + 1 > g))
unsorted = true;

range++;
rangeRecord.arrayZ[range].first = g;
rangeRecord.arrayZ[range].value = count;
rangeRecord[range].first = g;
rangeRecord[range].value = count;
}
rangeRecord.arrayZ[range].last = g;
rangeRecord[range].last = g;
last = g;
count++;
}

if (unlikely (unsorted))
rangeRecord.as_array ().qsort (RangeRecord<Types>::cmp_range);

return_trace (true);
}

Expand Down Expand Up @@ -192,8 +185,8 @@ struct CoverageFormat2_4
if (__more__ ())
{
unsigned int old = coverage;
j = c->rangeRecord.arrayZ[i].first;
coverage = c->rangeRecord.arrayZ[i].value;
j = c->rangeRecord[i].first;
coverage = c->rangeRecord[i].value;
if (unlikely (coverage != old + 1))
{
/* Broken table. Skip. Important to avoid DoS.
Expand Down
12 changes: 0 additions & 12 deletions src/3rdparty/harfbuzz-ng/src/OT/Layout/Common/RangeRecord.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ struct RangeRecord
int cmp (hb_codepoint_t g) const
{ return g < first ? -1 : g <= last ? 0 : +1; }

HB_INTERNAL static int cmp_range (const void *pa, const void *pb) {
const RangeRecord *a = (const RangeRecord *) pa;
const RangeRecord *b = (const RangeRecord *) pb;
if (a->first < b->first) return -1;
if (a->first > b->first) return +1;
if (a->last < b->last) return -1;
if (a->last > b->last) return +1;
if (a->value < b->value) return -1;
if (a->value > b->value) return +1;
return 0;
}

unsigned get_population () const
{
if (unlikely (last < first)) return 0;
Expand Down
24 changes: 0 additions & 24 deletions src/3rdparty/harfbuzz-ng/src/OT/Layout/GDEF/GDEF.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "../../../hb-ot-layout-common.hh"

#include "../../../hb-font.hh"
#include "../../../hb-cache.hh"


namespace OT {
Expand Down Expand Up @@ -862,30 +861,7 @@ struct GDEF
}
~accelerator_t () { table.destroy (); }

unsigned int get_glyph_props (hb_codepoint_t glyph) const
{
unsigned v;

#ifndef HB_NO_GDEF_CACHE
if (glyph_props_cache.get (glyph, &v))
return v;
#endif

v = table->get_glyph_props (glyph);

#ifndef HB_NO_GDEF_CACHE
if (likely (table.get_blob ())) // Don't try setting if we are the null instance!
glyph_props_cache.set (glyph, v);
#endif

return v;

}

hb_blob_ptr_t<GDEF> table;
#ifndef HB_NO_GDEF_CACHE
mutable hb_cache_t<21, 3, 8> glyph_props_cache;
#endif
};

void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ struct CursivePosFormat1
if (!this_record.entryAnchor) return_trace (false);

hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
skippy_iter.reset_fast (buffer->idx, 1);
skippy_iter.reset (buffer->idx, 1);
unsigned unsafe_from;
if (unlikely (!skippy_iter.prev (&unsafe_from)))
if (!skippy_iter.prev (&unsafe_from))
{
buffer->unsafe_to_concat_from_outbuffer (unsafe_from, buffer->idx + 1);
return_trace (false);
Expand Down
2 changes: 1 addition & 1 deletion src/3rdparty/harfbuzz-ng/src/OT/Layout/GPOS/GPOS.hh
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ GPOS::position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer)
{
for (unsigned i = 0; i < len; i++)
if (unlikely (pos[i].y_offset))
pos[i].x_offset += roundf (font->slant_xy * pos[i].y_offset);
pos[i].x_offset += _hb_roundf (font->slant_xy * pos[i].y_offset);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ struct MarkMarkPosFormat1_2

/* now we search backwards for a suitable mark glyph until a non-mark glyph */
hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
skippy_iter.reset_fast (buffer->idx, 1);
skippy_iter.reset (buffer->idx, 1);
skippy_iter.set_lookup_props (c->lookup_props & ~(uint32_t)LookupFlag::IgnoreFlags);
unsigned unsafe_from;
if (unlikely (!skippy_iter.prev (&unsafe_from)))
if (!skippy_iter.prev (&unsafe_from))
{
buffer->unsafe_to_concat_from_outbuffer (unsafe_from, buffer->idx + 1);
return_trace (false);
}

if (likely (!_hb_glyph_info_is_mark (&buffer->info[skippy_iter.idx])))
if (!_hb_glyph_info_is_mark (&buffer->info[skippy_iter.idx]))
{
buffer->unsafe_to_concat_from_outbuffer (skippy_iter.idx, buffer->idx + 1);
return_trace (false);
Expand Down
4 changes: 2 additions & 2 deletions src/3rdparty/harfbuzz-ng/src/OT/Layout/GPOS/PairPosFormat1.hh
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ struct PairPosFormat1_3
if (likely (index == NOT_COVERED)) return_trace (false);

hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
skippy_iter.reset_fast (buffer->idx, 1);
skippy_iter.reset (buffer->idx, 1);
unsigned unsafe_to;
if (unlikely (!skippy_iter.next (&unsafe_to)))
if (!skippy_iter.next (&unsafe_to))
{
buffer->unsafe_to_concat (buffer->idx, unsafe_to);
return_trace (false);
Expand Down
27 changes: 11 additions & 16 deletions src/3rdparty/harfbuzz-ng/src/OT/Layout/GPOS/PairPosFormat2.hh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ struct PairPosFormat2_4
unsigned int len1 = valueFormat1.get_len ();
unsigned int len2 = valueFormat2.get_len ();
unsigned int stride = HBUINT16::static_size * (len1 + len2);
unsigned int record_size = valueFormat1.get_size () + valueFormat2.get_size ();
unsigned int count = (unsigned int) class1Count * (unsigned int) class2Count;
return_trace (c->check_range ((const void *) values,
count,
stride) &&
record_size) &&
valueFormat1.sanitize_values_stride_unsafe (c, this, &values[0], count, stride) &&
valueFormat2.sanitize_values_stride_unsafe (c, this, &values[len1], count, stride));
}
Expand Down Expand Up @@ -130,32 +131,26 @@ struct PairPosFormat2_4
if (likely (index == NOT_COVERED)) return_trace (false);

hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
skippy_iter.reset_fast (buffer->idx, 1);
skippy_iter.reset (buffer->idx, 1);
unsigned unsafe_to;
if (unlikely (!skippy_iter.next (&unsafe_to)))
if (!skippy_iter.next (&unsafe_to))
{
buffer->unsafe_to_concat (buffer->idx, unsafe_to);
return_trace (false);
}

unsigned int klass2 = (this+classDef2).get_class (buffer->info[skippy_iter.idx].codepoint);
if (!klass2)
{
buffer->unsafe_to_concat (buffer->idx, skippy_iter.idx + 1);
return_trace (false);
}
unsigned int len1 = valueFormat1.get_len ();
unsigned int len2 = valueFormat2.get_len ();
unsigned int record_len = len1 + len2;

unsigned int klass1 = (this+classDef1).get_class (buffer->cur().codepoint);
unsigned int klass2 = (this+classDef2).get_class (buffer->info[skippy_iter.idx].codepoint);
if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
{
buffer->unsafe_to_concat (buffer->idx, skippy_iter.idx + 1);
return_trace (false);
}

unsigned int len1 = valueFormat1.get_len ();
unsigned int len2 = valueFormat2.get_len ();
unsigned int record_len = len1 + len2;

const Value *v = &values[record_len * (klass1 * class2Count + klass2)];

bool applied_first = false, applied_second = false;
Expand All @@ -169,7 +164,7 @@ struct PairPosFormat2_4
* https://github.com/harfbuzz/harfbuzz/pull/3235#issuecomment-1029814978
*/
#ifndef HB_SPLIT_KERN
if (false)
if (0)
#endif
{
if (!len2)
Expand Down Expand Up @@ -229,8 +224,8 @@ struct PairPosFormat2_4
c->buffer->idx, skippy_iter.idx);
}

applied_first = len1 && valueFormat1.apply_value (c, this, v, buffer->cur_pos());
applied_second = len2 && valueFormat2.apply_value (c, this, v + len1, buffer->pos[skippy_iter.idx]);
applied_first = valueFormat1.apply_value (c, this, v, buffer->cur_pos());
applied_second = valueFormat2.apply_value (c, this, v + len1, buffer->pos[skippy_iter.idx]);

if (applied_first || applied_second)
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
Expand Down
4 changes: 2 additions & 2 deletions src/3rdparty/harfbuzz-ng/src/OT/Layout/GPOS/PairSet.hh
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ struct PairSet
c->buffer->idx, pos);
}

bool applied_first = len1 && valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos());
bool applied_second = len2 && valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos]);
bool applied_first = valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos());
bool applied_second = valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos]);

if (applied_first || applied_second)
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
Expand Down
2 changes: 1 addition & 1 deletion src/3rdparty/harfbuzz-ng/src/OT/Layout/GSUB/Ligature.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace GSUB_impl {
template <typename Types>
struct Ligature
{
public:
protected:
typename Types::HBGlyphID
ligGlyph; /* GlyphID of ligature to substitute */
HeadlessArrayOf<typename Types::HBGlyphID>
Expand Down
Loading

0 comments on commit c600c53

Please sign in to comment.