Skip to content

Commit 37f506c

Browse files
committed
harfbuzz: Update to 11.3.2
1 parent 71a9948 commit 37f506c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3893
-2387
lines changed

thirdparty/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,15 +436,15 @@ Patches:
436436
## harfbuzz
437437

438438
- Upstream: https://github.com/harfbuzz/harfbuzz
439-
- Version: 11.2.1 (33a3f8de60dcad7535f14f07d6710144548853ac, 2025)
439+
- Version: 11.3.2 (4e3df1c1383481ed5717603d5dd3453a04fb16ba, 2025)
440440
- License: MIT
441441

442442
Files extracted from upstream source:
443443

444444
- `AUTHORS`, `COPYING`, `THANKS`
445445
- From the `src` folder, recursively:
446446
- All the `.cc`, `.h`, `.hh` files
447-
- Except `main.cc`, `harfbuzz*.cc`, `failing-alloc.c`, `test*.cc`, `hb-wasm*.*`, `wasm/*`
447+
- Except `main.cc`, `harfbuzz*.cc`, `failing-alloc.c`, `test*.cc`, `hb-wasm*.*`, `hb-harfrust.cc`, `wasm/*`, `ms-use/*`, `rust/*`
448448

449449

450450
## hidapi

thirdparty/harfbuzz/src/OT/Color/COLR/COLR.hh

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public:
104104
foreground (foreground_),
105105
instancer (instancer_)
106106
{
107-
if (font->is_synthetic ())
107+
if (font->is_synthetic)
108108
{
109109
font = hb_font_create_sub_font (font);
110110
hb_font_set_synthetic_bold (font, 0, 0, true);
@@ -1075,9 +1075,9 @@ struct PaintTranslate
10751075
float ddx = dx + c->instancer (varIdxBase, 0);
10761076
float ddy = dy + c->instancer (varIdxBase, 1);
10771077

1078-
bool p1 = c->funcs->push_translate (c->data, ddx, ddy);
1078+
c->funcs->push_translate (c->data, ddx, ddy);
10791079
c->recurse (this+src);
1080-
if (p1) c->funcs->pop_transform (c->data);
1080+
c->funcs->pop_transform (c->data);
10811081
}
10821082

10831083
HBUINT8 format; /* format = 14(noVar) or 15 (Var) */
@@ -1124,9 +1124,9 @@ struct PaintScale
11241124
float sx = scaleX.to_float (c->instancer (varIdxBase, 0));
11251125
float sy = scaleY.to_float (c->instancer (varIdxBase, 1));
11261126

1127-
bool p1 = c->funcs->push_scale (c->data, sx, sy);
1127+
c->funcs->push_scale (c->data, sx, sy);
11281128
c->recurse (this+src);
1129-
if (p1) c->funcs->pop_transform (c->data);
1129+
c->funcs->pop_transform (c->data);
11301130
}
11311131

11321132
HBUINT8 format; /* format = 16 (noVar) or 17(Var) */
@@ -1177,13 +1177,9 @@ struct PaintScaleAroundCenter
11771177
float tCenterX = centerX + c->instancer (varIdxBase, 2);
11781178
float tCenterY = centerY + c->instancer (varIdxBase, 3);
11791179

1180-
bool p1 = c->funcs->push_translate (c->data, +tCenterX, +tCenterY);
1181-
bool p2 = c->funcs->push_scale (c->data, sx, sy);
1182-
bool p3 = c->funcs->push_translate (c->data, -tCenterX, -tCenterY);
1180+
c->funcs->push_scale_around_center (c->data, sx, sy, tCenterX, tCenterY);
11831181
c->recurse (this+src);
1184-
if (p3) c->funcs->pop_transform (c->data);
1185-
if (p2) c->funcs->pop_transform (c->data);
1186-
if (p1) c->funcs->pop_transform (c->data);
1182+
c->funcs->pop_transform (c->data);
11871183
}
11881184

11891185
HBUINT8 format; /* format = 18 (noVar) or 19(Var) */
@@ -1228,9 +1224,9 @@ struct PaintScaleUniform
12281224
TRACE_PAINT (this);
12291225
float s = scale.to_float (c->instancer (varIdxBase, 0));
12301226

1231-
bool p1 = c->funcs->push_scale (c->data, s, s);
1227+
c->funcs->push_scale (c->data, s, s);
12321228
c->recurse (this+src);
1233-
if (p1) c->funcs->pop_transform (c->data);
1229+
c->funcs->pop_transform (c->data);
12341230
}
12351231

