Commit Graph
28 Commits
Author SHA1 Message Date
Behdad Esfahbod cfe86ce5e7 [subset] Harden VARC closure handling
Propagate allocation and component-decoding failures from VARC closure
instead of continuing with an incomplete glyph set. Treat malformed VARC
records as dependency-extraction failures as well.

Document VARC dependency edges and exercise subset variation-store
remapping at non-default coordinates.

Tested with:
- meson test -C build
- standalone lean and world syntax checks
- CMake harfbuzz-subset build

Assisted-by: OpenAI Codex <openai-codex@users.noreply.github.com>
2026-09-10 12:11:13 -06:00
Behdad Esfahbod 3a1ab8f173 [depend] Compact edge deduplication storage
Dependency edges are already retained in per-glyph output vectors, but the
generic deduplication hashmap stored another complete edge record in every
36-byte bucket. Replace it with an exact open-addressed table whose buckets
hold only an eight-byte source and per-glyph edge index. Hash collisions are
resolved by comparing the retained records, preserving first-seen ordering
and flags.

On Noto Nastaliq this reduces construction from about 229ms to 209ms and
from 2.83 to 2.77 billion instructions. Peak RSS falls from about 46MB to
28MB, while cumulative allocated bytes fall from about 78.4MB to 49.1MB.

Dependency graphs match for Noto Nastaliq, Noto Sans Duployan, Gulzar,
Iran Nastaliq, Noto COLRv1, Amiri, and Source Serif Variable Roman.

Tested with: meson test -C build

Assisted-by: OpenAI Codex <codex@openai.com>
2026-08-20 04:16:51 -06:00
Behdad Esfahbod 375b3f4b33 [depend] Combine edge deduplication lookup and insert
Use a non-overwriting hashmap insertion to detect duplicate dependency
edges. This avoids hashing and probing every newly inserted edge twice,
while still distinguishing duplicates from allocation failures through
the hashmap error state.

The NotoNastaliqUrdu compile-only dependency workload saves about 2.2M
instructions. Its wall-time change is below measurement noise.

Tested with: meson test -C build

Assisted-by: OpenAI Codex <codex@openai.com>
2026-08-20 03:48:08 -06:00
Behdad Esfahbod 31d8ff343e [depend] Flatten lookup feature storage
The per-lookup nested feature vectors introduced a leak in the sanitizer
job: their inner allocations were lost when the temporary dependency
builder was destroyed on GitHub's Clang 18 build.

Pack lookup index and feature tag into a single flat uint64_t vector, then
sort and deduplicate it and build per-lookup offsets. This preserves the
compact sequential traversal and its performance while giving the builder
only flat owning containers.

Tests: meson test -C build (272/272)
Tests: Clang 18 ASan/UBSan depend-fuzzer chunks (9/9)

Assisted-by: OpenAI Codex <codex@openai.com>
2026-08-20 02:33:15 -06:00
Behdad Esfahbod b3eb3329d2 [depend] Store lookup feature tags in vectors
Lookup feature tags are collected once, then only iterated while dependency
edges are emitted. Sparse sets make each of those tiny iterations pay bit-page
lookup costs in a major graph-construction hot path.

Append tags to per-lookup vectors, then sort and deduplicate each vector once
after collection. This preserves the set's sorted iteration order while
avoiding quadratic insertion behavior for pathological feature lists.

On Noto Nastaliq this reduces dependency compilation from about 275ms to
259ms, with instructions falling from 3.50 billion to 3.32 billion. Output
is byte-identical.

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

