Class: Ucode::Audit::Extractors::Licensing
- Defined in:
- lib/ucode/audit/extractors/licensing.rb
Overview
Licensing + embedding permissions + vendor provenance.
Returned fields:
licensing: Models::Audit::Licensing instance, or nil for Type 1
Type 1 fonts have no OS/2 table; their licensing is nil. WOFF/ WOFF2 carry the same OS/2 + name tables as TTF/OTF and need no special handling.
Instance Method Summary collapse
Instance Method Details
#extract(context) ⇒ Hash{Symbol=>Object}
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ucode/audit/extractors/licensing.rb', line 33 def extract(context) font = context.font return { licensing: nil } unless sfnt?(font) os2 = table(font, "OS/2") name = table(font, "name") { licensing: Models::Audit::Licensing.new( **name_fields(name), vendor_id: sanitized_vendor_id(os2), embedding_type: Models::Audit::EmbeddingType.decode(os2&.fs_type&.to_i), fs_selection_flags: Models::Audit::FsSelectionFlags.decode(os2&.fs_selection&.to_i), ), } end |