12361232
HBUINT8 format; /* format = 20 (noVar) or 21(Var) */
@@ -1278,13 +1274,9 @@ struct PaintScaleUniformAroundCenter
12781274
float tCenterX = centerX + c->instancer (varIdxBase, 1);
12791275
float tCenterY = centerY + c->instancer (varIdxBase, 2);
12801276

1281-
bool p1 = c->funcs->push_translate (c->data, +tCenterX, +tCenterY);
1282-
bool p2 = c->funcs->push_scale (c->data, s, s);
1283-
bool p3 = c->funcs->push_translate (c->data, -tCenterX, -tCenterY);
1277+
c->funcs->push_scale_around_center (c->data, s, s, tCenterX, tCenterY);
12841278
c->recurse (this+src);
1285-
if (p3) c->funcs->pop_transform (c->data);
1286-
if (p2) c->funcs->pop_transform (c->data);
1287-
if (p1) c->funcs->pop_transform (c->data);
1279+
c->funcs->pop_transform (c->data);
12881280
}
12891281

12901282
HBUINT8 format; /* format = 22 (noVar) or 23(Var) */
@@ -1328,9 +1320,9 @@ struct PaintRotate
13281320
TRACE_PAINT (this);
13291321
float a = angle.to_float (c->instancer (varIdxBase, 0));
13301322

1331-
bool p1 = c->funcs->push_rotate (c->data, a);
1323+
c->funcs->push_rotate (c->data, a);
13321324
c->recurse (this+src);
1333-
if (p1) c->funcs->pop_transform (c->data);
1325+
c->funcs->pop_transform (c->data);
13341326
}
13351327

13361328
HBUINT8 format; /* format = 24 (noVar) or 25(Var) */
@@ -1378,13 +1370,9 @@ struct PaintRotateAroundCenter
13781370
float tCenterX = centerX + c->instancer (varIdxBase, 1);
13791371
float tCenterY = centerY + c->instancer (varIdxBase, 2);
13801372

1381-
bool p1 = c->funcs->push_translate (c->data, +tCenterX, +tCenterY);
1382-
bool p2 = c->funcs->push_rotate (c->data, a);
1383-
bool p3 = c->funcs->push_translate (c->data, -tCenterX, -tCenterY);
1373+
c->funcs->push_rotate_around_center (c->data, a, tCenterX, tCenterY);
13841374
c->recurse (this+src);
1385-
if (p3) c->funcs->pop_transform (c->data);
1386-
if (p2) c->funcs->pop_transform (c->data);
1387-
if (p1) c->funcs->pop_transform (c->data);
1375+
c->funcs->pop_transform (c->data);
13881376
}
13891377

13901378
HBUINT8 format; /* format = 26 (noVar) or 27(Var) */
@@ -1432,9 +1420,9 @@ struct PaintSkew
14321420
float sx = xSkewAngle.to_float(c->instancer (varIdxBase, 0));
14331421
float sy = ySkewAngle.to_float(c->instancer (varIdxBase, 1));
14341422

1435-
bool p1 = c->funcs->push_skew (c->data, sx, sy);
1423+
c->funcs->push_skew (c->data, sx, sy);
14361424
c->recurse (this+src);
1437-
if (p1) c->funcs->pop_transform (c->data);
1425+
c->funcs->pop_transform (c->data);
14381426
}
14391427

14401428
HBUINT8 format; /* format = 28(noVar) or 29 (Var) */
@@ -1485,13 +1473,9 @@ struct PaintSkewAroundCenter
14851473
float tCenterX = centerX + c->instancer (varIdxBase, 2);
14861474
float tCenterY = centerY + c->instancer (varIdxBase, 3);
14871475

1488-
bool p1 = c->funcs->push_translate (c->data, +tCenterX, +tCenterY);
1489-
bool p2 = c->funcs->push_skew (c->data, sx, sy);
1490-
bool p3 = c->funcs->push_translate (c->data, -tCenterX, -tCenterY);
1476+
c->funcs->push_skew_around_center (c->data, sx, sy, tCenterX, tCenterY);
14911477
c->recurse (this+src);
1492-
if (p3) c->funcs->pop_transform (c->data);
1493-
if (p2) c->funcs->pop_transform (c->data);
1494-
if (p1) c->funcs->pop_transform (c->data);
1478+
c->funcs->pop_transform (c->data);
14951479
}
14961480

