Class: Fontisan::Audit::Checks::CmapCheck
- Inherits:
-
Fontisan::Audit::Check
- Object
- Fontisan::Audit::Check
- Fontisan::Audit::Checks::CmapCheck
- Defined in:
- lib/fontisan/audit/checks/cmap_check.rb
Overview
Validates cmap subtable invariants per the OpenType spec:
- At least one Unicode-encoded subtable is present
- Format 4: segCountX2 must equal segCount × 2
- Format 4: the last segment must have endCode 0xFFFF
- Format 4: reservedPad must be 0
- Format 12: groups must be sorted and non-overlapping
- Format 12: each group startCharCode ≤ endCharCode
- Subtable offsets must be within the cmap table bounds
Catches the most common real-world cmap bugs that renderers and text shapers reject silently.
Class Method Summary collapse
Methods inherited from Fontisan::Audit::Check
Class Method Details
.call(font) ⇒ Array<Models::ValidationReport::Issue>
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fontisan/audit/checks/cmap_check.rb', line 25 def self.call(font) return [] unless font.has_table?("cmap") raw = font.table_data["cmap"] return [] unless raw issues = [] issues.concat(validate_header(raw)) return issues unless issues.empty? records = read_encoding_records(raw) issues.concat(validate_unicode_presence(records)) issues.concat(validate_subtables(raw, records)) issues end |
.code ⇒ Object
41 42 43 |
# File 'lib/fontisan/audit/checks/cmap_check.rb', line 41 def self.code :cmap end |