Class: Ucode::Models::Audit::Hinting
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Ucode::Models::Audit::Hinting
- Defined in:
- lib/ucode/models/audit/hinting.rb
Overview
Hinting summary for one face.
Answers the practical questions a designer or QA engineer asks: “Is this font hinted at all? What flavour? How much hinting, by byte / instruction count?” Unhinted fonts render poorly at small sizes; heavily hinted fonts can be 20%+ bytecode by file size.
TrueType hinting surfaces as the fpgm/prep/cvt programs plus the gasp per-ppem policy. CFF/CFF2 hinting surfaces as stem hints encoded inside each CharString. This model carries both, plus a derived ‘is_unhinted` flag and `hinting_format` classification so downstream tooling does not need to re-derive either.
All counts are nil-safe: a face with no hinting at all produces ‘Hinting.new` with every field falsy/nil rather than raising.
Constant Summary collapse
- FORMAT_TRUETYPE =
"truetype"- FORMAT_CFF =
"cff"- FORMAT_MIXED =
"mixed"- FORMAT_NONE =
"none"
Class Method Summary collapse
-
.derive_flags(has_tt:, has_cff:, has_gasp:) ⇒ Hash
Derive is_unhinted and hinting_format from individual flags.
Class Method Details
.derive_flags(has_tt:, has_cff:, has_gasp:) ⇒ Hash
Derive is_unhinted and hinting_format from individual flags. Called by the extractor before construction so the values land in serialized output without recomputation at read time.
gasp is a TrueType-specific table, so it counts toward the TrueType hinting bucket even when no fpgm/prep/cvt is present.
79 80 81 82 83 84 85 |
# File 'lib/ucode/models/audit/hinting.rb', line 79 def self.derive_flags(has_tt:, has_cff:, has_gasp:) tt_hints = has_tt || has_gasp { is_unhinted: !(tt_hints || has_cff), hinting_format: format_for(tt_hints, has_cff), } end |