Commit Graph
22183 Commits
Author SHA1 Message Date
dependabot[bot] fba9b0dec2 Bump github/codeql-action/upload-sarif from 4.38.2 to 4.38.3
Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.38.2 to 4.38.3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2...24c54180a607b1449ed407dd24f251e4e9147c8d)

---
updated-dependencies:
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.38.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-13 12:54:28 +03:00
dependabot[bot] cc9c6c04aa Bump actions/upload-artifact from 7.0.1 to 7.0.2
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 7.0.1 to 7.0.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/043fb46d1a93c77aae656e7c1c64a875d1fc6a0a...cf430e030ddbb5b0abf93d22962f4752f3646cd9)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-13 12:53:55 +03:00
dependabot[bot] 0af507f995 Bump actions/download-artifact from 8.0.1 to 8.0.2
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 8.0.1 to 8.0.2.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c...9000827ccba6bdab643e8b6fd33ac0654aef8333)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-13 12:53:23 +03:00
Behdad Esfahbod 2329384670 [subset] Preserve COLR sentinel-only variation maps (#6389)
COLR closure returned before planning delta-set index mappings when
there was no store or no live variation index. Variable paint and stop
serialization then failed to find their remapped bases, dropping COLR.

Remap explicit delta-set indices even when every entry is the
NO_VARIATION_INDEX sentinel. Keep variation-row planning conditional on
live rows. Cover NULL and empty stores with ordinary subsetting,
partial instancing of either axis, and full instancing.

Testing: meson test -C build passed 271 targets, with one skip.

Assisted-by: OpenAI Codex
2026-10-12 17:50:56 -06:00
Behdad Esfahbod e8ed626526 [subset] Preserve Fixed base precision in COLR affine values (#6384)
Instancing PaintVarTransform loses low Fixed bits when the stored base
is converted to float before adding its delta. This occurs at ordinary
translation values and even when the delta is zero.

Add the float delta to the precise stored integer in double precision,
then round to the target Fixed integer. Preserve the existing default
coordinate fast path.

Cover all six coefficients, signed and zero deltas, and direct and
composed instances in both axis orders at ordinary magnitudes. The
pre-fix library fails the translation regression. All 256 configured
Meson tests pass, and all 28 matrices match FontTools exactly in each
instancing order.

Assisted-by: Codex
2026-10-11 14:41:09 -06:00
Behdad Esfahbod 534f82e726 [subset] Preserve negative derived COLR radial gradients (#6387)
Reparameterize circles and color stops together when a derived radius
is negative. Preserve pad, repeat, reflect, and stable stop ordering.
Normalize constant gradients after a partial pin without creating
constant variation regions at the new default.

Allow fractional parameter shifts on the common lattice of the circle
coordinates and F2Dot14 stops. This preserves odd stop bits in ordinary
coordinate ranges that integer-only shifts incorrectly rejected.

Assisted-by: Codex
2026-10-11 14:37:21 -06:00
Behdad Esfahbod d5e4f22a13 [COLR] Round variable clip edges outwards (#6388)
Round minimum clip edges down and maximum edges up in font units.
Nearest rounding can shrink bounds and cut painted pixels.

Cover signed fractional deltas, default coordinates, rendering, and
full/composed instances in both axis orders at ordinary values.
All 256 configured Meson tests passed.

Assisted-by: Codex
2026-10-11 14:32:47 -06:00
Behdad Esfahbod fac913b1de [math] Preserve and apply shared GDEF variation indices (#6385)
MATH devices were evaluated against an empty variation store, and the
subsetter dropped them without folding deltas into the base values.
MATH users were also omitted when pruning GDEF's shared store.

Evaluate MATH VariationIndex devices with GDEF's store. Collect indices
from retained constants, glyph information, and assemblies, then fold
pinned deltas and remap residual devices during subsetting. Preserve
ordinary ppem device corrections and reject unrepresentable values.

Add a reproducible two-axis fixture covering every MathValueRecord
location, axis orders, full and partial instances, and glyph pruning.
All 255 configured tests pass; reduced-feature syntax checks pass.

Assisted-by: Codex
2026-10-11 00:41:07 -06:00
Behdad Esfahbod 173eeb59a3 [subset] Allow unchanged VARC axis range requests (#6371)
Assisted-by: Codex
2026-10-11 00:38:36 -06:00
Behdad Esfahbod 5c5172fcd2 [subset] Preserve zero-contour glyph instructions when instancing (#6369)
Zero-contour glyphs can contain instructions for phantom-point metrics.
Non-default instancing discarded them, while the empty-glyph branch
also bypassed ordinary hint removal.

Copy these instructions into owned compiled storage, and remove them
when hinting is dropped. Keep discarded .notdef outlines empty.

Add generated data and regressions for ordinary subsets, default pins,
partial and full instances, hint removal, and phantom-point advances.
The configured Meson suite passes: 253 tests and one skipped.

Assisted-by: Codex
2026-10-11 00:38:02 -06:00
Behdad Esfahbod 3b39c74c3a [subset] Preserve overflowing static COLRv1 scales (#6370)
Assisted-by: Codex
2026-10-11 00:37:22 -06:00
Behdad Esfahbodandartemkulyk bc1e757db1 [subset/CBDT] Share strike data without losing bitmaps on OOM (#6368)
Identical CBLC subtables can share exact image blocks instead of
copying the same CBDT bytes for every strike. Carry forward the sharing
implementation and expected font outputs from #6287.

A cache allocation failure previously discarded a strike without
setting a serializer error, so subsetting could succeed with no bitmap
strikes. Treat cache insertion as best-effort and stop further insertions
after a cache error. Propagate failures in the required temporary image
and offset buffers to the serializer instead of silently dropping data.

Add a regression that fails all three cache allocations in turn and
compares both strikes and every image byte with uncached output. It also
checks required allocation failures cannot silently discard a strike.
The cache regression fails against the original PR and passes here.

The full configured Meson suite passed: 289 tests, including all 224
CBDT subset cases. MSVC and native 32-bit builds were not run locally.


Assisted-by: OpenAI Codex

Co-authored-by: artemkulyk <artem.kulyk@gmail.com>
2026-10-11 00:36:18 -06:00
Behdad EsfahbodandChi-Iroh e53a34da63 [meson] Link auxiliary libraries with the thread dependency (#6366)
Auxiliary libraries use inline HarfBuzz object and container code that
can reference pthread mutex functions. Meson's link_with does not
propagate the main library's external dependencies into these targets,
which leaves unresolved pthread symbols on IBM i.

Use common_harfbuzz_deps for the raster, vector, GPU, and Cairo
libraries, and thread_dep for the ICU and GObject libraries. CMake
already propagates Threads::Threads through the main library.

The full configured Meson suite passed (288 tests). All six libraries
have the thread compiler flags, and a build with optional libraries and
multithreading disabled succeeds. Native IBM i/AIX was unavailable.


Assisted-by: OpenAI Codex

Co-authored-by: Chi-Iroh <69324626+Chi-Iroh@users.noreply.github.com>
2026-10-11 00:34:56 -06:00
Behdad Esfahbod bfabf3f178 [vector] Document blob recycling ownership transfer (#6362)
The recycle functions store the supplied blob without taking another
reference. Mark both arguments transfer-full and explain that the
caller must not destroy the transferred reference. Also clarify that
the blob and its data may be reused by subsequent renders.

Verified ownership with a rendered blob's user-data destroy callback.
This change affects documentation only.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6357
Assisted-by: Codex
2026-10-10 18:40:28 -06:00
Behdad Esfahbod 58fbf06d6a [docs] Update vector quick-start glyph signatures (#6365)
The vector overview still passed pen coordinates to glyph functions,
whose public signatures now take a single extents mode instead.
Use HB_VECTOR_EXTENTS_MODE_EXPAND for both draw and paint examples.

Extracted both snippets from the documentation and compiled them as
C99 and C++11 with warnings treated as errors. The original snippets
fail to compile. Documentation only.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6360
Assisted-by: Codex
2026-10-10 18:35:14 -06:00
Behdad Esfahbod aa5eff6b85 [docs] Qualify the object constructor failure guarantee (#6364)
The lifecycle chapter claimed that all constructors return empty
singletons on failure. Constructors ending in _or_fail instead return
NULL, including the established blob constructors.

Describe both conventions and require checking _or_fail results.
Validated the XML and reproduced the blob constructor behavior with
a nonexistent file and an oversized blob. Documentation only.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6359
Assisted-by: Codex
2026-10-10 18:34:47 -06:00
Behdad Esfahbod 9d044f792d [vector] Clear accumulated content after failed renders (#6363)
Early returns for missing extents, empty PDF paint output, or other
render failures retained content despite the automatic-clear contract.
Move clearing to scope guards in the common draw and paint render
entry points, covering every return for SVG and PDF.

Document the failure behavior. Extend the lifecycle regression to
compare subsequent output with fresh contexts for both formats,
including PDF resources and empty PDF paint renders. The regression
fails before the fix. The full Meson suite passes: 290 passed and one
existing test was skipped. The lifecycle test also passes as C99.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6358
Assisted-by: Codex
2026-10-10 18:33:11 -06:00
Behdad Esfahbod 94e9073251 [raster] Restore background and palette defaults on paint reset (#6361)
Paint reset omitted the background and palette, leaving settings from
the previous render despite its documented default-state guarantee.
Reset both fields and document that clear preserves these settings.

Add coverage for clear, reset, and rendering with a recycled image.
The regression fails before the fix. The full Meson suite passes:
290 tests passed and one existing test was skipped.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6356
Assisted-by: Codex
2026-10-10 18:32:30 -06:00
Yao Zi 123eb68025 [meson] Fix CMake package prefixes on usr-merged systems (#6280)
CMake can discover the package through /lib when that directory is a
symlink to /usr/lib. Collapsing the relative prefix lexically then
selects the filesystem root instead of /usr.

Resolve the configuration directory before appending the relative
prefix, without raising the minimum CMake version.

Tested six path layouts, including the failing usr-merged case, spaces,
multiarch, lib64, and symlinked prefixes. The full configured Meson
suite passed: 288 tests.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6278
Assisted-by: OpenAI Codex
2026-10-10 18:10:44 -06:00
Behdad Esfahbod d89fa94461 [subset] Preserve distinct feature parameters and variations (#6350)
Matching lookup lists alone cannot establish that same-tag features are
duplicates. Different feature parameters carry distinct UI metadata, and
alternate features can have different behavior in each language system.

Compare complete supported parameter data before merging, and preserve
indices referenced by retained feature variations. Fully pinned fonts can
still merge features after resolving their alternates.

Add GSUB/GPOS regressions with differing cv01 character arrays, size
values, ss01 names, and ss02 alternatives, plus identical ss03 controls.
The full Meson suite passes, as do reduced-feature compilation checks.

Assisted-by: Codex
2026-10-10 17:07:29 -06:00
Behdad Esfahbod d45fa42c5a [vector] Restore reset defaults and clear PDF draw resources (#6355)
Vector reset omitted draw colors, paint background, SVG id prefixes,
and custom palette overrides. Restore these defaults while preserving
configuration across clear.

The PDF draw context also kept its opacity resource dictionary and
counter after clear, including automatic clearing after render.
Clear both with the accumulated output so later documents do not carry
resources from earlier renders.

Add regressions for SVG/PDF reset, configuration preservation, custom
palette overrides, and fresh-context PDF equivalence after explicit
clear, reset, and repeated rendering. All three regression groups fail
against the original implementation.

Tested with meson test -C build: 288 passed, 1 skipped, 0 failed.
The vector suite and the issue reproducer pass. The regression also
compiles and runs as C99 with -Wall -Wextra -Werror.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6342
Assisted-by: OpenAI Codex
2026-10-10 16:59:13 -06:00
Behdad Esfahbod 199cae8b28 [buffer] Document message callback lifetime across reset (#6354)
Buffer reset has retained message callbacks since their introduction,
although its documentation promised a freshly created buffer state.
Clarify that callbacks, their associated data, and attached user data
survive reset. Document explicit callback removal and destruction.

Add a regression test for callback-directed lookup skipping after
clear/reset, restoration of ligatures after removal, and exactly-once
destruction on replacement, removal, and final buffer destruction.

Tested with meson test -C build: 287 passed, 1 skipped, 0 failed.
The API test also compiles without buffer messages or OT shaping.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6341
Assisted-by: OpenAI Codex
2026-10-10 16:58:18 -06:00
Behdad Esfahbod 86c92a4735 [buffer] Clarify what clear_contents preserves (#6353)
The documentation listed only two retained settings, although
clear_contents also preserves flags, cluster level, invisible and
not-found glyphs, the message callback, and attached user data.
Document these properties and the random-state reset without changing
existing behavior.

Tested with meson test -C build: 287 passed, 1 skipped, 0 failed.

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6340
Assisted-by: OpenAI Codex
2026-10-10 16:57:40 -06:00
Behdad Esfahbod 818eea711c [algs] Preserve float precision when rounding (#6351)
Adding 0.5 in float can round up before floor sees the value. This
turns the predecessor of 0.5 into 1, and changes sufficiently large
odd integral floats by one. The latter also shifts exactly representable
16.16 axis bounds when the subsetter writes fvar.

Add 0.5 in double to preserve the input's fractional bits while retaining
the existing tie direction toward positive infinity. Exercise half ties,
their neighboring floats, and large positive and negative integers.

Validation: the new regression fails before the fix; the full Meson suite
passes all 282 configured tests after it.

Assisted-by: Codex
2026-10-10 12:08:50 -06:00
ebraminio 8aa60f12a9 [number] Deduplicate the logic around fraction (#6352)
* [number] Don't mutate input pointer on failure

Two last tests in test_parse_double used to fail but now don't.

* [number] Deduplicate the logic around fraction

Forming a new abstraction, _hb_fraction, just to consume the fraction part.
2026-10-10 12:05:00 -06:00
Behdad Esfahbod fd0c6c9a69 [subset] Preserve parameters and names in alternate features (#6349)
Alternate feature serialization lacks the source feature tag, so it
cannot identify and retain cvXX, ssXX, or size parameters. Name-ID
closure also visits only the original base feature, losing labels
referenced by retained alternates or fully instantiated substitutions.

Carry source tags for retained features after deduplication. Collect
name IDs from the current base feature, retained variation records,
and original features used by catch-all records.

Add ordinary, full, partial, and range regressions for all three
parameter formats in GSUB and GPOS. Ten of twelve regression subtests
fail before the fix. The complete Meson suite passes: 284 tests.
The changed layout units also compile with HB_NO_VAR.

Assisted-by: Codex
2026-10-10 04:12:54 -06:00
Behdad Esfahbod 1bf17d7295 [subset] Allow instancing axes unrelated to VARC (#6265)
Replace the blanket VARC instancing rejection with validation of the
axes referenced by retained components, variation regions, and nested
conditions. Remap those indices when unrelated axes are removed, while
keeping passthrough VARC incompatible with instancing.

Preserve component-internal variation data during avar2 instancing by
avoiding culling based on font-level reachable ranges. Add drawing
comparisons and rejection tests with reproducible fixtures, including
hidden component axes and non-default unrelated-axis pins.

Serialize sparse-region axis references using the revised VARC format.
Regenerate the fixtures without changing their logical VARC contents or
other table bytes, apart from the head checksum adjustment.

Validation: meson test -C build (283 passed); subset suite (130 passed);
C++11 compile checks with HB_NO_VAR and HB_NO_VAR_COMPOSITES.

Assisted-by: Codex
2026-10-10 04:04:32 -06:00
Behdad Esfahbod a2ccf95182 [subset] Preserve IFTB offsets when downgrading CFF2 (#6348)
Pass the requested minimum CharStrings offset size to the CFF1 INDEX
serializer, matching the CFF2 path. The conversion previously emitted
short offsets even with HB_SUBSET_FLAGS_IFTB_REQUIREMENTS enabled.

Add a Cantarell downgrade regression, registered with the existing
IFTB tests only when experimental API support is enabled. The original
subsetter fails it with and without preprocessing.

Full Meson suites pass with experimental API enabled (282 tests) and
disabled (263 tests, one skipped).

Assisted-by: Codex
2026-10-10 01:46:09 -06:00
Behdad Esfahbod 117264edde [subset] Preserve fractional CFF displacements during specialization (#6347)
Check the real value when identifying zero operands. Converting to an
integer truncates nonzero displacements smaller than one, allowing
h/v specialization to remove them and change glyph geometry.

Add move and line regressions covering positive and negative fractions
on either axis, alongside genuine zero operands. The regression fails
before the fix. The full Meson suite passes: 277 passed, one skipped.

Assisted-by: Codex
2026-10-10 01:23:34 -06:00
Behdad Esfahbod 3396dcb35b [subset] Keep original IUP contour points across serialization retries (#6345)
IUP adds rebased constant tuples to the plan's cached contour points.
When serialization needs a larger buffer, another gvar serialization
adds the same constants again. The final optimizer then chooses points
against a different outline than the one stored in glyf.

Copy the cached points before IUP instancing so every serialization
attempt starts from the original contour coordinates. Check allocation
failure through the usual vector error path.

Add a shifted-default Roboto Flex regression that fails on the original
subsetter. The entire configured Meson suite passes (278 tests, one
skipped).

Assisted-by: Codex
2026-10-10 01:13:14 -06:00
Behdad Esfahbod be6a74f303 [subset] Preserve line directions when specializing CFF charstrings (#6346)
hlineto and vlineto alternate directions for successive arguments.
Combining commands by their operator alone changes geometry: two
vertical segments become a vertical segment followed by a horizontal
one. Merging a mixed run also needs its argument-count parity.

Require odd parity before combining opposite starting directions and
even parity before combining identical h/v operators.

Test all 1,020 orientation sequences through eight segments at stack
limits 4 and 48, reconstructing every point after specialization. The
original specializer fails that test. Add a shifted Source Serif
instance and update its existing downgrade reference. The entire
configured Meson suite passes (277 tests, one skipped).

Assisted-by: Codex
2026-10-10 01:12:39 -06:00
Behdad Esfahbod 1e6ea99af7 [subset] Preserve deltas when a contour exceeds the IUP set limit (#6344)
The IUP optimizer returns success for contours larger than its 512-bit
sets can represent, leaving every optimized reference false. The
resulting partial instance loses the contour's variation data.

Keep all explicit references when skipping optimization at that limit.
This preserves the existing bounded search without changing geometry.

Add a 600-point contour regression. The original subsetter fails both
normal and preprocessed checks. The entire configured Meson suite
passes (278 tests, one skipped).

Assisted-by: Codex
2026-10-10 00:36:51 -06:00
Behdad Esfahbod 372119f1df [subset] Clamp fully instantiated COLRv1 alpha before narrowing (#6343)
Variation deltas can take solid and gradient stop alpha outside [0, 1].
Narrowing those values to F2DOT14 before clamping wraps alpha 2 to -2
and alpha -3 to 1, reversing the intended opacity.

Clamp full instances in float before storing alpha. Keep partial bases
unclamped because surviving axes can bring them back into range.

Add synthetic solid and gradient regressions for overflow, underflow,
and a partial base of 1.5 reduced to 0.5 by the retained axis. The old
subsetter fails four full-instance checks; the entire configured Meson
suite passes (278 tests, one skipped).

Assisted-by: Codex
2026-10-10 00:30:06 -06:00
Behdad Esfahbod c82300aefb Merge pull request #6339 from ebraminio/hb-number-copy-free
[number] Make integer parsings copy free
2026-10-09 14:27:49 -06:00
Behdad Esfahbod 78c25c84b4 Merge pull request #6338 from ebraminio/hb-number-ragel-free
[number] Make hb-number-parser ragel free
2026-10-09 14:27:38 -06:00
Behdad Esfahbod 56282e5b38 Merge pull request #6337 from ebraminio/hb-number
[number] Harden hb-number-parser implementation
2026-10-09 14:26:57 -06:00
Ebrahim 97513326fc [number][test] Add some more tests for the expected behavior 2026-10-09 16:17:08 +03:30
Ebrahim f8ba9744b1 [number] Make hb_parse_int and hb_parse_uint copy free
There is one known difference before and after the change that comes
from 32bit/64bit machines difference on long size which is documented
in the tests.
2026-10-09 15:49:50 +03:30
Ebrahim 30f2eae3c7 [number] Only alter value pointer if parsing was successful
Previously it was changing value's pointer even if the parsing
was declarad a failure, this fixes it by changing the value
only if the parsing was successful.
2026-10-09 15:02:35 +03:30
Ebrahim 1622d7cb09 [test][number] Expand the testing
This only adds new tests to the current implementation but changes nothing.
2026-10-09 15:02:31 +03:30
Ebrahim 9cf8b485c7 [subset] Avoid use of undefined behavior in calling hb_parse_double 2026-10-09 06:04:13 +03:30
Ebrahim 864683d182 [number] Make the number parser free from ragel 2026-10-09 04:52:28 +03:30
Ebrahim 3150953d5b ci: Fix 32-bit Windows build bot by accepting tolerance 2026-10-09 04:50:53 +03:30
Ebrahim 2855792914 [test] Minor reorg, separate parse int tests from parse double 2026-10-09 04:12:45 +03:30
Ebrahim 5d441040db [test] Use isinf and signbit from std::
Once the project was avoiding STL and everything related at all cost
but now use of std:: provided things exists on the project despite
still no runtime dependency to STL (which is fantastic) and
since this in tests and even this doesn't pull STL, use of std::
should be okay to resolve the issue some of the CI bots have with
accessing signbit and isinf (unlike my local machine which is ok).
2026-10-09 03:53:25 +03:30
Ebrahim d210429af2 [test][number] Import cmath to have access to isinf in different compilers
Apparently fails on some CI bots
2026-10-09 03:07:37 +03:30
Ebrahim 4ba6eca464 [number] When exponential overflow let's just return 0
Following what strtod does also.
2026-10-09 02:33:55 +03:30
Ebrahim f64ef34b6e [number] Add three more already passing tests 2026-10-09 02:29:07 +03:30
Ebrahim e9aebd3a23 [number] Make sure we match what a libc strtod does is small numbers 2026-10-09 02:03:49 +03:30
Ebrahim a7b63551cb [number] Reject all whitespace 2026-10-09 01:35:16 +03:30