mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 22:41:10 +01:00
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>