The gvar facade only needs to pick between concrete table
accelerators. Embed the lowercase and uppercase accelerators directly
instead of allocating the selected implementation by hand.
This removes the extra allocation failure path and lifetime helpers,
while preserving the GVAR-first fallback order.
Tested with meson test -C build.
Assisted-by: OpenAI Codex
Expose only face->table.gvar to clients and let its accelerator
prefer GVAR before falling back to gvar. Keep the concrete table
types for tagged parsing and subsetting, while removing the
separate GVAR face-table slot from callers.
The facade owns the selected concrete accelerator so GVAR still
uses MediumTypes and gvar still uses SmallTypes.
Tested with meson test -C build and local subset-fuzzer target
builds.
Assisted-by: OpenAI Codex
The fuzzer build links static objects with C++11 and odr-used the
static constexpr glyph_count_max member through hb_min references,
requiring an out-of-class definition. Make it a constexpr helper
function instead so no storage definition is needed.
Tested with meson test -C build and local subset-fuzzer target builds.
Assisted-by: OpenAI Codex
The maxp/MAXP facade now carries the only recursion guard that was
needed for face glyph-count loading. The remaining face-table entries
do not need the core table sanitizer special case, so list them with
the regular table macro and drop the extra lazy-loader template
parameter.
Tested with meson test -C build and a no-beyond64k fuzzer target build.
Assisted-by: OpenAI Codex
Expose only face->table.maxp to clients and let its accelerator
choose MAXP before falling back to maxp. This keeps the uppercase
table as a tagged concrete type for subsetting while avoiding a second
client-facing face-table slot.
Use a sanitizer context with num_glyphs set to zero, matching core
table loading, so reading maxp/MAXP does not recurse back through
hb_face_t::get_num_glyphs().
Tested with meson test -C build and a no-beyond64k fuzzer target build.
Assisted-by: OpenAI Codex
Chained context format 5 widens the rule-set offsets, but its
rule-set count remains uint16. Likewise, the coverage-array counts in
the shared chained coverage-context body remain uint16 while the
coverage offsets can widen.
Use Array16Of with Types-sized offset entries for those fields.
Tested with: ninja -Cbuild
Tested with: meson test -C build --suite subset
Tested with: meson test -C build --suite shape
Tested with: meson test -C build
Assisted-by: OpenAI Codex
ReverseChainSingleSubst format 2 widens the coverage offsets and
substitute glyph IDs, but the backtrack and lookahead coverage-array
counts remain uint16. Keep both arrays with 16-bit counts while using
the selected Types offset width for their entries.
Tested with: ninja -Cbuild
Tested with: meson test -C build --suite subset
Tested with: meson test -C build --suite shape
Tested with: meson test -C build
Assisted-by: OpenAI Codex
GVAR uses the same structure as gvar, but its glyphCount field is
uint24. Keep the shared gvar_GVAR body typed by the OpenType size
family, use that field width when serializing glyphCount, and route
uppercase GVAR through the subsetter.
Tested with: ninja -Cbuild
Tested with: meson test -C build --suite subset
Tested with: meson test -C build
Assisted-by: OpenAI Codex
Rename the templated maxp/MAXP shared body to maxp_MAXP to match the
existing gvar_GVAR naming pattern.
Tested with: meson test -C build
Assisted-by: OpenAI Codex
The VORG tag is unchanged, but version 2 widens both
numVertOriginYMetrics and VertOriginYMetrics.glyphIndex to uint24.
Template the VORG body over the OpenType size family and keep the
public VORG type as a version-dispatch wrapper.
Subsetting preserves the source VORG major version, so version 1 stays
16-bit and version 2 stays 24-bit.
Tested with: meson test -C build --suite subset
Tested with: meson test -C build in-house test-ot-extents-cff
Tested with: meson test -C build
Assisted-by: OpenAI Codex
Templatize the existing maxp implementation over the OpenType size
family and add MAXP as the 24-bit numGlyphs variant. Prefer MAXP when
loading the face glyph count, expose it through the face table list, and
keep MAXP as MAXP during subsetting.
The earlier order-sensitive failure reproduced only with libharfbuzz and
libharfbuzz-subset built against different lazy-loader table orders.
After rebuilding both libraries with MAXP next to maxp, the reproducer
and full suite pass.
Tested with: meson test -C build --suite subset
Tested with: meson test -C build
Assisted-by: OpenAI Codex
Drop the hmtx/vmtx paths that encoded and read synthetic advance data past the 16-bit glyph range. Keep the existing count bookkeeping and use the same behavior as the HB_NO_BEYOND_64K path for glyphs beyond the normal metrics data.
Tested with: meson test -C build
Assisted-by: OpenAI Codex
Use maxp as the face-wide glyph count source and remove the old beyond-64k fallback that inferred glyph count from the loca table length. The glyf accelerator still keeps its own loca-derived bounds separately.
Tested with: meson test -C build
Assisted-by: OpenAI Codex
The beyond-64k spec adds COLR PaintGlyph2 format 33, matching
PaintGlyph format 10 but using a 24-bit glyph ID.
Template PaintGlyph over the glyph ID type and dispatch format 33
through the existing sanitize, subset, closure, and paint paths.
Testing: meson test -C build test-ot-color test-paint test-subset-colr
Testing: meson test -C build --suite subset
Testing: meson test -C build
Assisted-by: OpenAI Codex
The repacker graph sanitizer accepted non-v1 GSUB/GPOS roots
because GSUBGPOS::get_size() returns only the version field size
for unsupported major versions. Graph specialization then still
consulted the numeric version and could read the v1.2 lookupList2
field from a too-small fuzz object.
Require version major 1 before using GSUB/GPOS graph-specific
lookup discovery.
Testing: meson test -C build test-repacker test-classdef-graph
Testing: meson test -C build --suite subset
Testing: meson test -C build
Assisted-by: OpenAI Codex
GDEF subsetting started by allocating only the base v1.0 header
and then tried to extend the final v1.4 tail field directly.
That jumps over the intervening v1.4 offsets and can trip the
serializer head assertion under CIFuzz.
Keep the existing incremental allocation for v1.2/v1.3 so GDEF
downgrade snapshots can still trim those tails, but allocate the
full version-dependent header before writing v1.4 offsets.
Testing: meson test -C build --suite subset
Testing: meson test -C build
Assisted-by: OpenAI Codex
GSUB/GPOS v1.2 subsetting allocates the full version-dependent
header before writing the 32-bit list offsets. That already includes
the v1.1 featureVars field.
Avoid extending featureVars a second time after child list serialization
has advanced the serializer head, which can assert under CIFuzz.
Testing: meson test -C build --suite subset
Testing: meson test -C build
Assisted-by: OpenAI Codex
GSUB/GPOS subsetting started by allocating only the base v1.0
header, then jumped directly to lookupList2 for v1.2 tables. That
can pass a pointer beyond the serializer head to extend_min(), which
asserts under fuzzing.
Keep the old incremental allocation for v1.0/v1.1 tables so feature
variation downgrade snapshots can still trim the tail, but allocate
the full version-dependent header before writing v1.2 offsets.
Testing: meson test -C build --suite subset
Testing: meson test -C build
Assisted-by: OpenAI Codex
The default build has HB_NO_BEYOND_64K enabled, so serializers reject
glyph IDs above 0xffff with an integer-overflow error. Keep the high
glyph ClassDef size checks for beyond-64k builds only.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Coverage and ClassDef serialization use one pass over the input to
choose the compact format, then a second pass to write the selected
format. Reusing the same iterator for both passes left some iterator
types exhausted, which surfaced in test-classdef-graph for high glyph
IDs after the 24-bit forms were added.
Take a fresh iterator view for the sizing pass and another for the
actual serialization.
Testing: meson test -C build
Assisted-by: OpenAI Codex
MarkBasePos, MarkLigPos, and MarkMarkPos format 2 use nested
MarkArray2, BaseArray2, LigatureArray2, and Mark2Array2 tables
with 24-bit counts and offsets in different combinations.
Template the shared mark records and anchor matrices so format 1
continues to use SmallTypes while format 2 uses the widths specified
for the beyond-64k layout forms. Keep the subset graph wrappers bound
to their existing 16-bit forms.
Testing: meson test -C build
Assisted-by: OpenAI Codex
LookupOffsetList is parameterized by offset width, but its sanitizer
called the 16-bit offset-list base explicitly. Dispatch through the
actual List16OfOffsetTo base so 32-bit lookup-list views use the right
offset element type.
Tested with: meson test -C build
Assisted-by: OpenAI Codex
MarkMarkPos subsetting can drop empty Mark2 rows after filtering the
original coverage. Serialize the Mark2Array row count from the kept
coverage instead of the original candidate iterator length.
Tested with: meson test -C build --suite subset
Tested with: meson test -C build
Assisted-by: OpenAI Codex
Move the repeated typed offset casts in GSUBGPOS sanitize and subset
paths behind local accessors. The table fields keep their existing
reader-facing types, while lookup and feature subsetting can ask for
the specialized list views they need.
Tested with: meson test -C build
Assisted-by: OpenAI Codex
Update graph splitter comments to document that 24-bit layout formats
are intentionally left unsplit because their relevant offsets are
already widened.
Testing: not run; comment-only change.
Assisted-by: OpenAI Codex
Update the ClassDef and Coverage size estimator used by graph
splitting to derive glyph and range widths from the included glyphs
instead of assuming 16-bit table formats. Keep ClassDef size selection
aligned with the serializer heuristic, including class breaks and the
fact that class zero is not encoded in ClassDef tables.
Add high-glyph test cases that compare the estimator against actual
24-bit ClassDef and Coverage serialization sizes.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Template the graph Coverage sanitizers on the layout type width and
dispatch formats 3 and 4 through the MediumTypes variants. This lets
graph sanitization accept 24-bit Coverage tables instead of rejecting
those formats outright.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Template the graph ClassDef format wrappers on the layout type width
and dispatch formats 3 and 4 through the MediumTypes variants. This
lets graph sanitization accept 24-bit ClassDef tables instead of
rejecting those formats outright.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Select ClassDef formats 3 and 4 by updating the local format value
before storing it in the serialized table. The previous code adjusted
the union format field before overwriting it, so 24-bit glyph IDs could
still serialize as format 1 or 2.
Use the Types integer width for format 1/3 class values and preserve
the matching format tag for empty ClassDef tables.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Pass the typed coverage offset arrays directly to the shared
backtrack and lookahead match helpers. The skipping iterator already
knows how to extract the underlying 16- or 24-bit offset storage from
OffsetTo arrays, so the reverse-chain apply path does not need raw
pointer casts.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Allow the builder-style alternate and ligature serialization helpers
to accept either 16- or 24-bit glyph ID array wrappers. Keep one
GlyphID template parameter across each helper and leave the existing
format selection unchanged.
The ligature component-list wrapper is still passed by reference so
its cursor advances across LigatureSet serialization; the glyph data
itself remains read-only when callers pass const array views.
Testing: meson test -C build
Assisted-by: OpenAI Codex
The GDEF v1.4 header widens several top-level offsets, but not every
nested table changes its own internal offset widths. Document that
AttachList keeps Offset16 internals when reached through attachList2,
and that LigGlyph keeps Offset16 caret value offsets when reached
through LigCaretList2.
Testing: ninja -C build
Assisted-by: OpenAI Codex
Use Offset32-based coverage helper dereferences so decoded coverage
offset values work uniformly for both 16- and 24-bit encoded arrays.
Feed ContextFormat3_6 coverage arrays through the layout Types integer,
and template ChainContextFormat3 over Types so its coverage arrays follow
the same structure. The spec adds a sequence-context format 6, but no
corresponding chained-context coverage format; keep chained-context
dispatch limited to formats 4 and 5 and document the discrepancy.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Template the reverse-chain single substitution format over the layout
Types and dispatch format 2 for beyond-64k fonts.
Format 2 uses 24-bit coverage offsets and substitute glyph IDs. Keep
the lookahead count 16-bit as specified, even though its coverage
offsets are widened. Match coverage offsets through an Offset32 object
so both 16- and 24-bit offset arrays keep normal null-offset handling.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Use the layout Types array and offset forms for GSUB subtables that
gain 24-bit coverage-indexed arrays in the beyond-64k formats.
This widens SingleSubst substitute arrays, MultipleSubst sequence
offsets, AlternateSubst alternate-set offsets, LigatureSubst
ligature-set offsets, and the LigatureSet offsets to Ligature
tables while preserving the nested 16-bit counts required by the
spec.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Use the layout Types for chained context rule-set arrays and
ChainRuleSet offsets. For class-based formats, use a named
ChainClassRuleSet wrapper so the 24-bit surrounding offsets do not
leak as a second template argument at the call site.
This brings ChainedSequenceContextFormat4 and Format5 in line with
the spec's 24-bit counts and offsets while keeping class-rule
payloads in their 16-bit class-value form.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Use the layout Types for sequence context rule-set arrays and
RuleSet offsets. For class-based formats, use a named ClassRuleSet
wrapper so the 24-bit surrounding offsets do not leak as a second
template argument at the call site.
This brings SequenceContextFormat4 and Format5 in line with the
spec's 24-bit counts and offsets while keeping class-rule payloads
in their 16-bit class-value form.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Template the coverage-based sequence context format over layout
Types and dispatch format 6 through the MediumTypes instance.
This matches the spec's wider coverage-offset variant while keeping
formats 1 through 5 unchanged.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Fold the GDEF versioned header fields back into GDEF and select
active offsets from the table version.
Version 1.4 now honors the spec's 32-bit offset2 fields when they
are present. LigCaretList is templated over layout Types so the
version 1.4 LigCaretList2 layout can use the 32-bit coverage offset,
24-bit glyph count, and 24-bit LigGlyph offsets.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Move the GSUB/GPOS versioned header fields back into GSUBGPOS
and select the active ScriptList, FeatureList, and LookupList
offsets from the table version.
Version 1.2 now uses the spec's 32-bit offset2 fields when they
are present, while the common list internals remain the existing
16-bit layout structures.
Testing: meson test -C build
Assisted-by: OpenAI Codex
Add the BASE BaseCoord format 4 dispatch arm. The format mirrors
format 2, but stores the reference glyph as a 24-bit glyph ID for
fonts with an extended glyph repertoire. Share the implementation
through a Types-templated format pair.
The subsetting path remaps the widened reference glyph in the same
way format 2 remaps its 16-bit reference glyph.
Testing: meson test -C build
Assisted-by: OpenAI Codex
CursivePos format 2 reuses the templated format-1 body with wider
fields. Preserve the source format when serializing subsets so a format-2
subtable is not emitted with a format-1 tag.
Testing: meson test -C build
Assisted-by: OpenAI Codex