class Fontist::Import::Google::Models::FontVariant
Constants
- VALID_FORMATS
-
Valid font formats
Public Instance Methods
Source
# File lib/fontist/import/google/models/font_variant.rb, line 64 def description "#{name} (#{format})" end
Get a human-readable description of the variant
@return [String] description of the variant
Source
# File lib/fontist/import/google/models/font_variant.rb, line 36 def extension case format.to_sym when :ttf ".ttf" when :woff2 ".woff2" else "" end end
Get the file extension for this variant
@return [String] the file extension (.ttf or .woff2)
Source
# File lib/fontist/import/google/models/font_variant.rb, line 50 def ttf? format.to_sym == :ttf end
Check if format is TTF
@return [Boolean] true if format is :ttf
Source
# File lib/fontist/import/google/models/font_variant.rb, line 71 def valid_format? VALID_FORMATS.include?(format.to_sym) end
Validate the format
@return [Boolean] true if format is valid
Source
# File lib/fontist/import/google/models/font_variant.rb, line 27 def variable_font?(family = nil) return false if family.nil? family.variable_font? end
Check if this is a variable font Note: This requires access to the parent family’s axes Should be called with the parent family as context
@param family [FontFamily] the parent font family @return [Boolean] true if the parent family has axes
Source
# File lib/fontist/import/google/models/font_variant.rb, line 57 def woff2? format.to_sym == :woff2 end
Check if format is WOFF2
@return [Boolean] true if format is :woff2