Skip to main content

Module utils

Module utils 

Source

Constants§

CONTENT_DEDUP_SAMPLE_BYTES
Size (in bytes) of the head/tail samples taken by content_dedup_hash_u64. The full hash spans the file size plus these two samples, so collisions are only possible for files that agree on size and both head + tail windows — adequate for deduping the same .ttc read under different paths without incurring a full-file walk through mmapped pages.
FONT_EXTENSIONS
Known font file extensions (lowercase).

Functions§

content_dedup_hash_u64
Deterministic 64-bit “cheap” content hash derived from (file_size, first 4 KiB, last 4 KiB).
content_hash_u64
Deterministic 64-bit content hash over an arbitrary byte slice.
is_font_file
Check if a file has a recognized font extension.
normalize_family_name
Normalize a family/font name for comparison: lowercase, strip all non-alphanumeric characters.