Assisted-by: OpenAI Codex <codex@openai.com>
2026-08-20 02:09:19 -06:00
Behdad Esfahbod c0133a2fdd [depend] Deduplicate ligature dependency data (#6182)
Ligature dependency extraction built a set of component glyphs, but then
walked the original component array and allocated a distinct copy of the
set for every ligature record.  Repeated components and equivalent
ligature rules consequently generated millions of redundant edge lookups
and set objects on malformed fonts.

Walk the already-deduplicated component set and intern ligature sets using
the existing content-based dependency-set map.  Preserve the unused-set
reuse path by discarding only newly interned sets.

The slow dependency-fuzzer seed improves from about 0.91s and 292MB peak
RSS to 0.24s and 80MB.  The full 270-test Meson suite passes.

Assisted-by: OpenAI Codex <codex@openai.com>
2026-08-19 14:19:32 -06:00
Behdad Esfahbod e2ea4c5301 [depend] Fail graph construction on allocation errors
Dependency graph extraction must not silently drop edges when allocation
fails. Mark the builder failed when set, edge, or context storage cannot
be allocated, and stop context extraction before recording invalid set
indexes.

This keeps hb_subset_depend_from_face_or_fail() fail-closed instead of
returning a partial dependency graph that could under-approximate closure.

Testing: meson test -C build --suite api

Assisted-by: OpenAI Codex
2026-07-14 11:25:10 -06:00
Skef IterumandClaude Sonnet 4.6 ea0b0767e7 [depend] Change hb_subset_depend_lookup_glyph to array-getter pattern
Follows HarfBuzz convention: return total count, take start_offset +
entry_count IN/OUT + entries array. This allows callers to query the
total without filling, page through entries, or fetch all at once.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 15:09:12 -07:00
Skef IterumandClaude Sonnet 4.6 6a5f32c505 [depend] Public API overhaul: rename to hb_subset_depend_*, struct fill, remove print
- Rename all public symbols hb_depend_* → hb_subset_depend_*
- Rename hb_depend_t → hb_subset_depend_t
- Replace get_glyph_entry (multi out-param) with lookup_glyph (fills
  hb_subset_depend_entry_t struct; fields use ligature_set_index /
  context_set_index)
- Rename get_set_from_index → lookup_set
- Remove hb_depend_print from public API (util/hb-subset-depend TODO)
- Move hb_subset_depend_edge_flags_t to hb-depend.h; apply
  HB_MARK_AS_FLAG_T in hb-depend-data.hh (internal header only, since
  hb-algs.hh is not available in public headers)
- Rename HB_DEPEND_EDGE_FLAG_* → HB_SUBSET_DEPEND_EDGE_FLAG_*
- Update gen-def.py, check-symbols.py, and all test callers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 15:09:12 -07:00
Skef IterumandClaude Sonnet 4.6 0606d35c45 [depend] Gate only public API on HB_NO_SUBSET_DEPEND; implementation unconditional
Remove HB_NO_SUBSET_DEPEND guards from all internal implementation:
hb-depend-data.hh, hb-depend.hh, table depend() methods in COLR, GSUB,
glyf, CFF, MATH, and gsubgpos. The guard is now kept only around the
public hb_depend_* C API functions in hb-depend.cc (and hb-depend.h).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 15:09:12 -07:00
Skef IterumandClaude Sonnet 4.6 faf3caa5a4 [depend] Move non-GSUB table depend logic into table files
Add depend(hb_depend_data_builder_t *) to glyf_accelerator_t and
cff1_subset_accelerator_t. COLR::accelerator_t::depend gains a has_data()
guard. compile() now calls face->table.MATH/COLR/glyf directly; CFF uses
a temporary cff1_subset_accelerator_t since get_seac_components is on the
subset accelerator. Removes four get_*_dependencies wrappers from
hb_depend_data_builder_t.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 15:09:12 -07:00
Skef IterumandClaude Sonnet 4.6 b5d2b4d5fb [depend] Quick fixes: nullptr guard, enum flags, context set macro, comment
Remove nullptr check in hb_depend_t constructor per HarfBuzz convention
(crashing on null is fine). Convert HB_DEPEND_EDGE_FLAG_* #defines to
an hb_depend_edge_flags_t enum with HB_MARK_AS_FLAG_T, updating all
flag fields and parameters to use the enum type. Add
HB_DEPEND_CONTEXT_SET_FLAG for the 0x80000000 sentinel that marks
set-index references in context element sets; replace all raw literals
across depend-data.hh, gsubgpos.hh, and ReverseChain. Remove stale line
number reference from a comment in ReverseChain.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 15:09:12 -07:00
Skef IterumandClaude Sonnet 4.6 7c716218d6 [depend] Move construction logic to hb_depend_data_builder_t::compile()
Following the hb_ot_map_builder_t pattern, add a compile(face) method to
the builder that owns all per-table dependency extraction. The five
get_*_dependencies() methods move from hb_depend_t to the builder, taking
face as a parameter rather than using hb_depend_t members. The builder
now tracks its own success state and returns it from compile().

hb_depend_t::hb_depend_t() simplifies to a single compile() call after
setup, and hb_depend_t loses the features set (now a local in
get_gsub_dependencies) and the five method declarations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 15:09:12 -07:00
Skef IterumandClaude Sonnet 4.6 2487426df7 [depend] Builder refactor and internal type renames
Split hb_depend_data_t into a slim query-time struct and a temporary
hb_depend_data_builder_t following the hb_ot_map_t/hb_ot_map_builder_t
pattern. The builder holds all construction state (lookup_features,
seen_edges, set_to_index, etc.) and is scoped within the hb_depend_t
constructor, freeing that state once the graph is built.

Also rename internal types to follow HarfBuzz conventions:
  hb_depend_data_record_t    -> hb_depend_edge_t
  edge_key_t                 -> hb_depend_edge_key_t
  hb_glyph_depend_record_t  -> hb_depend_glyph_record_t
  hb_lookup_feature_record_t -> hb_depend_lookup_revmap_t

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 15:09:12 -07:00
Skef IterumandClaude Sonnet 4.6 9a5d99f850 [depend] Address review feedback: preprocessor guards, minor API and naming fixes
Replace HB_DEPEND_API with HB_NO_SUBSET_DEPEND gated on HB_EXPERIMENTAL_API
and HB_LEAN in hb-config.hh, with HB_SUBSET_DEPEND_API opt-in to allow
enabling without full experimental API. Remove depend_api meson option;
depend tests now build under experimental_api=true. Fold depend symbols into
experimental symbols in gen-def.py.

Internal fixes: use free_set_list.pop(), push_or_fail() for allocation safety,
return const hb_set_t* from internal get_set_from_index. Ligature.hh: use
hb_sink iterator, rename ligset→ligset_idx, source→gid. Remove stale
test_depend_cmap unit test (cmap extraction was removed in d4d4c635).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 15:09:12 -07:00
Skef IterumandClaude 02e80df2eb Adopt struct-based edge deduplication pattern
Refactor edge deduplication to follow HarfBuzz's established pattern
(as used in hb-serialize.hh and elsewhere), using struct-based hashing
instead of manual hash computation.

Changes:

1. Add operator== and hash() to hb_depend_data_record_t
   - Self-contained equality comparison of all identity fields
   - FNV-1a hash implementation
   - Flags intentionally excluded (metadata about discovery, not identity)
   - Documents why flags are excluded from equality

2. Add edge_key_t struct for deduplication
   - Combines source glyph with edge record
   - Simple operators that delegate to record's operator== and hash()
   - Requires default constructor for hashmap usage

3. Remove manual hash code (~110 lines deleted)
   - Delete get_edge_components() (~37 lines)
   - Delete compute_edge_hash() (~37 lines)
   - Delete edges_equal() (~33 lines)

4. Simplify add_depend_layout() (from ~50 to ~25 lines)
   - Create key, check hashmap, add if new
   - No collision handling needed (hashmap handles it)
   - No component vector storage

5. Replace storage
   - Old: hb_hashmap_t<uint64_t, hb_vector_t<uint32_t>> edge_hashes
   - New: hb_hashmap_t<edge_key_t, bool> seen_edges
   - Update cleanup in hb-depend.cc

Semantic change:
- Old: Compared set CONTENTS (iterated through set elements)
- New: Compares set INDICES directly
- Safe because: context sets deduplicated (same contents = same index),
  ligature sets intentionally unique (different rules = different indices)
- In practice: no real fonts have identical ligature components with
  different indices for the same layout_tag

Benefits:
- Follows established HarfBuzz pattern
- Simpler semantic (index-based comparison)
- Less code (~110 lines eliminated)
- Less memory (no component vector storage)
- More maintainable (single source of truth in record struct)
- Better separation of concerns (hashing logic in struct)

All tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-05 15:09:11 -07:00
Skef IterumandClaude f298400085 Address code review feedback for depend API
This commit addresses multiple code review comments:

1. Switch RNG to std::mt19937 for deterministic tests
   - Replace std::rand/srand with std::mt19937 in parity checker
   - Use std::uniform_int_distribution for all random number generation
   - Ensures test determinism across platforms for non-error-injection tests

2. Convert debug fprintf to DEBUG_MSG_LEVEL
   - Convert GSUB lookup processing prints to DEBUG_MSG_LEVEL(DEPEND, nullptr, 1, 0, ...)
   - Visible at HB_DEBUG_DEPEND=2 or higher for detailed per-lookup debugging

3. Rename function for consistency
   - hb_depend_from_face → hb_depend_from_face_or_fail
   - Follows HarfBuzz convention for functions returning nullptr on failure
   - Update all call sites, documentation, and code comments

4. Adopt established set deduplication pattern
   - Change from hb_vector_t<hb_set_t> to hb_vector_t<hb::unique_ptr<hb_set_t>>
   - Use pointer-based hashmap: hb_hashmap_t<const hb_set_t*, hb_codepoint_t>
   - Leverages hb_hash's content-based deduplication via pointer dereferencing
   - Follows pattern established elsewhere in HarfBuzz codebase

5. Separate ligature and context set semantics
   - Rename free_set → free_ligature_set (no hashmap manipulation)
   - Rename new_set → new_ligature_set (no hashmap manipulation)
   - Rename find_or_create_set → find_or_create_context_set (only function using hashmap)
   - Makes it explicit which sets are deduplicated (context) vs unique (ligature)
   - Update all call sites in Ligature.hh, ReverseChainSingleSubstFormat1.hh, hb-ot-layout-gsubgpos.hh

6. Code cleanup
   - Remove unused add_to_ligature_set function (dead code)
   - Refactor new_ligature_set(cp) to delegate to new_ligature_set(set)
   - Move set_to_index declaration near sets/free_set_list for better organization

All tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-05 15:09:11 -07:00
Skef IterumandClaude Opus 4.5 b351a2dc9c Fix under-approximation in context set filtering and update edge flag docs
Two related fixes:

1. Context set under-approximation fix (hb-ot-layout-gsubgpos.hh):
   When a direct requirement (from input positions) overlapped with a
   disjunctive set (backtrack/lookahead), the code incorrectly added
   the filtered (remaining) set as an additional requirement. Fix:
   if position_context intersects with original_set at all, the
   disjunctive requirement is already satisfied - don't add anything.

2. Parity checker ligature fix (hb-depend-closure-parity.cc):
   When processing deferred ligatures, store {dependent, ligature_set,
   flags} at deferral time instead of re-scanning edges later. This
   preserves the feature filtering that was already done and correctly
   propagates edge flags.

Also updates edge flag documentation to correctly explain the mechanism:
- Depend extraction records edges based on static input coverage/class
- During closure, lookups within a rule are applied sequentially
- Lookups at earlier positions may transform later positions
- Multiple lookups at same position may interact (one produces a glyph,
  another immediately consumes it as an "intermediate")
- So a glyph matching coverage might not persist when closure traverses

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-06-05 15:09:11 -07:00
Skef IterumandClaude Opus 4.5 f034f90629 Fix ligature processing bugs in depend parity checker
Two bugs were fixed in the closure parity checker:

1. Feature filtering for ligatures: When processing deferred ligatures,
   the code re-scanned all edges to find satisfying ligature sets but
   forgot to filter by active features. This allowed ligatures to be
   added via edges from inactive features if their ligature set happened
   to be satisfied.

2. Flag checking for ligatures: When adding ligatures, we weren't
   checking or propagating the edge flags (FROM_CONTEXT_POSITION,
   FROM_NESTED_CONTEXT), so flagged ligature edges weren't being
   reported as expected over-approximation.

Also includes related changes to the depend extraction:
- Add FROM_NESTED_CONTEXT flag for nested contextual lookups
- Add context handling for ReverseChainSingleSubstFormat1
- Remove cmap from glyf/CFF closure stage (UVS edges shouldn't be
  followed for glyph-based closure)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-06-05 15:09:11 -07:00
Skef IterumandClaude ce4564da0d Add edge flags to detect over-approximation from contextual positions
Edges created from non-zero positions in multi-position contextual rules
can consume intermediate glyphs (glyphs produced then immediately consumed,
never settling in closure). This causes depend's closure to include extra
glyphs compared to subset's closure, which is expected behavior.

Added HB_DEPEND_EDGE_FLAG_FROM_CONTEXT_POSITION flag to mark these edges
at extraction time. Updated parity checker to track when such edges are
hit during closure computation and distinguish between:
- Expected over-approximation (hit flagged edge): informational only
- Unexpected over-approximation (no flagged edge): critical error

This enables detection of genuine bugs (unexpected over-approximation)
while allowing expected cases from intermediate glyphs.

Updated all API callers and documentation to include nullable flags
parameter. Renamed parity checker terminology from "fuzzer" to "parity"
for clarity.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-05 15:09:11 -07:00
Skef Iterum d0cee3ca7e Update depend API docs and add explicit test mode to fuzzer
Documentation updates:
- Add comprehensive context_set documentation to depend-api.md with
  encoding details and example code for check_context_satisfied()
- Update depend-for-closure.md: remove obsolete over-approximation
  analysis, reflect that recent testing shows no over-approximation
  with proper context_set filtering
- Update depend-implementation.md: correct descriptions of active
  glyph filtering, sequential accumulation, ligature sets, and
  context recording to match current implementation
- Fix terminology: change 'binning' to 'segmentation' throughout
- Fix hb-depend-data.hh:557: use HB_CODEPOINT_INVALID instead of 0
  for layout_tag default value

Fuzzer enhancements (hb-depend-closure-parity):
- Add explicit test mode with command-line options similar to
  hb-subset conventions:
    --unicodes=LIST       Unicode codepoints (U+XXXX, decimal, ranges)
    --gids=LIST           Glyph IDs (decimal, ranges)
    --no-layout-closure   Skip GSUB closure
    --layout-features=LIST GSUB features (comma-separated or *)
- Support multiple input formats:
    --unicodes=U+0041,U+0042,U+0043
    --unicodes=65-90
    --gids=10-50 --no-layout-closure
    --layout-features=liga,calt or --layout-features='*'
- Add robust input parsing with validation to prevent infinite loops
  on invalid input (e.g., --gids=abc or --unicodes=U+GGGG)
- Add error checking for conflicting options

This allows reproducing random test cases manually and testing
specific scenarios without finding the right seed.

Tested: All modes produce identical results to seed-based tests.
2026-06-05 15:09:11 -07:00
Skef Iterum 29cf3aa519 Add depend API: graph extraction with contextual filtering
This commit implements the experimental depend API for extracting glyph
dependency graphs from OpenType fonts. The depend API provides the foundation
for computing glyph closures and analyzing font structure.

The implementation significantly improves upon the initial draft (commit
3f59433d5) by adding contextual filtering to reduce over-approximation while
still capturing complete dependency graphs.

Core Architecture
-----------------

The depend implementation operates in graph extraction mode: it walks all font
tables once to build a complete dependency graph. The key innovation is
contextual filtering that reduces over-approximation compared to the naive
approach.

Contextual Filtering for Reduced Over-Approximation
----------------------------------------------------

The initial implementation (3f59433d5) recorded dependencies for ALL glyphs in
every lookup's coverage, leading to significant over-approximation. The current
implementation filters dependencies based on context:

**Individual Lookups**: Each lookup's depend() method filters by active glyphs:

  // Old approach (3f59433d5)
  + hb_iter (this+coverage)  // ALL coverage glyphs
  | hb_apply (record_dependency)

  // New approach
  hb_set_t intersection;
  (this+coverage).intersect_set (c->parent_active_glyphs(), intersection);
  + hb_iter (intersection)  // ONLY contextually relevant glyphs
  | hb_apply (record_dependency)

**Contextual Lookups**: ContextFormat1/2/3 and ChainContextFormat1/2/3 set up
active glyph contexts for nested lookups:

  hb_set_t* cur_active_glyphs = c->push_cur_active_glyphs();
  get_coverage().intersect_set(*c->glyphs, *cur_active_glyphs);

  // Process rules with filtered coverage
  + hb_zip (this+coverage, ruleSet)
  | hb_filter ([&] (hb_codepoint_t g) {
      return c->parent_active_glyphs().has(g);
    }, hb_first)
  | hb_apply (process_rule)

This significantly reduces over-approximation for simple cases while maintaining
complete graph coverage.

**Intentional Over-Approximation at Nested Boundaries**: When contextual rules
invoke nested lookups, we pass ALL glyphs to ensure no edges are missed:

  // In context_depend_recurse_lookups()
  cur_active_glyphs->set (*c->glyphs);  // Universe for nested lookups

This design choice prioritizes completeness over precision at contextual
boundaries, which is appropriate for graph extraction.

Edge Deduplication and Performance
-----------------------------------

Dependency extraction can generate millions of potential edges. To maintain
acceptable performance:

- Edge hashing (compute_edge_hash): O(1) duplicate detection via hash table
  keyed on (source, table_tag, layout_tag, dependent, ligature_set_contents)
- Hash collision handling: Falls back to O(n) linear search through glyph's
  existing dependencies only on collision (rare)
- Component vectors: Stores edge components for collision detection
- Post-extraction cleanup: Frees temporary structures (edge_hashes,
  lookup_features) to reduce memory footprint

Table-Specific Extraction
--------------------------

- **cmap**: Unicode → glyph mappings including UVS (Unicode Variation Sequences)
- **GSUB**: All substitution rules with feature tags and ligature set tracking
  - Handles all 8 GSUB lookup types including Extension (type 7)
  - Records which features reference each dependency
  - Groups ligature alternatives via ligature_set indices
- **glyf**: TrueType composite glyph components
- **CFF**: CFF1 SEAC (Standard Encoding Accented Character) composites
- **COLR**: Color layer dependencies for both COLRv0 and COLRv1
  - Filters self-referential PaintGlyph to prevent trivial cycles
- **MATH**: Mathematical variant glyphs and assembly components

CFF SEAC dependencies use table_tag='CFF ' with layout_tag=0 and
ligature_set=HB_CODEPOINT_INVALID, matching the pattern used for glyf.

Data Structure: hb_depend_data_record_t
----------------------------------------

Each dependency edge contains:
- table_tag: Source table (GSUB, glyf, CFF, COLR, MATH, cmap)
- dependent: Target glyph ID
- layout_tag: Feature tag (for GSUB) or UVS codepoint (for cmap), else 0
- ligature_set: Index into sets array for ligature alternatives, else INVALID
- context_set: Reserved for future contextual filtering (currently unused)

Graph stored as vector indexed by glyph ID, each containing vector of records.

Testing and Documentation
--------------------------

- test/api/test-ot-depend.c: Comprehensive test suite (645 lines)
  - Tests all table types and GSUB substitution formats
  - Includes regression tests for edge cases
  - Uses ContextFormat2-Depend-Test.ttf (minimized from 486KB to 85KB)

- test/fuzzing/hb-depend-fuzzer.cc: Production-quality closure implementation
  - Demonstrates correct ligature set handling
  - Includes feature filtering and over-approximation analysis
  - Reference implementation for depend-based closure computation

- docs/depend-api.md: Public API documentation with usage examples
- docs/depend-for-closure.md: Guide to using depend for closure computation
- docs/depend-implementation.md: Implementation details and architecture

Build System
-------------

- Meson option: -Ddepend_api=true
- Compile flag: -DHB_DEPEND_API
- Symbols in libharfbuzz-subset.dylib (applications must link both
  libharfbuzz and libharfbuzz-subset)

Status: Experimental API, subject to change.
2026-06-05 15:09:11 -07:00
Skef Iterum 4ea82e1afc Add comprehensive documentation for depend API
This commit adds complete documentation for the dependency analysis API
at all levels: public API, internal structures, and implementation.

Public API documentation (src/hb-depend.cc, src/hb-depend.h):
- Replaced "XXX Todo" placeholder in SECTION comment with detailed
  module description explaining dependency graphs and use cases
- Fixed misleading hb_depend_t description (was only mentioning UVS)
- Added full documentation for hb_depend_print() with debugging notes
- Added usage examples to all three public functions
- Updated all version tags from "?.0.0" to "REPLACEME"
- Added experimental API warnings throughout

Internal documentation (src/hb-depend-data.hh, src/hb-depend.hh):
- Documented 5 internal structures with purpose and ownership semantics
- Added comments explaining data relationships and lifecycle

Algorithm documentation (src/hb-depend.cc):
- Added detailed algorithm comments to 5 extraction methods explaining
  how dependencies are collected from each OpenType table (cmap, GSUB,
  glyf, COLR, MATH)

User guide (docs/depend-api.md):
- Created comprehensive 250-line API guide with:
  * Introduction with mechanism overview
  * Basic usage example (iterating dependencies)
  * Advanced examples (computing reachable glyphs, ligature sets)
  * API details and compilation instructions
  * Implementation notes including ownership semantics
  * Use cases (subsetting, coverage analysis, binning, testing)
- Prominent experimental API warnings

Build configuration (meson_options.txt):
- Updated option description to emphasize experimental status

All documentation follows HarfBuzz conventions and includes gtk-doc
formatting for API reference generation.
2026-06-05 15:09:11 -07:00
Skef Iterum 5bf964a211 Finishing up draft 2026-06-05 15:09:11 -07:00
Skef Iterum c263ee16f5 Add colrv1-depend
first try making support conditional on HB_DEPEND_API
2026-06-05 15:09:10 -07:00
Skef Iterum 8c2c627faa extraction API 2026-06-05 15:09:10 -07:00
Skef Iterum fe59e7c5cd Math, COLR, and glyf dependencies 2026-06-05 15:09:10 -07:00
Skef Iterum 65447f9cbb Initial playing around with dependencies 2026-06-05 15:09:10 -07:00