Class: Fontisan::Audit::Checks::CollectionIntegrityCheck

Inherits:
Fontisan::Audit::Check show all
Defined in:
lib/fontisan/audit/checks/collection_integrity_check.rb

Overview

Validates TrueType/OpenType Collection (TTC/OTC) structural integrity: TTC header, per-face SFNT offsets, shared-table deduplication. TTC is undertooled — CJK and Apple workflows ship fonts as collections and no widely-available validator covers the collection-specific invariants.

Checks:

- TTC tag must be 'ttcf'
- header.majorVersion must be 1 or 2
- numFonts must be positive and match the offset array length
- every face offset must be > 0 and within the file
- face offsets must not overlap the TTC header
- (v2 only) DSIG tag/length must be null or point inside the file

Constant Summary collapse

TTC_TAG =
"ttcf"
VALID_MAJOR_VERSIONS =
[1, 2].freeze

Class Method Summary collapse

Methods inherited from Fontisan::Audit::Check

issue

Class Method Details

.call(font) ⇒ Array<Models::ValidationReport::Issue>

Parameters:

Returns:



28
29
30
31
32
33
34
35
# File 'lib/fontisan/audit/checks/collection_integrity_check.rb', line 28

def self.call(font)
  return [] unless collection?(font)

  issues = []
  issues.concat(validate_header(font))
  issues.concat(validate_face_offsets(font))
  issues
end

.codeObject



37
38
39
# File 'lib/fontisan/audit/checks/collection_integrity_check.rb', line 37

def self.code
  :collection_integrity
end