Class: Fontisan::Audit::Checks::OtsCompatibilityCheck
- Inherits:
-
Fontisan::Audit::Check
- Object
- Fontisan::Audit::Check
- Fontisan::Audit::Checks::OtsCompatibilityCheck
- Defined in:
- lib/fontisan/audit/checks/ots_compatibility_check.rb
Overview
Predicts whether Chrome/Android OTS (OpenType Sanitizer) would reject the font. OTS has strict requirements beyond the base OpenType spec — fonts that pass the spec can still be rejected by browsers.
Ports the most commonly-hit ots-sanitize rules:
- head magicNumber must be 0x5F0F3CF5
- head unitsPerEm must be 16–16384
- name table must have PostScript + Family names
- post table version must be 1.0, 2.0, 2.5, 3.0, or 4.0
- numGlyphs must be ≤ 65534 (uint16 minus sentinel)
- glyf/CFF (depending on sfnt flavor) must be present
- cmap must have at least one Unicode subtable
- OS/2 usWeightClass must be 1–1000
- OS/2 usWidthClass must be 1–9
- Total file size must be under the OTS limit (~30MB)
Constant Summary collapse
- MAX_GLYPHS =
65534 — OTS rejects fonts with more
0xFFFD- MAX_FILE_SIZE =
30MB — OTS soft limit
30 * 1024 * 1024
- VALID_POST_VERSIONS =
[1.0, 2.0, 2.5, 3.0, 4.0].freeze
- HEAD_MAGIC =
0x5F0F3CF5- MIN_UPM =
16- MAX_UPM =
16_384
Class Method Summary collapse
Methods inherited from Fontisan::Audit::Check
Class Method Details
.call(font) ⇒ Array<Models::ValidationReport::Issue>
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fontisan/audit/checks/ots_compatibility_check.rb', line 35 def self.call(font) issues = [] issues.concat(check_head(font)) issues.concat(check_post(font)) issues.concat(check_maxp(font)) issues.concat(check_name(font)) issues.concat(check_cmap(font)) issues.concat(check_os2(font)) issues.concat(check_outlines(font)) issues end |
.code ⇒ Object
47 48 49 |
# File 'lib/fontisan/audit/checks/ots_compatibility_check.rb', line 47 def self.code :ots_compatibility end |