Sha256: 6200af2acb12722e52851987b5e29daff6cd6c7291f71a2f6814c500f06ed084

Contents?: true

Size: 599 Bytes

Versions: 4

Compression:

Stored size: 599 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'

module TTFunk
  class Table
    class Cff < TTFunk::Table
      class OneBasedIndex
        extend Forwardable

        def_delegators :base_index, :each, :table_offset,
          :count, :length, :encode

        attr_reader :base_index

        def initialize(*args)
          @base_index = Index.new(*args)
        end

        def [](idx)
          if idx == 0
            raise IndexError,
              "index #{idx} was outside the bounds of the index"
          end

          base_index[idx - 1]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ttfunk-1.6.2.1 lib/ttfunk/table/cff/one_based_index.rb
ttfunk-1.6.2 lib/ttfunk/table/cff/one_based_index.rb
ttfunk-1.6.1 lib/ttfunk/table/cff/one_based_index.rb
ttfunk-1.6.0 lib/ttfunk/table/cff/one_based_index.rb