Module: TTFunk::Subset

Defined in:
lib/ttfunk/subset.rb,
lib/ttfunk/subset/base.rb,
lib/ttfunk/subset/unicode.rb,
lib/ttfunk/subset/code_page.rb,
lib/ttfunk/subset/mac_roman.rb,
lib/ttfunk/subset/unicode_8bit.rb,
lib/ttfunk/subset/windows_1252.rb

Overview

Namespace for different types of subsets.

Defined Under Namespace

Classes: Base, CodePage, MacRoman, Unicode, Unicode8Bit, Windows1252

Class Method Summary collapse

Class Method Details

.for(original, encoding) ⇒ TTFunk::Subset::Unicode, ...

Create a subset for the font using the specified encoding.

Parameters:

  • original (TTFunk::File)
  • encoding (:unicode, :unicode_8bit, :mac_roman, :windows_1252)

Returns:

Raises:

  • (NotImplementedError)

    for unsupported encodings



18
19
20
21
22
23
24
25
26
# 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