Class: Ucode::Models::Audit::Metrics

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/ucode/models/audit/metrics.rb

Overview

Layout-critical metrics for a face, consolidated from head, hhea, OS/2, and post tables. Designers and engineers can read all spacing-relevant numbers in one place instead of cross-referencing raw table dumps.

All fields are nil-safe — Type 1 fonts and stripped WOFF builds may not carry every table. Derived booleans (e.g. metrics_consistent?) tolerate nil inputs and return false rather than raising.

Instance Method Summary collapse

Instance Method Details

#metrics_consistent?Boolean

True when hhea ascent/descent match OS/2 typo ascent/descent. Mismatch is a common font bug that causes inconsistent line height across platforms.

Returns:

  • (Boolean)


102
103
104
105
106
107
# File 'lib/ucode/models/audit/metrics.rb', line 102

def metrics_consistent?
  return false if hhea_ascent.nil? || typo_ascender.nil?
  return false if hhea_descent.nil? || typo_descender.nil?

  hhea_ascent == typo_ascender && hhea_descent == typo_descender
end