# File lib/ttfunk/table/cmap/subtable.rb, line 19
        def self.encode(charmap, encoding)
          case encoding
          when :mac_roman
            result = Format00.encode(charmap)
          when :unicode
            result = Format04.encode(charmap)
          else
            raise NotImplementedError, "encoding #{encoding.inspect} is not supported"
          end

          mapping = ENCODING_MAPPINGS[encoding]

          # platform-id, encoding-id, offset
          result[:subtable] = [mapping[:platform_id], mapping[:encoding_id],
            12, result[:subtable]].pack("nnNA*")

          return result
        end