Commit Graph
21880 Commits
Author SHA1 Message Date
David Corbett cdbe72ca8b [USE] Update the data files for Unicode 18.0 (#6242)
This uses the data files from
<https://github.com/microsoft/font-tools/tree/9dcd14bcc9d9bb634b813fe06e1aaa2bc0209a7d/USE>.
2026-09-06 12:55:21 -06:00
Behdad Esfahbod 809f903b8a [fontations] Support bitmap glyphs (#6241)
Use Skrifa's bitmap-strike API to provide glyph extents and paint PNG
and BGRA images from CBDT and sbix tables. Select strikes using the
font's requested ppem and preserve the OT backend's table precedence.

Keep the face blob alive through image blobs retained by paint
callbacks.

Tests: meson test -C build --no-rebuild

Assisted-by: OpenAI Codex <codex@openai.com>
2026-09-05 21:09:46 -06:00
Behdad Esfahbod b6f26f5591 [fontations] Use COLRv1 clip boxes for glyph extents (#6239)
Skrifa exposes resolved COLRv1 clip boxes independently of outline
glyph metrics. Use them when present so glyph extents report the clip
bounds instead of falling back to painted-content bounds.

Keep the existing paint fallback for color glyphs without a clip box.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-09-05 20:24:18 -06:00
Behdad Esfahbod db981a8baf [gsubgpos] Preserve concat hazards at end of input (#6238)
The RuleSet fast paths filtered out rules requiring another glyph when
the skipping iterator reached the end of the buffer. Unlike the normal
rule walk, that early return did not record the resulting
unsafe-to-concat range.

Keep the end-of-input optimization, but track filtered rules and mark
their concat hazard before returning. Cover both contextual and chained
contextual rule sets with a five-rule font that forces the fast paths.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-09-05 14:44:39 -06:00
Behdad Esfahbod 92e67ef19f [ot] Preserve pair-positioning and ligature concat hazards
A zero-valued PairPos record can select a different, non-zero record
if the second glyph changes, so keep the pair unsafe to concat even
when no positioning was applied.

Likewise, make the ligature second-glyph digest rejection report the
same hazard as the full ligature walk.

Tests: meson test -C build

Port of https://github.com/harfbuzz/harfrust/pull/465

Assisted-by: OpenAI Codex <codex@openai.com>
2026-09-04 19:55:47 -06:00
Garret Rieger 2a6c6b9b90 Add test for hb_result_t::from() that moves the input. 2026-09-04 17:08:08 -06:00
Garret Rieger 18d0fd1a6c Rework TRY macro to work the MSVC:
Split into one macro for void results, and a new TRY_ASSIGN() for when the Ok() value needs to be assigned.
2026-09-04 17:08:08 -06:00
Garret Rieger 2f291a46ae Convert repacker and graph code to utilize to hb_result_t.
Converts all error handling in the repacker/graph code to use hb_result_t.
2026-09-04 17:08:08 -06:00
Behdad Esfahbod 17a0bdc245 [benchmark-shape] Accept multiple font/text pairs
Replace the singular named font and text options with repeated
positional FONTFILE TEXTFILE pairs. Register every supplied pair and
reject incomplete input so no requested benchmark is silently omitted.

Tested with the full Meson suite and an unfiltered two-pair run.

Assisted-by: Codex <codex@openai.com>
2026-09-04 15:33:01 -06:00
Behdad Esfahbod 8a98b8b3ab [benchmark-shape] Accept multiple variations
The --variations option previously parsed its entire argument as one
hb_variation_t, so only one axis could be selected. Parse the
comma-separated argument into an array and apply all valid axes.

Tested with the full Meson suite and a two-axis benchmark-shape run.

Assisted-by: Codex <codex@openai.com>
2026-09-04 15:28:29 -06:00
Behdad Esfahbod f2d62aaa7d Fix an int overflow
Fixes https://oss-fuzz.com/testcase-detail/4709124282318848
2026-09-04 14:14:49 -06:00
Behdad Esfahbod 724ef405f3 OT: Cache first-input classes per contextual RuleSet (#6234)
Build a compact class digest for every format-2 contextual RuleSet in
the subtable's existing external cache.  Reject a RuleSet before walking
its rules when the next input glyph cannot match any rule's first class.

Rules without another input position force the digest open.  Digest
collisions only cause the normal rule walk, and allocation failure falls
back to the uncached path.

Assisted-by: Codex <codex@openai.com>
2026-09-04 04:18:05 -06:00
Behdad Esfahbod be67d96120 OT: Cache contextual input and lookahead classes (#6233) 2026-09-04 03:17:19 -06:00
Behdad Esfahbod 8fa0d5da39 GPOS: Cache second-glyph digests per PairSet 2026-09-04 01:03:43 -06:00
Behdad Esfahbod b3e2d4bca4 Merge pull request #6232 from harfbuzz/more-opts
OT: Skip lookups missing possible second glyphs
2026-09-04 00:29:06 -06:00
Behdad Esfahbod 087e432312 OT: Add second-glyph lookup digests 2026-09-04 00:08:34 -06:00
Behdad Esfahbod 943da2a4fb Revert "OT: Cache lookup subtable indices"
This reverts commit e42994749c.
2026-09-03 23:54:38 -06:00
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