module TTFunk::Subset

Namespace for different types of subsets.

Public Class Methods

for(original, encoding) click to toggle source

Create a subset for the font using the specified encoding.

@param original [TTFunk::File] @param encoding [:unicode, :unicode_8bit, :mac_roman, :windows_1252] @raise [NotImplementedError] for unsupported encodings @return [TTFunk::Subset::Unicode, TTFunk::Subset::Unicode8Bit,

TTFunk::Subset::MacRoman, TTFunk::Subset::Windows1252]
# File lib/ttfunk/subset.rb, line 18
def self.for(original, encoding)
  case encoding.to_sym
  when :unicode then Unicode.new(original)
  when :unicode_8bit then Unicode8Bit.new(original)
  when :mac_roman then MacRoman.new(original)
  when :windows_1252 then Windows1252.new(original) # rubocop: disable Naming/VariableNumber
  else raise NotImplementedError, "encoding #{encoding} is not supported"
  end
end