Skip to content

Commit

Permalink
Upgrade to Harfbuzz 10.1.0
Browse files Browse the repository at this point in the history
[ChangeLog][Third-Party Code] Upgraded Harfbuzz to version
10.1.0.

Pick-to: dev 6.8 6.5 5.15
Fixes: QTBUG-131150
Change-Id: Idd8380b77ad861456cbd7260ad43af9a93fee58a
Reviewed-by: Volker Hilsheimer <[email protected]>
  • Loading branch information
eskilblomfeldt committed Nov 14, 2024
1 parent 3eb3842 commit 4f4c07e
Show file tree
Hide file tree
Showing 30 changed files with 1,507 additions and 772 deletions.
4 changes: 2 additions & 2 deletions src/3rdparty/harfbuzz-ng/qt_attribution.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

"Description": "HarfBuzz is an OpenType text shaping engine.",
"Homepage": "http://harfbuzz.org",
"Version": "10.0.1",
"DownloadLocation": "https://github.com/harfbuzz/harfbuzz/releases/tag/10.0.1",
"Version": "10.1.0",
"DownloadLocation": "https://github.com/harfbuzz/harfbuzz/releases/tag/10.1.0",

"License": "MIT License",
"LicenseId": "MIT",
Expand Down
47 changes: 26 additions & 21 deletions src/3rdparty/harfbuzz-ng/src/OT/Color/COLR/COLR.hh
Original file line number Diff line number Diff line change
Expand Up @@ -2058,7 +2058,7 @@ struct delta_set_index_map_subset_plan_t
unsigned outer = (*var_idx) >> 16;
unsigned bit_count = (outer == 0) ? 1 : hb_bit_storage (outer);
outer_bit_count = hb_max (bit_count, outer_bit_count);