14971481
HBUINT8 format; /* format = 30(noVar) or 31 (Var) */
@@ -2693,7 +2677,8 @@ struct COLR
26932677
{
26942678
ItemVarStoreInstancer instancer (get_var_store_ptr (),
26952679
get_delta_set_index_map_ptr (),
2696-
hb_array (font->coords, font->num_coords));
2680+
hb_array (font->coords,
2681+
font->has_nonzero_coords ? font->num_coords : 0));
26972682
hb_paint_context_t c (this, funcs, data, font, palette_index, foreground, instancer);
26982683

26992684
hb_decycler_node_t node (c.glyphs_decycler);

thirdparty/harfbuzz/src/OT/Layout/GPOS/AnchorFormat3.hh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ struct AnchorFormat3
3737
*x = font->em_fscale_x (xCoordinate);
3838
*y = font->em_fscale_y (yCoordinate);
3939

40-
if ((font->x_ppem || font->num_coords) && xDeviceTable.sanitize (&c->sanitizer, this))
40+
if ((font->x_ppem || font->has_nonzero_coords) && xDeviceTable.sanitize (&c->sanitizer, this))
4141
{
4242
hb_barrier ();
4343
*x += (this+xDeviceTable).get_x_delta (font, c->var_store, c->var_store_cache);
4444
}
45-
if ((font->y_ppem || font->num_coords) && yDeviceTable.sanitize (&c->sanitizer, this))
45+
if ((font->y_ppem || font->has_nonzero_coords) && yDeviceTable.sanitize (&c->sanitizer, this))
4646
{
4747
hb_barrier ();
4848
*y += (this+yDeviceTable).get_y_delta (font, c->var_store, c->var_store_cache);
@@ -63,7 +63,7 @@ struct AnchorFormat3
6363
hb_pair_t<unsigned, int> *new_varidx_delta;
6464
if (!c->plan->layout_variation_idx_delta_map.has (x_varidx, &new_varidx_delta))
6565
return_trace (false);
66-
66+
6767
x_varidx = hb_first (*new_varidx_delta);
6868
int delta = hb_second (*new_varidx_delta);
6969
if (delta != 0)
@@ -91,10 +91,13 @@ struct AnchorFormat3
9191
}
9292
}
9393

94-
/* in case that all axes are pinned or no variations after instantiation,
95-
* both var_idxes will be mapped to HB_OT_LAYOUT_NO_VARIATIONS_INDEX */
96-
if (x_varidx == HB_OT_LAYOUT_NO_VARIATIONS_INDEX &&
97-
y_varidx == HB_OT_LAYOUT_NO_VARIATIONS_INDEX)
94+
95+
bool no_downgrade = (!xDeviceTable.is_null () && !(this+xDeviceTable).is_variation_device ()) ||
96+
x_varidx != HB_OT_LAYOUT_NO_VARIATIONS_INDEX ||
97+
y_varidx != HB_OT_LAYOUT_NO_VARIATIONS_INDEX ||
98+
(!yDeviceTable.is_null () && !(this+yDeviceTable).is_variation_device ());
99+
100+
if (!no_downgrade)
98101
return_trace (c->serializer->check_assign (out->format, 1, HB_SERIALIZE_ERROR_INT_OVERFLOW));
99102

100103
if (!c->serializer->embed (xDeviceTable)) return_trace (false);

thirdparty/harfbuzz/src/OT/Layout/GPOS/ValueFormat.hh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct ValueFormat : HBUINT16
5656
* PosTable (may be NULL) */
5757
#endif
5858

59-
IntType& operator = (uint16_t i) { v = i; return *this; }
59+
NumType& operator = (uint16_t i) { v = i; return *this; }
6060

6161
unsigned int get_len () const { return hb_popcount ((unsigned int) *this); }
6262
unsigned int get_size () const { return get_len () * Value::static_size; }
@@ -111,8 +111,8 @@ struct ValueFormat : HBUINT16
111111

112112
if (!has_device ()) return ret;
113113

114-
bool use_x_device = font->x_ppem || font->num_coords;
115-
bool use_y_device = font->y_ppem || font->num_coords;
114+
bool use_x_device = font->x_ppem || font->has_nonzero_coords;
115+
bool use_y_device = font->y_ppem || font->has_nonzero_coords;
116116

117117
if (!use_x_device && !use_y_device) return ret;
118118

