Class: Ucode::Models::Audit::NamedInstance

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

Overview

One fvar named instance (e.g. “Bold”, “SemiCondensed”).

‘coordinates` is serialized as a compact “tag=value,tag=value” string (e.g. “wght=700,wdth=100”) for human readability. The AuditReport is primarily a human-facing artifact; downstream tooling that needs structured coordinates can re-derive them from fvar.

Class Method Summary collapse

Class Method Details

.format_coordinates(axis_tags, values) ⇒ String?

Build the coordinates string from a parallel array of axis tags and fvar coordinate values. Returns nil if either side is empty.

Parameters:

  • axis_tags (Array<String>)

    ordered axis tags (e.g. [“wght”, “wdth”])

  • values (Array<Numeric>)

    ordered coordinate values

Returns:

  • (String, nil)


31
32
33
34
35
36
37
# File 'lib/ucode/models/audit/named_instance.rb', line 31

def self.format_coordinates(axis_tags, values)
  return nil if axis_tags.nil? || values.nil?
  return nil if axis_tags.empty? || values.empty?

  pairs = axis_tags.zip(values).map { |tag, val| "#{tag}=#{val}" }
  pairs.join(",")
end