unsigned inner = (*var_idx) & 0xFFFF;
bit_count = (inner == 0) ? 1 : hb_bit_storage (inner);
inner_bit_count = hb_max (bit_count, inner_bit_count);
Expand All @@ -2080,7 +2080,7 @@ struct COLR
bool has_v0_data () const { return numBaseGlyphs; }
bool has_v1_data () const
{
if (version != 1)
if (version < 1)
return false;
hb_barrier ();

Expand Down Expand Up @@ -2180,7 +2180,7 @@ struct COLR
hb_set_t *variation_indices,
hb_set_t *delta_set_indices) const
{
if (version != 1) return;
if (version < 1) return;
hb_barrier ();

hb_set_t visited_glyphs;
Expand Down Expand Up @@ -2222,16 +2222,22 @@ struct COLR
{ return (this+baseGlyphList); }

bool has_var_store () const
{ return version >= 1 && varStore != 0; }
{ return version >= 1 && hb_barrier () && varStore != 0; }

bool has_delta_set_index_map () const
{ return version >= 1 && varIdxMap != 0; }
{ return version >= 1 && hb_barrier () && varIdxMap != 0; }

bool has_clip_list () const
{ return version >= 1 && hb_barrier () && clipList != 0; }

const DeltaSetIndexMap &get_delta_set_index_map () const
{ return (version == 0 || varIdxMap == 0) ? Null (DeltaSetIndexMap) : this+varIdxMap; }
{ return has_delta_set_index_map () && hb_barrier () ? this+varIdxMap : Null (DeltaSetIndexMap); }

const ItemVariationStore &get_var_store () const
{ return (version == 0 || varStore == 0) ? Null (ItemVariationStore) : this+varStore; }
{ return has_var_store () && hb_barrier () ? this+varStore : Null (ItemVariationStore); }

const ClipList &get_clip_list () const
{ return has_clip_list () && hb_barrier () ? this+clipList : Null (ClipList); }

bool sanitize (hb_sanitize_context_t *c) const
{
Expand All @@ -2242,7 +2248,6 @@ struct COLR
(this+layersZ).sanitize (c, numLayers) &&
(version == 0 ||
(hb_barrier () &&
version == 1 &&
baseGlyphList.sanitize (c, this) &&
layerList.sanitize (c, this) &&
clipList.sanitize (c, this) &&
Expand Down Expand Up @@ -2465,7 +2470,9 @@ struct COLR
if (unlikely (!c->serializer->extend_min (colr_prime))) return_trace (false);

if (version == 0 || downgrade_to_V0 (glyphset))
return_trace (colr_prime->serialize_V0 (c->serializer, 0, base_it, layer_it));
return_trace (colr_prime->serialize_V0 (c->serializer, 0, base_it, layer_it));

hb_barrier ();

//start version 1
if (!c->serializer->allocate_size<void> (5 * HBUINT32::static_size)) return_trace (false);
Expand All @@ -2475,8 +2482,8 @@ struct COLR
* after instancing */
if (!subset_varstore (c, colr_prime)) return_trace (false);

ItemVarStoreInstancer instancer (varStore ? &(this+varStore) : nullptr,
varIdxMap ? &(this+varIdxMap) : nullptr,
ItemVarStoreInstancer instancer (&(get_var_store ()),
&(get_delta_set_index_map ()),
c->plan->normalized_coords.as_array ());

if (!colr_prime->baseGlyphList.serialize_subset (c, baseGlyphList, this, instancer))
Expand Down Expand Up @@ -2505,12 +2512,10 @@ struct COLR
bool
get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
{
if (version != 1)
return false;

ItemVarStoreInstancer instancer (&(this+varStore),
&(this+varIdxMap),
hb_array (font->coords, font->num_coords));
ItemVarStoreInstancer instancer (&(get_var_store ()),
&(get_delta_set_index_map ()),
hb_array (font->coords, font->num_coords));

if (get_clip (glyph, extents, instancer))
{
Expand Down Expand Up @@ -2545,7 +2550,7 @@ struct COLR
bool
has_paint_for_glyph (hb_codepoint_t glyph) const
{
if (version == 1)
if (version >= 1)
{
hb_barrier ();

Expand All @@ -2561,7 +2566,7 @@ struct COLR
hb_glyph_extents_t *extents,
const ItemVarStoreInstancer instancer) const
{
return (this+clipList).get_extents (glyph,
return get_clip_list ().get_extents (glyph,
extents,
instancer);
}
Expand All @@ -2570,13 +2575,13 @@ struct COLR
bool
paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, unsigned int palette_index, hb_color_t foreground, bool clip = true) const
{
ItemVarStoreInstancer instancer (&(this+varStore),
&(this+varIdxMap),
ItemVarStoreInstancer instancer (&(get_var_store ()),
&(get_delta_set_index_map ()),
hb_array (font->coords, font->num_coords));
hb_paint_context_t c (this, funcs, data, font, palette_index, foreground, instancer);
c.current_glyphs.add (glyph);

if (version == 1)
if (version >= 1)
{
hb_barrier ();

Expand Down
7 changes: 0 additions & 7 deletions src/3rdparty/harfbuzz-ng/src/REUSE.toml

This file was deleted.

3 changes: 2 additions & 1 deletion src/3rdparty/harfbuzz-ng/src/harfbuzz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include "hb-buffer-verify.cc"
#include "hb-buffer.cc"
#include "hb-common.cc"
#include "hb-coretext.cc"
#include "hb-coretext-font.cc"
#include "hb-coretext-shape.cc"
#include "hb-directwrite.cc"
#include "hb-draw.cc"
#include "hb-face-builder.cc"
Expand Down
5 changes: 2 additions & 3 deletions src/3rdparty/harfbuzz-ng/src/hb-blob.cc
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,9 @@ hb_blob_create_from_file (const char *file_name)

/**
* hb_blob_create_from_file_or_fail:
* @file_name: A font filename
* @file_name: A filename
*
* Creates a new blob containing the data from the
* specified binary font file.
* Creates a new blob containing the data from the specified file.
*
* The filename is passed directly to the system on all platforms,
* except on Windows, where the filename is interpreted as UTF-8.
Expand Down
2 changes: 1 addition & 1 deletion src/3rdparty/harfbuzz-ng/src/hb-cairo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ hb_cairo_init_scaled_font (cairo_scaled_font_t *scaled_font,
&hb_cairo_face_user_data_key);
font = hb_font_create (face);

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,16,0)
#if !defined(HB_NO_VAR) && CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,16,0)
cairo_font_options_t *font_options = cairo_font_options_create ();

// Set variations
Expand Down
1 change: 0 additions & 1 deletion src/3rdparty/harfbuzz-ng/src/hb-config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@

#ifdef HB_LEAN
#define HB_DISABLE_DEPRECATED
#define HB_NDEBUG
#define HB_NO_ATEXIT
#define HB_NO_BUFFER_MESSAGE
#define HB_NO_BUFFER_SERIALIZE
Expand Down
Loading

0 comments on commit 4f4c07e

Please sign in to comment.