Class: Ucode::Audit::Emitter::CodepointEmitter
- Inherits:
-
Object
- Object
- Ucode::Audit::Emitter::CodepointEmitter
- Includes:
- Repo::AtomicWrites
- Defined in:
- lib/ucode/audit/emitter/codepoint_emitter.rb
Overview
Writes <face_dir>/codepoints/<NAME>.json — the verbose
per-block codepoint detail list, emitted only in --verbose
mode.
For each touched block, walks the font's covered codepoints in that block and emits a Models::Audit::CodepointDetail per row, enriched with UCD metadata (name, gc, script, age) via the supplied Database.
Per-block chunking keeps each file under ~1MB even for CJK Extension J (~4,300 codepoints × ~200 bytes/detail ≈ 850KB).
Glyph SVG paths are written as relative URIs so the browser can
fetch each glyph on click. The with_glyph_paths flag controls
whether to populate the path field — when false, the field is
omitted entirely.
Instance Method Summary collapse
-
#emit(face_dir, block, database: nil, with_glyph_paths: false) ⇒ Boolean
True if written, false if skipped.
Methods included from Repo::AtomicWrites
#same_content?, #to_pretty_json, #write_atomic
Instance Method Details
#emit(face_dir, block, database: nil, with_glyph_paths: false) ⇒ Boolean
Returns true if written, false if skipped.
38 39 40 41 42 |
# File 'lib/ucode/audit/emitter/codepoint_emitter.rb', line 38 def emit(face_dir, block, database: nil, with_glyph_paths: false) path = Paths.codepoints_under(face_dir, encode_name(block.name)) payload = to_pretty_json(build_chunk(block, database, with_glyph_paths)) write_atomic(path, payload) end |