Commit Graph
21863 Commits
Author SHA1 Message Date
Behdad Esfahbod e42994749c OT: Cache lookup subtable indices 2026-09-03 23:54:33 -06:00
Behdad Esfahbod 2f3c21aae7 Revert "OT: Hoist lookup apply-function selection"
This reverts commit 932aae5e46.
2026-09-03 23:37:29 -06:00
Behdad Esfahbod 633af3bd1c Revert "OT: Specialize lookup traversal by apply function"
This reverts commit 3a565d72ba.
2026-09-03 23:37:11 -06:00
Behdad Esfahbod 3a565d72ba OT: Specialize lookup traversal by apply function 2026-09-03 23:33:41 -06:00
Behdad Esfahbod 932aae5e46 OT: Hoist lookup apply-function selection 2026-09-03 23:23:59 -06:00
Behdad Esfahbod 6bb7576508 [apply] Remove an unused field 2026-09-03 23:16:24 -06:00
Behdad Esfahbod e7fc944284 OT: Fuse redundant per-glyph shaping passes (#6231)
* OT: Fuse mask initialization into Unicode properties

* OT: Fuse glyph properties with digest rebuild
2026-09-03 22:56:46 -06:00
Behdad Esfahbod eed256c0d6 OT: Fuse glyph properties with digest rebuild 2026-09-03 22:31:42 -06:00
Behdad Esfahbod a60b48ef09 OT: Fuse mask initialization into Unicode properties 2026-09-03 22:30:40 -06:00
Behdad Esfahbod 80540ed4b1 [perf] Add public-domain Japanese script-run corpus
Add a 100,000-character Japanese shaping corpus derived from Natsume
Soseki's copyright-expired Wagahai wa Neko de Aru.  Split the sample
into pure Han, Hiragana, and Katakana runs, with Inherited characters
allowed within a run and Common characters omitted.

Document the Aozora Bunko source, reuse terms, source checksum, and
transformations in perf/texts/COPYING.

Testing: meson test -C build (274 tests passed)

Assisted-by: OpenAI Codex
2026-09-03 19:09:08 -06:00
Behdad Esfahbod 62712e7393 Revert "Add Japanese text corpus for perf testing"
This reverts commit c159b544f9.

Reason: Incompatible license of the source.
2026-09-03 19:04:43 -06:00
Behdad Esfahbod c159b544f9 Add Japanese text corpus for perf testing 2026-09-03 17:00:18 -06:00
Dylan PulverandDylan Pulver 2688e6c579 [unicode] Treat U+180F FVS4 as Default_Ignorable (#6229)
U+180F MONGOLIAN FREE VARIATION SELECTOR FOUR was added in Unicode
14.0 and has Default_Ignorable_Code_Point=Yes, but
is_default_ignorable() only covered U+180B..180E, so FVS4 was never
hidden and leaked a .notdef into the output.

8c65442069 ("[Unicode 14] Handle U+180F FVS4") added the U+180F case
to _hb_glyph_info_set_unicode_props() and to the Arabic shaper, but
that branch sits inside "if (unicode->is_default_ignorable (u))", so
it has been unreachable since it was written.  Extending the range to
U+180B..180F makes it live.

U+180B..180F are all Default_Ignorable_Code_Point per
DerivedCoreProperties.txt, so the range stays contiguous.

Before, with a font with no Mongolian coverage:

  $ hb-shape Roboto-Regular.abc.ttf -u U+0061,U+180F
  [1=0+1114|0=0@-908,0+0]

Every other default ignorable (U+180B..180E, U+FE00, U+200B) on that
font shapes to [1=0+1114].  After the change U+180F matches them.

Added two cases to mongolian-variation-selector.tests, which already
covered FVS1, FVS2, FVS3 and MVS but not FVS4: U+180F, and U+1810
MONGOLIAN DIGIT ZERO to pin the top of the range so it cannot be
widened by accident.

Tested with "meson test -C build": 254/254 OK, 0 failures.  Restoring
the old U+180B..180E fails in-house 6174/6176, and widening it to
U+180B..1810 fails the same way.

Assisted-by: claude-opus-5

Co-authored-by: Dylan Pulver <dylanpulver@users.noreply.github.com>
2026-09-03 16:26:30 -06:00
Qunxin Liu 14e63042fd [subset] bug fix for BASE table
Embed VarStore offset field when table version is 1.1
2026-09-03 14:23:05 -06:00
Garret Rieger 2093bb59bc Add HB_NODISCARD_STRUCT which doesn't generate compiler warnings when used in < c++17. 2026-09-02 16:30:59 -06:00
Garret Rieger 1b229922db Restrict direct value construction of hb_result_t to cases where neither T nor E can convert to the other.
This eliminates potential ambiguity in selecting the error or ok type.
2026-09-02 16:30:59 -06:00
Garret Rieger 5c5dad4659 Add value_or_default() 2026-09-02 16:30:59 -06:00
Garret Rieger 9afe31f17c Assign is_ok_ in init(). 2026-09-02 16:30:59 -06:00
Garret Rieger acc9e64065 Add unlikely () for error branch of TRY() 2026-09-02 16:30:59 -06:00
Garret Rieger 9d25eeab63 Add no discard to hb_result_t so that it must be used when returned.
- Also adds a helper to convert containers with in_error() into a hb_result_t's.
2026-09-02 16:30:59 -06:00
Garret Rieger eca9f9f910 Add hb_result_t<OkVal, ErrVal>
Error handling in repacker is in rough shape. Many of the methods are fallible, but often the return values aren't being checked for error state.

To help address this I thought it might be useful to introduce a result type similar to Result<> in rust (or std::expected) that would force callers to deal with errors in the returns.

This PR introduces hb_result_t<OkVal, ErrVal>.

Assisted by: Gemini
2026-09-02 16:30:59 -06:00
Behdad Esfahbod 46644f885d [ft] Serialize access to the static FreeType library (#6225)
FreeType requires face creation and destruction on a shared
FT_Library to be serialized. Protect the lazily-created static library,
its reference count, and its internally-owned faces with a lazy mutex.

Keep caller-owned FT_Library instances outside the new lock, and add a
multithreaded regression test for blob-backed faces and font funcs.

Tests: meson test -C build (272/272 passed)

Fixes: https://github.com/harfbuzz/harfbuzz/issues/6224
Assisted-by: OpenAI Codex <codex@openai.com>
2026-08-31 12:19:10 -06:00
Behdad Esfahbod 5c21cb4647 [script] Remove archaic aliases
See https://github.com/harfbuzz/harfrust/pull/458
2026-08-31 11:54:42 -06:00
Sylvestre Ledru e17de4dc14 Merge pull request #6222 from sylvestre/init-accelerator-pointers
[subset] Initialize the accelerator pointers in hb_subset_plan_t
2026-08-31 11:30:45 -06:00
dependabot[bot] 36d1ca50a2 Bump github/codeql-action/upload-sarif from 4.37.8 to 4.37.9
Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.37.8 to 4.37.9.
- [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/db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28...cdf488f595d80d6e07e03d4674febd5ab45fa938)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-31 16:30:27 +03:00
Behdad Esfahbod e8905fb3b3 Merge pull request #6218 from harfbuzz/repacker_error_handling
More fixes for repacker error handling
2026-08-27 16:02:16 -06:00
Garret Rieger 8d08f87417 Fix possible memory leak in coverage-graph.hh 2026-08-27 21:11:10 +00:00
Garret Rieger 367657d74d Add some missing checks for alloc failure in repacker. 2026-08-27 21:11:10 +00:00
Garret Rieger 15fe46ee28 Use value instead of pointer in overflow record dedup.
Avoids issues with ownership of pointer memory.
2026-08-27 21:11:10 +00:00
Garret Rieger 79f8c3d53b Re-implement bit set's next_range()/previous_range() to utilize zero counting.
Prior implementation was checking each bit manually. This improves efficiency by checking ranges of bits in one go using zero counting.
2026-08-27 15:10:38 -06:00
Garret Rieger e67dee3f3a Add tests and benchmarks for hb_set_t next_range(). 2026-08-27 15:10:38 -06:00
Garret Rieger a897489430 Add HB_GRAPH_INVALID constant for marking error results in graph/repacker code. 2026-08-27 14:22:26 -06:00
Garret Rieger 7eac03d53c Add missing error handling for fallible operations in the repacker. 2026-08-27 14:22:26 -06:00
nussaibah shaikh eca91585cc [util] parse numeric options in the C locale (#6216)
sscanf("%lf") for --font-size, --embolden, --font-extents and
--margin follows the environment LC_NUMERIC set by setlocale(LC_ALL,
""), so "10.5" parses as 10 under a comma-radix locale. Force
LC_NUMERIC to C after the environment locale is applied so these
options use a '.' radix, like g_ascii_strtod already does for --width.
2026-08-27 11:59:53 -06:00
Garret Rieger 5f16f4ba68 In pair pos format 2 splitting only recompute coverage size when the included glyph set changes.
Assisted by Gemini
2026-08-26 14:24:53 -06:00
Khaled Hosny 36cb489cb0 14.4.0 14.4.0 2026-08-26 22:27:05 +03:00
nussaibah shaikh 64dab85712 [depend] avoid inputCount underflow in context depend loops (#6211)
context_depend_lookup and chain_context_depend_lookup build the
input-position glyph sets with for (i = 0; i < inputCount - 1; i++),
so a Rule with inputCount 0 (what a null rule offset resolves to)
underflows the bound to UINT_MAX and reads past the object into the
Null pool. Rewrite both loops as i + 1 < inputCount, matching the
guarded inputCount handling used everywhere else in the file. Reached
from hb_subset_depend_from_face_or_fail on a crafted GSUB context
rule; seed added under test/fuzzing/fonts.
2026-08-26 08:52:19 -06:00
dependabot[bot] cc92e9c1e4 Bump github/codeql-action/upload-sarif from 4.37.7 to 4.37.8 (#6205)
Bumps [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) from 4.37.7 to 4.37.8.
- [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/ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd...db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-25 14:57:54 -06:00
Behdad Esfahbod 3f84c51ede [rust] Update HarfRust to 0.13.3
Assisted-by: Codex <codex@openai.com>
2026-08-25 14:38:53 -06:00
Behdad Esfahbod 03c3e45dfe [arabic] Enable Win1256 fallback on all platforms (#6209)
The Win1256 fallback is a static GSUB recipe selected by a narrow glyph-ID
signature; it does not call a Windows API. Enable it outside Windows too,
while retaining HB_NO_WIN1256 as an explicit opt-out.

Tested: meson test -C build; build with -DHB_NO_WIN1256

Assisted-by: Codex <codex@openai.com>
2026-08-25 10:00:11 -06:00
Behdad Esfahbod 299b37fe42 Merge pull request #6208 from harfbuzz/arabic-fallback-no-std-data
[arabic] Generate fallback data for no-std
2026-08-25 09:18:14 -06:00
Behdad Esfahbod af1ae4c9c6 [arabic] Generate fallback data for no-std
The HarfRust Arabic fallback cache now supports no-std builds. Emit the
presentation-form and ligature data without a std feature gate so the
generated Rust table is available there as well. The C++ output is unchanged.

Tested: meson test -C build

Assisted-by: Codex <codex@openai.com>
2026-08-25 09:17:04 -06:00
Behdad Esfahbod 4a3ef3a947 Merge pull request #6204 from Nussu06/depend-inputcount-page-overflow
[depend] Bound context inputCount to HB_MAX_CONTEXT_LENGTH
2026-08-25 07:58:24 -06:00
nussaiba shaikh 017621472d [bitset] Guard add_range/del_range against reversed element pointers
hb_bit_page_t::add_range and del_range compute la = &elt(a) and
lb = &elt(b) and memset the span between them. When a and b map to
element indices out of order within the page (la > lb), the pointer
difference (char *) lb - (char *) la goes negative and wraps to a
huge size_t, so the memset writes past the page.

Only run the multi-element branch when la < lb, and otherwise leave
the page untouched. The single-element (la == lb) branch is already
memory-safe. This defends the page code itself in addition to the
inputCount cap on the depend path.
2026-08-25 16:40:28 +05:30
Behdad Esfahbod 7356d8c3d1 [arabic] Generate fallback data for Rust (#6207)
Extend the Arabic table and PUA generators to emit the data needed by
HarfRust's fallback shaper. Require explicit PUA input paths so regeneration
does not depend on the current working directory, and pass them from the
HarfBuzz update makefile.

The generated C table payload remains byte-for-byte unchanged; its invocation
comment now records the required inputs. The Rust output passes HarfRust's full
workspace tests, no-std check, formatting, and strict clippy; the full
HarfBuzz Meson suite also passes.

Assisted-by: Codex <codex@openai.com>
2026-08-24 19:00:33 -06:00
Behdad Esfahbod ebdb43f4d9 [test] Add mort and morx text-rendering tests (#6206) 2026-08-24 14:54:55 -06:00
nussaiba shaikh 66ef3397ea [depend] Bound context inputCount to HB_MAX_CONTEXT_LENGTH
context_depend_recurse_lookups tracks covered sequence positions in
a fixed hb_bit_page_t, but the dependency-graph path never bounded
inputCount the way the shaping apply path does. A crafted GSUB
contextual rule with glyphCount past the page (e.g. 512) and a
SubstLookupRecord whose sequenceIndex lands in a higher page element
than endIndex makes hb_bit_page_t::add_range compute its memset
length as (char*)lb - (char*)la, which is negative and wraps to a
huge size_t, writing past the stack-allocated page. Reachable from
hb_subset_depend_from_face_or_fail on a crafted face.

Cap inputCount at HB_MAX_CONTEXT_LENGTH before the page is used,
matching the apply path; rules longer than that never apply during
shaping, so no real dependency edges are lost. Adds a regression
seed exercised by the depend fuzzer.
2026-08-24 14:57:59 +05:30
Behdad Esfahbod 485df9d575 [harfrust] Update to 0.13.2 (#6203) 2026-08-24 00:02:12 -06:00
Behdad Esfahbod 4a7dcd350a [harfrust] Store shape-plan data directly (#6201) 2026-08-23 22:42:03 -06:00
Behdad Esfahbod 5bfff718f1 [harfrust] Reuse cached per-shape metadata (#6200) 2026-08-23 21:58:04 -06:00