thirdparty/harfbuzz/src/OT/Layout/GSUB/LigatureSet.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ namespace GSUB_impl {
1111
template <typename Types>
1212
struct LigatureSet
1313
{
14-
protected:
14+
public:
1515
Array16OfOffset16To<Ligature<Types>>
1616
ligature; /* Array LigatureSet tables
1717
* ordered by preference */
18-
public:
18+
1919
DEFINE_SIZE_ARRAY (2, ligature);
2020

2121
bool sanitize (hb_sanitize_context_t *c) const

thirdparty/harfbuzz/src/OT/Layout/GSUB/Sequence.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct Sequence
115115

116116
for (unsigned i = c->buffer->idx - count; i < c->buffer->idx; i++)
117117
{
118-
if (buf < p)
118+
if (buf < p && sizeof(buf) - 1u > unsigned (p - buf))
119119
*p++ = ',';
120120
snprintf (p, sizeof(buf) - (p - buf), "%u", i);
121121
p += strlen(p);

thirdparty/harfbuzz/src/OT/Var/VARC/VARC.cc

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace OT {
1313

1414
struct hb_transforming_pen_context_t
1515
{
16-
hb_transform_t transform;
16+
hb_transform_t<> transform;
1717
hb_draw_funcs_t *dfuncs;
1818
void *data;
1919
hb_draw_state_t *st;
@@ -130,9 +130,9 @@ hb_ubytes_t
130130
VarComponent::get_path_at (const hb_varc_context_t &c,
131131
hb_codepoint_t parent_gid,
132132
hb_array_t<const int> coords,
133-
hb_transform_t total_transform,
133+
hb_transform_t<> total_transform,
134134
hb_ubytes_t total_record,
135-
VarRegionList::cache_t *cache) const
135+
hb_scalar_cache_t *cache) const
136136
{
137137
const unsigned char *end = total_record.arrayZ + total_record.length;
138138
const unsigned char *record = total_record.arrayZ;
@@ -216,7 +216,7 @@ VarComponent::get_path_at (const hb_varc_context_t &c,
216216
* limit on the max number of coords for now. */
217217
if ((flags & (unsigned) flags_t::RESET_UNSPECIFIED_AXES) ||
218218
coords.length > HB_VAR_COMPOSITE_MAX_AXES)
219-
component_coords = hb_array<int> (c.font->coords, c.font->num_coords);
219+
component_coords = hb_array (c.font->coords, c.font->num_coords);
220220

221221
// Transform
222222

@@ -226,28 +226,28 @@ VarComponent::get_path_at (const hb_varc_context_t &c,
226226

227227
#define PROCESS_TRANSFORM_COMPONENTS \
228228
HB_STMT_START { \
229-
PROCESS_TRANSFORM_COMPONENT (FWORD, HAVE_TRANSLATE_X, translateX); \
230-
PROCESS_TRANSFORM_COMPONENT (FWORD, HAVE_TRANSLATE_Y, translateY); \
231-
PROCESS_TRANSFORM_COMPONENT (F4DOT12, HAVE_ROTATION, rotation); \
232-
PROCESS_TRANSFORM_COMPONENT (F6DOT10, HAVE_SCALE_X, scaleX); \
233-
PROCESS_TRANSFORM_COMPONENT (F6DOT10, HAVE_SCALE_Y, scaleY); \
234-
PROCESS_TRANSFORM_COMPONENT (F4DOT12, HAVE_SKEW_X, skewX); \
235-
PROCESS_TRANSFORM_COMPONENT (F4DOT12, HAVE_SKEW_Y, skewY); \
236-
PROCESS_TRANSFORM_COMPONENT (FWORD, HAVE_TCENTER_X, tCenterX); \
237-
PROCESS_TRANSFORM_COMPONENT (FWORD, HAVE_TCENTER_Y, tCenterY); \
229+
PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TRANSLATE_X, translateX); \
230+
PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TRANSLATE_Y, translateY); \
231+
PROCESS_TRANSFORM_COMPONENT (F4DOT12, HB_PI, HAVE_ROTATION, rotation); \
232+
PROCESS_TRANSFORM_COMPONENT (F6DOT10, 1.0f, HAVE_SCALE_X, scaleX); \
233+
PROCESS_TRANSFORM_COMPONENT (F6DOT10, 1.0f, HAVE_SCALE_Y, scaleY); \
234+
PROCESS_TRANSFORM_COMPONENT (F4DOT12, HB_PI, HAVE_SKEW_X, skewX); \
235+
PROCESS_TRANSFORM_COMPONENT (F4DOT12, HB_PI, HAVE_SKEW_Y, skewY); \
236+
PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TCENTER_X, tCenterX); \
237+
PROCESS_TRANSFORM_COMPONENT (FWORD, 1.0f, HAVE_TCENTER_Y, tCenterY); \
238238
} HB_STMT_END
239239

240-
hb_transform_decomposed_t transform;
240+
hb_transform_decomposed_t<> transform;
241241

242242
// Read transform components
243-
#define PROCESS_TRANSFORM_COMPONENT(type, flag, name) \
243+
#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \
244244
if (flags & (unsigned) flags_t::flag) \
245245
{ \
246246
static_assert (type::static_size == HBINT16::static_size, ""); \
247247
if (unlikely (unsigned (end - record) < HBINT16::static_size)) \
248248
return hb_ubytes_t (); \
249249
hb_barrier (); \
250-
transform.name = * (const HBINT16 *) record; \
250+
transform.name = mult * * (const HBINT16 *) record; \
251251
record += HBINT16::static_size; \
252252
}
253253
PROCESS_TRANSFORM_COMPONENTS;
@@ -279,22 +279,22 @@ VarComponent::get_path_at (const hb_varc_context_t &c,
279279
{
280280
float transformValues[9];
281281
unsigned numTransformValues = 0;
282-
#define PROCESS_TRANSFORM_COMPONENT(type, flag, name) \
282+
#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \
283283
if (flags & (unsigned) flags_t::flag) \
284-
transformValues[numTransformValues++] = transform.name;
284+
transformValues[numTransformValues++] = transform.name / mult;
285285
PROCESS_TRANSFORM_COMPONENTS;
286286
#undef PROCESS_TRANSFORM_COMPONENT
287287
varStore.get_delta (transformVarIdx, coords, hb_array (transformValues, numTransformValues), cache);
288288
numTransformValues = 0;
289-
#define PROCESS_TRANSFORM_COMPONENT(type, flag, name) \
289+
#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \
290290
if (flags & (unsigned) flags_t::flag) \
291-
transform.name = transformValues[numTransformValues++];
291+
transform.name = transformValues[numTransformValues++] * mult;
292292
PROCESS_TRANSFORM_COMPONENTS;
293293
#undef PROCESS_TRANSFORM_COMPONENT
294294
}
295295

296296
// Divide them by their divisors
297-
#define PROCESS_TRANSFORM_COMPONENT(type, flag, name) \
297+
#define PROCESS_TRANSFORM_COMPONENT(type, mult, flag, name) \
298298
if (flags & (unsigned) flags_t::flag) \
299299
{ \
300300
HBINT16 int_v; \
@@ -334,9 +334,9 @@ bool
334334
VARC::get_path_at (const hb_varc_context_t &c,
335335
hb_codepoint_t glyph,
336336
hb_array_t<const int> coords,
337-
hb_transform_t transform,
337+
hb_transform_t<> transform,
338338
hb_codepoint_t parent_glyph,
339-
VarRegionList::cache_t *parent_cache) const
339+
hb_scalar_cache_t *parent_cache) const
340340
{
341341
// Don't recurse on the same glyph.
342342
unsigned idx = glyph == parent_glyph ?
@@ -372,7 +372,7 @@ VARC::get_path_at (const hb_varc_context_t &c,
372372
#endif
373373
return false;
374374

375-
hb_extents_t comp_extents (glyph_extents);
375+
hb_extents_t<> comp_extents (glyph_extents);
376376
transform.transform_extents (comp_extents);
377377
c.extents->union_ (comp_extents);
378378
}
@@ -392,10 +392,10 @@ VARC::get_path_at (const hb_varc_context_t &c,
392392

393393
hb_ubytes_t record = (this+glyphRecords)[idx];
394394

395-
VarRegionList::cache_t static_cache[sizeof (void *) * 16];
396-
VarRegionList::cache_t *cache = parent_cache ?
395+
hb_scalar_cache_t static_cache;
396+
hb_scalar_cache_t *cache = parent_cache ?
397397
parent_cache :
398-
(this+varStore).create_cache (hb_array (static_cache));
398+
(this+varStore).create_cache (&static_cache);
399399

400400
transform.scale (c.font->x_multf, c.font->y_multf);
401401

@@ -406,7 +406,7 @@ VARC::get_path_at (const hb_varc_context_t &c,
406406
cache);
407407

408408
if (cache != parent_cache)
409-
(this+varStore).destroy_cache (cache, hb_array (static_cache));
409+
(this+varStore).destroy_cache (cache, &static_cache);
410410

411411
return true;
412412
}

0 commit comments

Comments
 (0)