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
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>
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
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>
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.
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.
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>
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>
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.
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>
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.