Class: Fontist::Import::Google::Models::Axis
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Fontist::Import::Google::Models::Axis
- Defined in:
- lib/fontist/import/google/models/axis.rb
Constant Summary collapse
- STANDARD_TAGS =
Standard OpenType variable font axis tags
{ "wght" => :weight, "wdth" => :width, "slnt" => :slant, "ital" => :italic, "opsz" => :optical_size, }.freeze
Instance Method Summary collapse
-
#custom_axis? ⇒ Boolean
Check if this is a custom (non-standard) axis.
-
#description ⇒ String
Get a human-readable description of the axis.
-
#range ⇒ Array<Float>
Get the range of values as an array.
-
#slant_axis? ⇒ Boolean
Check if this is the slant axis.
-
#weight_axis? ⇒ Boolean
Check if this is the weight axis.
-
#width_axis? ⇒ Boolean
Check if this is the width axis.
Instance Method Details
#custom_axis? ⇒ Boolean
Check if this is a custom (non-standard) axis
51 52 53 |
# File 'lib/fontist/import/google/models/axis.rb', line 51 def custom_axis? !STANDARD_TAGS.key?(tag) end |
#description ⇒ String
Get a human-readable description of the axis
65 66 67 68 69 70 |
# File 'lib/fontist/import/google/models/axis.rb', line 65 def description type = STANDARD_TAGS[tag] || "custom" start_val = format_value(start) end_val = format_value(self.end) "#{tag} (#{type}): #{start_val}–#{end_val}" end |
#range ⇒ Array<Float>
Get the range of values as an array
58 59 60 |
# File 'lib/fontist/import/google/models/axis.rb', line 58 def range [start, self.end] end |
#slant_axis? ⇒ Boolean
Check if this is the slant axis
44 45 46 |
# File 'lib/fontist/import/google/models/axis.rb', line 44 def slant_axis? tag == "slnt" end |
#weight_axis? ⇒ Boolean
Check if this is the weight axis
30 31 32 |
# File 'lib/fontist/import/google/models/axis.rb', line 30 def weight_axis? tag == "wght" end |
#width_axis? ⇒ Boolean
Check if this is the width axis
37 38 39 |
# File 'lib/fontist/import/google/models/axis.rb', line 37 def width_axis? tag == "wdth" end |