Class: Ucode::Models::Audit::ColorCapabilities

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

Overview

Color-font capability summary for one face.

Answers: is this a color font, and if so, which format(s)? Modern color font formats are mutually exclusive in design but a single face can carry more than one (e.g. NotoColorEmoji ships COLR + CBDT + SVG so legacy and modern stacks all render).

‘color_formats` is derived at extraction time so consumers read a flat string list instead of re-deriving from the boolean lattice. Empty array ⇒ no color support.

Constant Summary collapse

FORMAT_COLR_V0 =
"colr_v0"
FORMAT_COLR_V1 =
"colr_v1"
FORMAT_CPAL =
"cpal"
FORMAT_SVG =
"svg"
FORMAT_CBDT =
"cbdt"
FORMAT_SBIX =
"sbix"

Class Method Summary collapse

Class Method Details

.derive_formats(has_colr:, colr_version:, has_cpal:, has_svg:, has_cbdt:, has_sbix:) ⇒ Array<String>

Derive the canonical color_formats list from individual flags. COLR v1 takes precedence over v0 — a v1 table can serve both.

Returns:

  • (Array<String>)


76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/ucode/models/audit/color_capabilities.rb', line 76

def self.derive_formats(has_colr:, colr_version:, has_cpal:,
                        has_svg:, has_cbdt:, has_sbix:)
  [].tap do |arr|
    if has_colr
      arr << (colr_version == 1 ? FORMAT_COLR_V1 : FORMAT_COLR_V0)
    end
    arr << FORMAT_CPAL if has_cpal
    arr << FORMAT_SVG  if has_svg
    arr << FORMAT_CBDT if has_cbdt
    arr << FORMAT_SBIX if has_sbix
  end
end